From c3bcf99ccfdb499e0e97128910a5d920ab5338f0 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 23 Dec 2011 22:14:50 +0100 Subject: [PATCH] tests: automatically handle deps also for generated tests * tests/gen-testsuite-part: The test scripts are now scanned for automatic dependency generation *after* the auto-generated tests have been created, so they too will be scanned. It is a little tricky to ensure that the freshly-generated tests are correctly scanned, and we do that with the help of ... (@generated_tests): ... this new variable. Other related minor changes and refactorings. --- ChangeLog | 11 +++++++++ tests/gen-testsuite-part | 62 +++++++++++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index afd6a10..2c5cf2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-12-23 Stefano Lattarini + tests: automatically handle deps also for generated tests + * tests/gen-testsuite-part: The test scripts are now scanned for + automatic dependency generation *after* the auto-generated tests + have been created, so they too will be scanned. It is a little + tricky to ensure that the freshly-generated tests are correctly + scanned, and we do that with the help of ... + (@generated_tests): ... this new variable. + Other related minor changes and refactorings. + +2011-12-23 Stefano Lattarini + tests: auto-generate deps for tests requiring libtool/gettext * tests/gen-testsuite-part: Tests requiring libtool (or related programs) will need libtool-provided m4 macros, so they should diff --git a/tests/gen-testsuite-part b/tests/gen-testsuite-part index 0910092..51b634f 100755 --- a/tests/gen-testsuite-part +++ b/tests/gen-testsuite-part @@ -256,35 +256,13 @@ my %test_generators = parse_options @ARGV; my @all_tests = get_list_of_tests; +my @generated_tests = (); # Will be updated later. print "## -*- Makefile -*-\n"; print "## Generated by $me. DO NOT EDIT BY HAND!\n\n"; print <{dist_prereqs} || ""; - my $nodist_prereqs = $x->{nodist_prereqs} || ""; - my @tests = grep { line_match $x->{line_matcher}, $_ } @all_tests; - map { s/\.[^.]*$//; s/$/\.log/; } (my @logs = @tests); - print "## Added by deps-extracting key `$k'.\n"; - ## The list of all tests which have a dependency detected by the - ## current key. - print join(" \\\n ", "${k}_TESTS =", @tests) . "\n"; - print "EXTRA_DIST += $dist_prereqs\n"; - map { print "$_: $dist_prereqs $nodist_prereqs\n" } @logs; - print "\n"; - } - -print <{shell_setup_code} }, 0555; # Update generated makefile fragment to account for it. - print "generated_TESTS += $base-w.$suf\n"; + print "generated_TESTS += $wrapper_test\n"; # The generated test works by sourcing the original test, so that # it has to be re-run every time that changes ... print "$base-w.log: $wrapped_test\n"; @@ -326,4 +307,35 @@ while (my ($k, $g) = each %test_generators) } } +# The test scripts are scanned for automatic dependency generation *after* +# the generated tests have been created, so they too can be scanned. To +# do so correctly, we need to update the list in `@all_tests' to make it +# comprise also the freshly-generated tests. + +push @all_tests, @generated_tests; + +print <{dist_prereqs} || ""; + my $nodist_prereqs = $x->{nodist_prereqs} || ""; + my @tests = grep { line_match $x->{line_matcher}, $_ } @all_tests; + map { s/\.[^.]*$//; s/$/\.log/; } (my @logs = @tests); + print "## Added by deps-extracting key `$k'.\n"; + ## The list of all tests which have a dependency detected by the + ## current key. + print join(" \\\n ", "${k}_TESTS =", @tests) . "\n"; + print "EXTRA_DIST += $dist_prereqs\n"; + map { print "$_: $dist_prereqs $nodist_prereqs\n" } @logs; + print "\n"; + } + + __END__ -- 2.7.4