Home | History | Annotate | Download | only in options
      1 #                                                                    -*-perl-*-
      2 # Date: Tue, 11 Aug 1992 09:34:26 -0400
      3 # From: pds (a] lemming.webo.dg.com (Paul D. Smith)
      4 
      5 $description = "Test load balancing (-l) option.";
      6 
      7 $details = "\
      8 This test creates a makefile where all depends on three rules
      9 which contain the same body.  Each rule checks for the existence
     10 of a temporary file; if it exists an error is generated.  If it
     11 doesn't exist then it is created, the rule sleeps, then deletes
     12 the temp file again.  Thus if any of the rules are run in
     13 parallel the test will fail.  When make is called in this test,
     14 it is given the -l option with a value of 0.0001.  This ensures
     15 that the load will be above this number and make will therefore
     16 decide that it cannot run more than one job even though -j 4 was
     17 also specified on the command line.";
     18 
     19 open(MAKEFILE,"> $makefile");
     20 
     21 # The Contents of the MAKEFILE ...
     22 
     23 print MAKEFILE <<'EOF';
     24 SHELL = /bin/sh
     25 
     26 define test
     27 if [ ! -f test-file ]; then \
     28   echo >> test-file; sleep 2; rm -f test-file; \
     29 else \
     30   echo $@ FAILED; \
     31 fi
     32 endef
     33 
     34 all : ONE TWO THREE
     35 ONE : ; @$(test)
     36 TWO : ; @$(test)
     37 THREE : ; @$(test)
     38 EOF
     39 
     40 
     41 # END of Contents of MAKEFILE
     42 
     43 close(MAKEFILE);
     44 
     45 $mkoptions = "-l 0.0001";
     46 $mkoptions .= " -j 4" if ($parallel_jobs);
     47 
     48 &run_make_with_options($makefile, $mkoptions, &get_logfile);
     49 
     50 $slurp = &read_file_into_string (&get_logfile(1));
     51 if ($slurp !~ /cannot enforce load limit/) {
     52   &compare_output("", &get_logfile(1));
     53 }
     54 
     55 1;
     56