update dev300-m58
[ooovba.git] / dmake / tests / targets-2
blobfbc1b0e39c7c9e7f0570b3e8ee2ee5b7accaf91e
1 #!/bin/sh
3 # 03.06.2006 Volker Quetschke
4 # Percent target definitions were not handled properly before.
5 # (issue 64869) - Two more testcases
7 : ${DMAKEPROG:=dmake}
8 file1="mfile1.mk"
9 file2="mfile2.mk"
10 tmpfiles="$file1 $file2"
12 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
14 # Remove files from prior failed run
15 rm -rf $tmpfiles
17 # Remember to quote variables in generated makefiles( $ -> \$ ).
18 # Testcase 1 - %-target prerequisite - syntax error
19 cat > $file1 <<EOT
20 SHELL*:=/bin/sh
21 SHELLFLAGS*:=-ce
23 .PHONY all : %.c
24 +true all
26 EOT
28 # Testcase 2 - The recipe part is ignored - syntax error
29 cat > $file2 <<EOT
30 SHELL*:=/bin/sh
31 SHELLFLAGS*:=-ce
33 all :
34 +true all
36 .PHONY : all ; +echo no recipe expected
38 EOT
40 output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 `
41 result1=$?
42 output2=`eval ${DMAKEPROG} -r -f $file2 2>&1 `
43 result2=$?
45 if echo $output1 | grep 'Error: -- Syntax' > /dev/null 2>&1 ; then
46 result1=0
47 else
48 echo "Test 1: Wrong result: $output1"
49 echo
50 result1=1
53 if echo $output2 | grep 'Error: -- Unexpected recipe' > /dev/null 2>&1 ; then
54 result2=0
55 else
56 echo "Test 2: Wrong result: $output2"
57 echo
58 result1=1
61 if test $result1 -eq 0 -a $result2 -eq 0; then
62 echo "Success - Cleaning up"
63 rm -rf $tmpfiles
64 exit
65 result=0
66 else
67 echo "Failure!"
68 result=1
70 exit $result