2006-04-20 06:16:42 -05:00
|
|
|
#!/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
|
2006-06-29 05:28:29 -05:00
|
|
|
+@printf t1
|
2006-04-20 06:16:42 -05:00
|
|
|
+@echo 1 > \$@
|
|
|
|
|
|
|
|
testfile2 :
|
|
|
|
+@echo making \$@ 1>&2
|
|
|
|
+@sleep 2
|
2006-06-29 05:28:29 -05:00
|
|
|
+@printf t2
|
2006-04-20 06:16:42 -05:00
|
|
|
+@echo 2 > \$@
|
|
|
|
|
|
|
|
testfile3 :
|
|
|
|
+@echo making \$@ 1>&2
|
|
|
|
+@sleep 3
|
2006-06-29 05:28:29 -05:00
|
|
|
+@printf t3
|
2006-04-20 06:16:42 -05:00
|
|
|
+@echo 3 > \$@
|
|
|
|
|
|
|
|
EOT
|
|
|
|
|
2006-06-29 05:28:29 -05:00
|
|
|
output=`eval ${DMAKEPROG} -r -P3 -f $file1`
|
2006-04-20 06:16:42 -05:00
|
|
|
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
|