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
|
#!/bin/sh
# 06.10.2005 Volker Quetschke
# Test for parallel operation.
# (no issue, sanity check only)
: ${DMAKEPROG:=dmake}
file1="mymakefile.mk"
file2="testfile"
file3="testfile1"
file4="testfile2"
file5="testfile3"
tmpfiles="$file1 $file2 $file3 $file4 $file5"
trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
# Remove files from prior failed run
rm -rf $tmpfiles
# Remember to quote variables in generated makefiles( $ -> \$ ).
cat > $file1 <<EOT
# Testing parallel execution
SHELL*:=/bin/sh
SHELLFLAGS*:=-ce
testfile : testfile2 testfile3 testfile1
+@echo xx > \$@
testfile1 :
+@echo making \$@ 1>&2
+@sleep 1
+@printf t1
+@echo 1 > \$@
testfile2 :
+@echo making \$@ 1>&2
+@sleep 2
+@printf t2
+@echo 2 > \$@
testfile3 :
+@echo making \$@ 1>&2
+@sleep 3
+@printf t3
+@echo 3 > \$@
EOT
output=`eval ${DMAKEPROG} -r -P3 -f $file1`
result=$?
# In parallel operation the targets with the smaller sleep value
# will finish first.
if test "$output" != "t1t2t3"; then
echo "Wrong result"
result=1
fi
test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles}
test $result -ne 0 && echo "Failure!"
exit $result
|