update dev300-m58
[ooovba.git] / dmake / tests / misc-4
blobed11a8e20098daca4fd2f04b0de96abc3b76d0c3
1 #!/bin/sh
3 # 06.10.2005 Volker Quetschke
4 # Test for parallel operation.
5 # (no issue, sanity check only)
7 : ${DMAKEPROG:=dmake}
8 file1="mymakefile.mk"
9 file2="testfile"
10 file3="testfile1"
11 file4="testfile2"
12 file5="testfile3"
13 tmpfiles="$file1 $file2 $file3 $file4 $file5"
15 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
17 # Remove files from prior failed run
18 rm -rf $tmpfiles
20 # Remember to quote variables in generated makefiles( $ -> \$ ).
21 cat > $file1 <<EOT
22 # Testing parallel execution
23 SHELL*:=/bin/sh
24 SHELLFLAGS*:=-ce
26 testfile : testfile2 testfile3 testfile1
27 +@echo xx > \$@
29 testfile1 :
30 +@echo making \$@ 1>&2
31 +@sleep 1
32 +@printf t1
33 +@echo 1 > \$@
35 testfile2 :
36 +@echo making \$@ 1>&2
37 +@sleep 2
38 +@printf t2
39 +@echo 2 > \$@
41 testfile3 :
42 +@echo making \$@ 1>&2
43 +@sleep 3
44 +@printf t3
45 +@echo 3 > \$@
47 EOT
49 output=`eval ${DMAKEPROG} -r -P3 -f $file1`
50 result=$?
52 # In parallel operation the targets with the smaller sleep value
53 # will finish first.
54 if test "$output" != "t1t2t3"; then
55 echo "Wrong result"
56 result=1
60 test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles}
61 test $result -ne 0 && echo "Failure!"
62 exit $result