From ccff1671ae8f1ba631def51a8e1008601cb58392 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Sat, 3 Oct 2009 19:57:10 +0000 Subject: [PATCH] `cat ../svn-commit.2.tmp ` --- tests/scripts/generate_code.pl | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/scripts/generate_code.pl b/tests/scripts/generate_code.pl index f712395ce..0ccd4959e 100755 --- a/tests/scripts/generate_code.pl +++ b/tests/scripts/generate_code.pl @@ -43,13 +43,36 @@ while (my $line = ) { my $description = $line; $line = ; - my $command_line = $line; - $line = ; my $test_name = $description; $test_name =~ tr/A-Z \-/a-z__/; $test_name =~ tr/a-z0-9_//cd; + # Carve the defines required for this test case + my $requirements; + if ($line =~ /^depends_on:/) + { + my $depends_on_line = $line; + $line = ; + + ( $requirements ) = $depends_on_line =~ /^depends_on:(.*)$/; + } + + my @var_req_arr = split(/:/, $requirements); + my $pre_code; + my $post_code; + + while (@var_req_arr) + { + my $req = shift @var_req_arr; + + $pre_code .= "#ifdef $req\n"; + $post_code .= "#endif\n"; + } + + my $command_line = $line; + $line = ; + # Carve the case name and variable values # my ( $case, $var_value ) = $command_line =~ /^([\w_]+):(.*)$/; @@ -82,10 +105,11 @@ while (my $line = ) print TEST_FILE << "END"; +$pre_code FCT_TEST_BGN($test_name) $case_code FCT_TEST_END(); - +$post_code END }