File: parallel.test

package info (click to toggle)
makepp 2.0.98.5-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,744 kB
  • sloc: perl: 15,893; makefile: 38; javascript: 25; sh: 1
file content (90 lines) | stat: -rw-r--r-- 2,189 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
###	SPAR <http://www.cpan.org/scripts/>
###	1	755	1067749983	1210350510	is_relevant.pl
is_windows < 1			# ActiveState doesn't separate STDOUTs and stumbles over mpp -j
###	10	755	1067451877	1184533865	makepp_test_script.pl
# This is a test of parallel make.  In order to test that make is actually
# executing jobs in parallel, we rely on timing to synchronize jobs, which
# isn't 100% reliable.
#

# This script is designed to be run with -j 2, so we know that at most 2
# jobs are running.

eval { makepp '-kj2' } and die;
1;
###	55	644	1164352976	1184534747	Makeppfile
perl {
  unlink 'b', 'c';
  sub c_waitfor {
    my $hires = eval { require Time::HiRes };
    while( ! (stat $_[0])[7] ) {
      if( $hires ) {
	Time::HiRes::sleep( .1 );
      } else {
	select undef, undef, undef, .1;
      }
    }
  }
}

$(phony all): a z

a: b c
	&cat $^ -o $@


#
# Commands to execute b and c should run in parallel, but commands to execute
# a should wait for them.  The final contents of b and c will differ depending
# on whether the build commands were executed in parallel or in serial.
# This is because we've lied to makepp about which files are modified.
#
b:
	@&echo building b
	&echo b -o>>b
	&waitfor c
	@&echo b is modifying c
	&echo b -o>>c

c:
	@&echo building c
	&echo c -o>>c
	&waitfor b
	@&echo c is modifying b
	&echo c -o>>b


# Before 07-07-15 two files were enough to make this fail, as long as the 2nd
# dependency succeeded.  The order of execution being somewhat random, lets
# have 6 deps, just to be sure.  Failure meant trying to build z, despite
# failed deps.

y z: $( u v w x y z).out
	&echo Must not get here -o y
	&cat $(inputs) -o z

%.out: %.in
	&cp -l $(input) $(output)

v.out x.out: %.out: %.in
	&expr 0
###	0	644	1184533342	1184533342	u.in
###	0	644	1184533342	1184533342	v.in
###	0	644	1184533342	1184533342	w.in
###	0	644	1184533342	1184533342	x.in
###	0	644	1184533342	1184533342	y.in
###	0	644	1184533342	1184533342	z.in
###	D	755	1067451877	971218421	answers
###	4	644	1067451877	971218395	answers/a
b
c
c
b
###	2	644	1067451877	971218393	answers/b
b
c
###	2	644	1067451877	971218393	answers/c
c
b
###	1	644	1067451877	1190051786	answers/n_files
7 0 2