From b34fef2f3c03ba858d7e606c8c5b51736359a399 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Tue, 20 Aug 2013 12:06:33 +0200
Subject: [PATCH] Suite dependencies handled correctly now
---
tests/scripts/generate_code.pl | 7 +++----
tests/suites/main_test.function | 13 +++++++++++--
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/tests/scripts/generate_code.pl b/tests/scripts/generate_code.pl
index d1676053e..40f993ff8 100755
--- a/tests/scripts/generate_code.pl
+++ b/tests/scripts/generate_code.pl
@@ -65,10 +65,11 @@ $suite_header
$test_helpers
-$suite_pre_code
-
END
+$test_main =~ s/SUITE_PRE_DEP/$suite_pre_code/;
+$test_main =~ s/SUITE_POST_DEP/$suite_post_code/;
+
while($test_cases =~ /\/\* BEGIN_CASE *([\w:]*) \*\/\n(.*?)\n\/\* END_CASE \*\//msg)
{
my $function_deps = $1;
@@ -219,8 +220,6 @@ $test_main =~ s/DISPATCH_FUNCTION/$dispatch_code/;
$test_main =~ s/MAPPING_CODE/$mapping_code/;
print TEST_FILE << "END";
-$suite_post_code
-
$test_main
END
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index f90cedd09..5eb46bf16 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -88,18 +88,27 @@ DEP_CHECK_CODE
return( 1 );
}
+SUITE_PRE_DEP
+#define TEST_SUITE_ACTIVE
FUNCTION_CODE
+SUITE_POST_DEP
+
int dispatch_test(int cnt, char *params[50])
{
int ret;
+ ((void) cnt);
+ ((void) params);
+#if defined(TEST_SUITE_ACTIVE)
DISPATCH_FUNCTION
{
fprintf( stdout, "FAILED\nSkipping unknown test function '%s'\n", params[0] );
fflush( stdout );
return( 1 );
}
-
+#else
+ return( 3 );
+#endif
return( ret );
}
@@ -239,7 +248,7 @@ int main()
if( skip == 1 || ret == 3 )
{
total_skipped++;
- fprintf( stdout, "-------\n" );
+ fprintf( stdout, "----\n" );
fflush( stdout );
}
else if( ret == 0 && test_errors == 0 )