From 5058a94ee717d96285da20423324af3478df175d Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 25 Feb 2013 01:38:36 -0500 Subject: Expand the loadable object support. Provide a simple API for loaded objects to interact with GNU make. I still won't guarantee that this API won't change but it's much closer to something that's supported and provides easy-to-use interfaces with a public header file. --- tests/run_make_tests.pl | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'tests/run_make_tests.pl') diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl index 4accd4a..a596328 100755 --- a/tests/run_make_tests.pl +++ b/tests/run_make_tests.pl @@ -35,6 +35,9 @@ $memcheck_args = '--num-callers=15 --tool=memcheck --leak-check=full --suppressi $massif_args = '--num-callers=15 --tool=massif --alloc-fn=xmalloc --alloc-fn=xcalloc --alloc-fn=xrealloc --alloc-fn=xstrdup --alloc-fn=xstrndup'; $pure_log = undef; +# The location of the GNU make source directory +$srcdir = ''; + $command_string = ''; $all_tests = 0; @@ -59,6 +62,15 @@ sub valid_option return 1; } + if ($option =~ /^-srcdir$/i) { + $srcdir = shift @argv; + if (! -f "$srcdir/gnumake.h") { + print "$option $srcdir: Not a valid GNU make source directory.\n"; + exit 0; + } + return 1; + } + if ($option =~ /^-all([-_]?tests)?$/i) { $all_tests = 1; return 1; @@ -226,14 +238,16 @@ sub run_make_with_options { sub print_usage { &print_standard_usage ("run_make_tests", - "[-make_path make_pathname] [-memcheck] [-massif]",); + "[-make MAKE_PATHNAME] [-srcdir SRCDIR] [-memcheck] [-massif]",); } sub print_help { &print_standard_help ( - "-make_path", + "-make", "\tYou may specify the pathname of the copy of make to run.", + "-srcdir", + "\tSpecify the make source directory.", "-valgrind", "-memcheck", "\tRun the test suite under valgrind's memcheck tool.", @@ -327,12 +341,8 @@ sub set_more_defaults $make_name = $1; } else { - if ($make_path =~ /$pathsep([^\n$pathsep]*)$/) { - $make_name = $1; - } - else { - $make_name = $make_path; - } + $make_path =~ /^(?:.*$pathsep)?(.+)$/; + $make_name = $1; } # prepend pwd if this is a relative path (ie, does not @@ -348,6 +358,15 @@ sub set_more_defaults $mkpath = $make_path; } + # If srcdir wasn't provided on the command line, see if the + # location of the make program gives us a clue. Don't fail if not; + # we'll assume it's been installed into /usr/include or wherever. + if (! $srcdir) { + $make_path =~ /^(.*$pathsep)?/; + my $d = $1 || '../'; + -f "${d}gnumake.h" and $srcdir = $d; + } + # Get Purify log info--if any. if (exists $ENV{PURIFYOPTIONS} -- cgit v1.2.3