gen-tests: less hard-coding of 't' as the test directory
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 25 Jul 2012 13:55:57 +0000 (15:55 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 Jul 2012 11:35:41 +0000 (13:35 +0200)
This will make life easier for us in case we decide to rename the
testsuite directory in the future (perhaps to something like 'tests',
which is somewhat less cryptic than the current 't').

* gen-testsuite-part ($testdir): New variable, used throughout instead
of hard-coding the name of the test directory to 't'.
All the script adjusted to make proper use of '$testdir'.
($auxdir): Move its definition earlier, for consistency with the one
of '$testdir'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
gen-testsuite-part

index 25da45c..b968926 100755 (executable)
@@ -31,6 +31,13 @@ my $me = File::Basename::basename $0;
 # For use in VPATH builds.
 my $srcdir = ".";
 
+# The testsuite subdirectory, relative to the top-lever source directory.
+my $testdir = "t";
+
+# Where testsuite-related helper scripts, data files and shell libraries
+# are placed.  Relative to the '$testdir' subdirectory.
+my $auxdir = "ax";
+
 #--------------------------------------------------------------------------
 
 sub unindent ($)
@@ -109,7 +116,7 @@ sub get_list_of_tests ()
   my $make = defined $ENV{MAKE} ? $ENV{MAKE} : "make";
   # Unset MAKEFLAGS, for when we are called from make itself.
   my $cmd = "MAKEFLAGS= && unset MAKEFLAGS && cd '$srcdir' && "
-            . "$make -s -f t/list-of-tests.mk print-list-of-tests";
+            . "$make -s -f $testdir/list-of-tests.mk print-list-of-tests";
   my @tests_list = split /\s+/, `$cmd`;
   die "$me: cannot get list of tests\n" unless $? == 0 && @tests_list;
   my $ok = 1;
@@ -135,52 +142,48 @@ sub parse_options (@)
 
 #--------------------------------------------------------------------------
 
-# Where testsuite-related helper scripts, data files and shell libraries
-# are placed.  Relative to the 't/' subdirectory.
-my $auxdir = "ax";
-
 my %deps_extractor =
   (
     libtool_macros =>
       {
         line_matcher => qr/^\s*required=.*\blibtool/,
-        nodist_prereqs => "t/libtool-macros.log",
+        nodist_prereqs => "$testdir/libtool-macros.log",
       },
     gettext_macros =>
       {
         line_matcher => qr/^\s*required=.*\bgettext/,
-        nodist_prereqs => "t/gettext-macros.log",
+        nodist_prereqs => "$testdir/gettext-macros.log",
       },
     use_trivial_test_driver =>
       {
         line_matcher => qr/\btrivial-test-driver\b/,
-        dist_prereqs => "t/$auxdir/trivial-test-driver",
+        dist_prereqs => "$testdir/$auxdir/trivial-test-driver",
       },
     check_testsuite_summary =>
       {
         line_matcher => qr/\btestsuite-summary-checks\.sh\b/,
-        dist_prereqs => "t/$auxdir/testsuite-summary-checks.sh",
+        dist_prereqs => "$testdir/$auxdir/testsuite-summary-checks.sh",
       },
     extract_testsuite_summary =>
       {
         line_matcher => qr/\bextract-testsuite-summary\.pl\b/,
-        dist_prereqs => "t/$auxdir/extract-testsuite-summary.pl",
+        dist_prereqs => "$testdir/$auxdir/extract-testsuite-summary.pl",
       },
     check_tap_testsuite_summary =>
       {
         line_matcher => qr/\btap-summary-aux\.sh\b/,
-        dist_prereqs => "t/$auxdir/tap-summary-aux.sh",
+        dist_prereqs => "$testdir/$auxdir/tap-summary-aux.sh",
       },
     on_tap_with_common_setup =>
       {
         line_matcher => qr/\btap-setup\.sh\b/,
-        dist_prereqs => "t/$auxdir/tap-setup.sh",
-        nodist_prereqs => "t/tap-common-setup.log",
+        dist_prereqs => "$testdir/$auxdir/tap-setup.sh",
+        nodist_prereqs => "$testdir/tap-common-setup.log",
       },
     depcomp =>
       {
         line_matcher => qr/\bdepcomp\.sh\b/,
-        dist_prereqs => "t/$auxdir/depcomp.sh",
+        dist_prereqs => "$testdir/$auxdir/depcomp.sh",
       },
   );
 
@@ -344,7 +347,7 @@ foreach my $lt (TRUE, FALSE)
             "depmode=$m",
             "depcomp_with_libtool=" . ($lt ? "yes" : "no"),
           );
-        my $test = "t/depcomp" . ($lt ? "-lt-" : "-") . $m . ".tap";
+        my $test = "$testdir/depcomp" . ($lt ? "-lt-" : "-") . "$m.tap";
         # Register wrapper test as "autogenerated" ...
         push @generated_tests, $test;
         # ... and create it.