Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dmake / tests / macros-10
blobb2e7d373713f7a35ccec3b1b31f83ea67bbadeea
1 #!/bin/sh
3 # 08.08.2007 Volker Quetschke
4 # Test macro assignment syntax check.
5 # (issue 69510)
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
18 cat > $file1 <<EOT
19 SHELL*:=/bin/sh
20 SHELLFLAGS*:=-ce
22 AAA:=BBB
23 \$(AAA) := 123
25 X) := YYY
27 all :
28 @echo :\$(BBB):\${X)}:
29 EOT
31 output1=`eval ${DMAKEPROG} -r -f $file1`
32 result1=$?
33 if test "$output1" != ":123:YYY:"; then
34 echo "Subtest 1: Wrong result: $output1"
35 result1=1
36 else
37 echo "Subtest 1: OK"
38 fi
40 # Test 2
41 cat > $file1 <<EOT
42 SHELL*:=/bin/sh
43 SHELLFLAGS*:=-ce
45 { := fail
47 all :
48 @echo Should fail
50 EOT
52 output2=`eval ${DMAKEPROG} -r -f $file1 2>&1`
53 result2=$?
55 if test $result2 != 0 && echo $output2 | grep 'Error: -- Syntax error in macro assignment' > /dev/null 2>&1 ; then
56 echo "Subtest 2: OK"
57 result2=0
58 else
59 echo "Subtest 2: Wrong result: $output2"
60 echo
61 result2=1
65 # Test 3
66 cat > $file1 <<EOT
67 SHELL*:=/bin/sh
68 SHELLFLAGS*:=-ce
70 X := :
72 AA\$XBB = 098
74 all :
75 @echo Should fail
77 EOT
79 output3=`eval ${DMAKEPROG} -r -f $file1 2>&1`
80 result3=$?
81 if test $result3 != 0 && echo $output3 | grep 'Error: -- Syntax error in macro assignment' > /dev/null 2>&1 ; then
82 echo "Subtest 3: OK"
83 result3=0
84 else
85 echo "Subtest 3: Wrong result: $output3"
86 echo
87 result3=1
92 if test $result1 -eq 0 -a $result2 -eq 0 \
93 -a $result3 -eq 0 ; then
94 echo "Success - Cleaning up" && rm -f ${tmpfiles}
95 exit
96 else
97 echo "Failure!"
98 exit 1