Blame tests/scripts/options/dash-l

Packit 26a39e
#                                                                    -*-perl-*-
Packit 26a39e
# Date: Tue, 11 Aug 1992 09:34:26 -0400
Packit 26a39e
# From: pds@lemming.webo.dg.com (Paul D. Smith)
Packit 26a39e
Packit 26a39e
$description = "Test load balancing (-l) option.";
Packit 26a39e
Packit 26a39e
$details = "\
Packit 26a39e
This test creates a makefile where all depends on three rules
Packit 26a39e
which contain the same body.  Each rule checks for the existence
Packit 26a39e
of a temporary file; if it exists an error is generated.  If it
Packit 26a39e
doesn't exist then it is created, the rule sleeps, then deletes
Packit 26a39e
the temp file again.  Thus if any of the rules are run in
Packit 26a39e
parallel the test will fail.  When make is called in this test,
Packit 26a39e
it is given the -l option with a value of 0.0001.  This ensures
Packit 26a39e
that the load will be above this number and make will therefore
Packit 26a39e
decide that it cannot run more than one job even though -j 4 was
Packit 26a39e
also specified on the command line.";
Packit 26a39e
Packit 26a39e
open(MAKEFILE,"> $makefile");
Packit 26a39e
Packit 26a39e
# The Contents of the MAKEFILE ...
Packit 26a39e
Packit 26a39e
print MAKEFILE <<'EOF';
Packit 26a39e
SHELL = /bin/sh
Packit 26a39e
Packit 26a39e
define test
Packit 26a39e
if [ ! -f test-file ]; then \
Packit 26a39e
  echo >> test-file; sleep 2; rm -f test-file; \
Packit 26a39e
else \
Packit 26a39e
  echo $@ FAILED; \
Packit 26a39e
fi
Packit 26a39e
endef
Packit 26a39e
Packit 26a39e
all : ONE TWO THREE
Packit 26a39e
ONE : ; @$(test)
Packit 26a39e
TWO : ; @$(test)
Packit 26a39e
THREE : ; @$(test)
Packit 26a39e
EOF
Packit 26a39e
Packit 26a39e
Packit 26a39e
# END of Contents of MAKEFILE
Packit 26a39e
Packit 26a39e
close(MAKEFILE);
Packit 26a39e
Packit 26a39e
$mkoptions = "-l 0.0001";
Packit 26a39e
$mkoptions .= " -j 4" if ($parallel_jobs);
Packit 26a39e
Packit 26a39e
# We have to wait longer than the default (5s).
Packit 26a39e
&run_make_with_options($makefile, $mkoptions, &get_logfile, 0, 8);
Packit 26a39e
Packit 26a39e
$slurp = &read_file_into_string (&get_logfile(1));
Packit 26a39e
if ($slurp !~ /cannot enforce load limit/) {
Packit 26a39e
  &compare_output("", &get_logfile(1));
Packit 26a39e
}
Packit 26a39e
Packit 26a39e
1;