Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / dmake / tests / function_macros-5
blob1be199068c7b5fff215cba1d7102325f7dec428a
1 #!/bin/sh
3 # 03.14.2006 Volker Quetschke
4 # Verifies that $(shell ..) does not pick up stdout output from
5 # concurrent processes. (Stronger test for the spawn case.)
6 # (issue 61856 / issue 61940)
8 : ${DMAKEPROG:=dmake}
9 file1="makefile.mk"
10 file2="stdout.txt"
11 tmpfiles="$file1 $file2"
13 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
15 trap 'rm -rf $tmpfiles' 1 2 3 15
17 # Remember to quote variables in generated makefiles( $ -> \$ ).
18 cat > $file1 <<EOT
19 # Testing continuation char in recipes
20 SHELL*:=/bin/sh
21 SHELLFLAGS*:=-ce
23 all : all1 all2
24 @+echo "Y\$(DYNMAC)Y" > $file2
26 all1 :
27 @+echo "Before the sleeps ..."
28 @+echo A; sleep 1; echo B; sleep 1; echo C; sleep 1; echo D; sleep 1; echo E
29 @+echo "After the sleeps ..."
31 all2 :
32 @+sleep 1;
33 @+echo "X\$(assign DYNMAC:=\$(shell @+echo "(shellpre)";sleep 2; echo "(shellpost)"))X"
34 @+echo "Z\$(DYNMAC)Z"
35 EOT
37 ${DMAKEPROG} -P3 -r -f $file1
38 result=$?
39 if test "`cat $file2`" != "Y(shellpre) (shellpost)Y"; then
40 echo "Wrong result: `cat $file2`, Y(shellpre) (shellpost)Y expected!"
41 result=1
44 test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles}
45 test $result -ne 0 && echo "Failure!"
46 exit $result