Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / dmake / tests / macros-4
blob89134d2fa9c3aefc4826e309374da8f58333665c
1 #!/bin/sh
3 # 15.08.2006 Volker Quetschke
4 # Check that single letter macros with (, {, ), } and : are rejected.
5 # (issue 44961).
7 : ${DMAKEPROG:=dmake}
8 file1="mfile1.mk"
9 file2="mfile2.mk"
10 file3="mfile3.mk"
11 file4="mfile4.mk"
12 tmpfiles="$file1 $file2 $file3 $file4"
14 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
16 # Remove files from prior failed run
17 rm -rf $tmpfiles
19 # Remember to quote variables in generated makefiles( $ -> \$ ).
20 # Testcase 1 - Warn about miising closing braket.
21 cat > $file1 <<EOT
22 SHELL*:=/bin/sh
23 SHELLFLAGS*:=-ce
25 all :
26 +@echo "X\$(subst Y"
27 EOT
29 # Testcase 2 - warn about $)
30 cat > $file2 <<EOT
31 SHELL*:=/bin/sh
32 SHELLFLAGS*:=-ce
34 all :
35 +@echo "X\$)Y"
36 EOT
38 # Testcase 3 - warn about $:
39 cat > $file3 <<EOT
40 SHELL*:=/bin/sh
41 SHELLFLAGS*:=-ce
43 all :
44 +@echo "X\$:Y"
45 EOT
47 # Testcase 4 - don't warn
48 cat > $file4 <<EOT
49 SHELL*:=/bin/sh
50 SHELLFLAGS*:=-ce
52 all :
53 +@printf "X\$BLA)Y"
54 +@echo "X\$XX:Y"
55 EOT
57 output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 `
58 result1=$?
59 output2=`eval ${DMAKEPROG} -r -f $file2 2>&1 `
60 result2=$?
61 output3=`eval ${DMAKEPROG} -r -f $file3 2>&1 `
62 result3=$?
63 output4=`eval ${DMAKEPROG} -r -f $file4 2>&1 `
64 result4=$?
66 if echo $output1 | grep -v 'Error: -- Syntax error'; then
67 echo "Test 1: Missing error: $output1"
68 result1=0
70 if echo $output2 | grep -v 'Error: -- Syntax error' ; then
71 echo "Test 2: Missing error: $output2"
72 result2=0
74 if echo $output3 | grep -v 'Error: -- Syntax error'; then
75 echo "Test 3: Missing error: $output3"
76 result3=0
78 if test "$output4" != "XLA)YXX:Y"; then
79 echo "Test 2: Wrong result: $output4"
80 result4=1
83 if test $result1 -ne 0 -a $result2 -ne 0 -a $result3 -ne 0 -a $result4 -eq 0; then
84 echo "Success - Cleaning up"
85 rm -rf $tmpfiles
86 exit
87 result=0
88 else
89 echo "Failure!"
90 result=1
92 exit $result