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 }