Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dmake / tests / macros-9
blobedfaf343fccf4196312b1cf71a8895ad9802c977
1 #!/bin/sh
3 # 27.07.2007 Volker Quetschke
4 # Test the :i :1 macro extensions.
5 # (issue 80010)
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 .WINPATH:=
24 MACRO:="/tmp/yyy.ext" "/tmp/a b/xxx.ext"
26 all :
27 @echo 1:\$(MACRO:1):
28 EOT
30 output1=`eval ${DMAKEPROG} -r -f $file1`
31 result1=$?
32 if test "$output1" != "1:\"/tmp/yyy.ext\":"; then
33 echo "Subtest 1: Wrong result: $output1"
34 result1=1
35 else
36 echo "Subtest 1: OK"
37 fi
39 # Test 2
40 cat > $file1 <<EOT
41 SHELL*:=/bin/sh
42 SHELLFLAGS*:=-ce
44 MACRO2:=/tmp/zzz.ext /tmp/aaa
46 all :
47 @echo 1:\$(MACRO2:1):
49 EOT
51 output2=`eval ${DMAKEPROG} -r -f $file1`
52 result2=$?
53 if test "$output2" != "1:/tmp/zzz.ext:"; then
54 echo "Subtest 2: Wrong result: $output2"
55 result2=1
56 else
57 echo "Subtest 2: OK"
58 fi
61 # Test 3
62 cat > $file1 <<EOT
63 SHELL*:=/bin/sh
64 SHELLFLAGS*:=-ce
66 MACRO:="/tmp/yyy.ext" "/tmp/a b/xxx.ext"
68 all :
69 @echo i:\$(MACRO:i):
71 EOT
73 output3=`eval ${DMAKEPROG} -r -f $file1`
74 result3=$?
75 if test "$output3" != "i:\"/tmp/yyy.ext\" \"/tmp/a b/xxx.ext\":"; then
76 echo "Subtest 3: Wrong result: $output3"
77 result3=1
78 else
79 echo "Subtest 3: OK"
80 fi
83 # Test 4
84 cat > $file1 <<EOT
85 SHELL*:=/bin/sh
86 SHELLFLAGS*:=-ce
88 MACRO:="/tmp/yyy.ext" "/tmp/a b/xxx.ext"
90 .WINPATH=
92 all :
93 @echo 1n:\$(MACRO:1n):
95 EOT
97 output4=`eval ${DMAKEPROG} -r -f $file1`
98 result4=$?
99 if test "$output4" != "1n:\"/tmp/yyy.ext\":"; then
100 echo "Subtest 4: Wrong result: $output4"
101 result4=1
102 else
103 echo "Subtest 4: OK"
107 # Test 5
108 cat > $file1 <<EOT
109 SHELL*:=/bin/sh
110 SHELLFLAGS*:=-ce
112 MACROi:="./expand.c"
114 .WINPATH=
116 .SOURCE : ..
118 all : expand.c
119 @echo i:\$(MACROi:i):
123 output5=`eval ${DMAKEPROG} -r -f $file1`
124 result5=$?
125 if test "$output5" != "i:\"../expand.c\":"; then
126 echo "Subtest 5: Wrong result: $output5"
127 result5=1
128 else
129 echo "Subtest 5: OK"
133 if test $result1 -eq 0 -a $result2 -eq 0 \
134 -a $result3 -eq 0 -a $result4 -eq 0 \
135 -a $result5 -eq 0 ; then
136 echo "Success - Cleaning up" && rm -f ${tmpfiles}
137 exit
138 else
139 echo "Failure!"
140 exit 1