update dev300-m58
[ooovba.git] / dmake / tests / recipes-9
blob409b6cbabe330cc587c399663428338c0e5f47c4
1 #!/bin/sh
3 # 11.08.2007 Volker Quetschke
4 # Test that recipes with error can be ignored.
5 # (issue 80598)
7 : ${DMAKEPROG:=dmake}
8 file1="mfile1.mk"
9 tmpfiles="$file1"
11 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
13 # Remove files from prior failed run
14 rm -rf $tmpfiles
16 # Remember to quote variables in generated makefiles( $ -> \$ ).
17 # Test 1 - Ignore, but display failed execution.
18 cat > $file1 <<EOT
19 SHELL*:=/bin/sh
20 SHELLFLAGS*:=-ce
22 all .IGNORE :
23 tttouch all
25 EOT
27 output1=`eval ${DMAKEPROG} -r -f $file1 2>&1`
28 result1=$?
30 if test "$result1" = "0" && echo $output1 | grep '(Ignored)' > /dev/null 2>&1 ; then
31 echo "Subtest 1: OK"
32 result1=0
33 else
34 echo "Subtest 1: Wrong result: $output1"
35 echo
36 result1=1
40 # Test 2 - Ignore, but display failed execution.
41 cat > $file1 <<EOT
42 SHELL*:=/bin/sh
43 SHELLFLAGS*:=-ce
45 all :
46 -ttttouch all
48 EOT
50 output2=`eval ${DMAKEPROG} -r -f $file1 2>&1`
51 result2=$?
53 if test "$result2" = "0" && echo $output2 | grep '(Ignored)' > /dev/null 2>&1 ; then
54 echo "Subtest 2: OK"
55 result2=0
56 else
57 echo "Subtest 2: Wrong result: $output2"
58 echo
59 result2=1
63 # Test 3
64 cat > $file1 <<EOT
65 SHELL*:=/bin/sh
66 SHELLFLAGS*:=-ce
67 GROUPSHELL*:=/bin/sh
69 all :
70 ttttouch all
72 EOT
74 output3=`eval ${DMAKEPROG} -r -f $file1 2>&1`
75 result3=$?
76 if test $result3 != 0 && echo $output3 | grep 'Error code -1, while making ' > /dev/null 2>&1 ; then
77 echo "Subtest 3: OK"
78 result3=0
79 else
80 echo "Subtest 3: Wrong result: $output3"
81 echo
82 result3=1
86 # Test 4 - Ignore a succesfully executed, but failing recipe.
87 cat > $file1 <<EOT
88 SHELL*:=/bin/sh
89 SHELLFLAGS*:=-ce
91 all :
92 -false all
94 EOT
96 output4=`eval ${DMAKEPROG} -r -f $file1 2>&1`
97 result4=$?
99 if test "$result4" = "0" -a "$output4" = "false all" ; then
100 echo "Subtest 4: OK"
101 result4=0
102 else
103 echo "Subtest 4: Wrong result: $output4"
104 echo
105 result4=1
110 if test $result1 -eq 0 -a $result2 -eq 0 \
111 -a $result3 -eq 0 -a $result4 -eq 0 ; then
112 echo "Success - Cleaning up" && rm -f ${tmpfiles}
113 exit
114 else
115 echo "Failure!"
116 exit 1