4
# Test driver for the Make test suite
6
# Usage: run_make_tests [testname]
14
require "test_driver.pl";
19
if ($option =~ /^-make([-_]?path)?$/)
21
$make_path = shift @argv;
24
print "$option $make_path: Not found.\n";
30
# This doesn't work--it _should_! Someone needs to fix this badly.
32
# elsif ($option =~ /^-work([-_]?dir)?$/)
34
# $workdir = shift @argv;
41
sub run_make_with_options
43
local ($filename,$options,$logname,$expected_code) = @_;
45
local($command) = $make_path;
47
$expected_code = 0 unless defined($expected_code);
51
$command .= " -f $filename";
56
$command .= " $options";
59
$code = &run_command_with_output($logname,$command);
61
# Check to see if we have Purify errors. If so, keep the logfile.
62
# For this to work you need to build with the Purify flag -exit-status=yes
64
if ($pure_log && -f $pure_log) {
68
# If we have a purify log, save it
69
$tn = $pure_testname . ($num_of_logfiles ? ".$num_of_logfiles" : "");
70
print("Renaming purify log file to $tn\n") if $debug;
71
rename($pure_log, "$tn")
72
|| die "Can't rename $log to $tn: $!\n";
80
if ($code != $expected_code)
82
print "Error running $make_path ($code): $command\n";
89
system "add_profile $make_path";
96
&print_standard_usage ("run_make_tests", "[-make_path make_pathname]");
101
&print_standard_help ("-make_path",
102
"\tYou may specify the pathname of the copy of make to run.");
107
$delete_command = "delete_file";
108
$__pwd = `++(current_dir)`;
111
$delete_command = "rm";
112
chop ($__pwd = `pwd`);
121
$testee = "GNU make";
123
$tmpfilesuffix = "mk";
124
$pwd = &get_this_pwd;
127
sub set_more_defaults
132
# find the type of the port. We do this up front to have a single
133
# point of change if it needs to be tweaked.
135
# This is probably not specific enough.
137
if ($osname =~ /Windows/i) {
140
# Bleah, the osname is so variable on DOS. This kind of bites.
141
# Well, as far as I can tell if we check for some text at the
142
# beginning of the line with either no spaces or a single space, then
143
# a D, then either "OS", "os", or "ev" and a space. That should
144
# match and be pretty specific.
145
elsif ($osname =~ /^([^ ]*|[^ ]* [^ ]*)D(OS|os|ev) /) {
148
# Everything else, right now, is UNIX. Note that we should integrate
149
# the VOS support into this as well and get rid of $vos; we'll do
155
# Find the full pathname of Make. For DOS systems this is more
156
# complicated, so we ask make itself.
158
$make_path = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
160
print "Make\t= `$make_path'\n" if $debug;
162
$string = `$make_path -v -f /dev/null 2> /dev/null`;
164
$string =~ /^(GNU Make [^,\n]*)/;
165
$testee_version = "$1\n";
167
$string = `sh -c "$make_path -f /dev/null 2>&1"`;
168
if ($string =~ /(.*): \*\*\* No targets\. Stop\./) {
172
if ($make_path =~ /$pathsep([^\n$pathsep]*)$/) {
176
$make_name = $make_path;
180
# prepend pwd if this is a relative path (ie, does not
181
# start with a slash, but contains one). Thanks for the
184
if (index ($make_path, ":") != 1 && index ($make_path, "/") > 0)
186
$mkpath = "$pwd$pathsep$make_path";
190
$mkpath = $make_path;
193
# Get Purify log info--if any.
195
$ENV{PURIFYOPTIONS} =~ /.*-logfile=([^ ]+)/;
196
$pure_log = $1 || '';
197
$pure_log =~ s/%v/$make_name/;
200
$string = `sh -c "$make_path -j 2 -f /dev/null 2>&1"`;
201
if ($string =~ /not supported/) {
211
$makefile = &get_tmpfile;
216
# Get rid of any Purify logs.
218
($pure_testname = $testname) =~ tr,/,_,;
219
$pure_testname = "$pure_log.$pure_testname";
220
system("rm -f $pure_testname*");
221
print("Purify testfiles are: $pure_testname*\n") if $debug;