1999-09-14 02:03:19 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
# Date: Tue, 11 Aug 1992 09:34:26 -0400
|
|
|
|
# From: pds@lemming.webo.dg.com (Paul D. Smith)
|
|
|
|
|
|
|
|
$description = "Test load balancing (-l) option.";
|
|
|
|
|
|
|
|
$details = "\
|
|
|
|
This test creates a makefile where all depends on three rules
|
|
|
|
which contain the same body. Each rule checks for the existence
|
|
|
|
of a temporary file; if it exists an error is generated. If it
|
|
|
|
doesn't exist then it is created, the rule sleeps, then deletes
|
|
|
|
the temp file again. Thus if any of the rules are run in
|
|
|
|
parallel the test will fail. When make is called in this test,
|
|
|
|
it is given the -l option with a value of 0.0001. This ensures
|
|
|
|
that the load will be above this number and make will therefore
|
|
|
|
decide that it cannot run more than one job even though -j 4 was
|
|
|
|
also specified on the command line.";
|
|
|
|
|
2017-04-17 19:37:57 +00:00
|
|
|
# On Windows a very different algorithm is used.
|
|
|
|
$port_type eq 'W32' and return -1;
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2017-04-17 19:37:57 +00:00
|
|
|
open(MAKEFILE,"> $makefile");
|
|
|
|
printf MAKEFILE q,
|
1999-09-14 02:03:19 +00:00
|
|
|
define test
|
2017-04-17 19:37:57 +00:00
|
|
|
if [ ! -f test-file ]; then \
|
|
|
|
echo >> test-file; sleep 2; %s test-file; \
|
|
|
|
else \
|
|
|
|
echo $@ FAILED; \
|
1999-09-14 02:03:19 +00:00
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
|
|
|
all : ONE TWO THREE
|
2017-04-17 19:37:57 +00:00
|
|
|
ONE : ; @$(test)
|
|
|
|
TWO : ; @$(test)
|
|
|
|
THREE : ; @$(test)
|
|
|
|
,, $CMD_rmfile;
|
1999-09-14 02:03:19 +00:00
|
|
|
close(MAKEFILE);
|
|
|
|
|
|
|
|
$mkoptions = "-l 0.0001";
|
|
|
|
$mkoptions .= " -j 4" if ($parallel_jobs);
|
|
|
|
|
2007-07-14 02:57:46 +00:00
|
|
|
# We have to wait longer than the default (5s).
|
|
|
|
&run_make_with_options($makefile, $mkoptions, &get_logfile, 0, 8);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
$slurp = &read_file_into_string (&get_logfile(1));
|
|
|
|
if ($slurp !~ /cannot enforce load limit/) {
|
|
|
|
&compare_output("", &get_logfile(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|