xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/options/dash-l (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos#                                                                    -*-perl-*-
2*69606e3fSchristos# Date: Tue, 11 Aug 1992 09:34:26 -0400
3*69606e3fSchristos# From: pds@lemming.webo.dg.com (Paul D. Smith)
4*69606e3fSchristos
5*69606e3fSchristos$description = "Test load balancing (-l) option.";
6*69606e3fSchristos
7*69606e3fSchristos$details = "\
8*69606e3fSchristosThis test creates a makefile where all depends on three rules
9*69606e3fSchristoswhich contain the same body.  Each rule checks for the existence
10*69606e3fSchristosof a temporary file; if it exists an error is generated.  If it
11*69606e3fSchristosdoesn't exist then it is created, the rule sleeps, then deletes
12*69606e3fSchristosthe temp file again.  Thus if any of the rules are run in
13*69606e3fSchristosparallel the test will fail.  When make is called in this test,
14*69606e3fSchristosit is given the -l option with a value of 0.0001.  This ensures
15*69606e3fSchristosthat the load will be above this number and make will therefore
16*69606e3fSchristosdecide that it cannot run more than one job even though -j 4 was
17*69606e3fSchristosalso specified on the command line.";
18*69606e3fSchristos
19*69606e3fSchristosopen(MAKEFILE,"> $makefile");
20*69606e3fSchristos
21*69606e3fSchristos# The Contents of the MAKEFILE ...
22*69606e3fSchristos
23*69606e3fSchristosprint MAKEFILE <<'EOF';
24*69606e3fSchristosSHELL = /bin/sh
25*69606e3fSchristos
26*69606e3fSchristosdefine test
27*69606e3fSchristosif [ ! -f test-file ]; then \
28*69606e3fSchristos  echo >> test-file; sleep 2; rm -f test-file; \
29*69606e3fSchristoselse \
30*69606e3fSchristos  echo $@ FAILED; \
31*69606e3fSchristosfi
32*69606e3fSchristosendef
33*69606e3fSchristos
34*69606e3fSchristosall : ONE TWO THREE
35*69606e3fSchristosONE : ; @$(test)
36*69606e3fSchristosTWO : ; @$(test)
37*69606e3fSchristosTHREE : ; @$(test)
38*69606e3fSchristosEOF
39*69606e3fSchristos
40*69606e3fSchristos
41*69606e3fSchristos# END of Contents of MAKEFILE
42*69606e3fSchristos
43*69606e3fSchristosclose(MAKEFILE);
44*69606e3fSchristos
45*69606e3fSchristos$mkoptions = "-l 0.0001";
46*69606e3fSchristos$mkoptions .= " -j 4" if ($parallel_jobs);
47*69606e3fSchristos
48*69606e3fSchristos&run_make_with_options($makefile, $mkoptions, &get_logfile);
49*69606e3fSchristos
50*69606e3fSchristos$slurp = &read_file_into_string (&get_logfile(1));
51*69606e3fSchristosif ($slurp !~ /cannot enforce load limit/) {
52*69606e3fSchristos  &compare_output("", &get_logfile(1));
53*69606e3fSchristos}
54*69606e3fSchristos
55*69606e3fSchristos1;
56