Update ooo320-m1
[ooovba.git] / dmake / tests / macros-8
blob705a92878ad08866c50c834b554f3dea0dfb411c
1 #!/bin/sh
3 # 24.07.2007 Volker Quetschke
4 # Test the :b :d :e :f macro extensions.
5 # (issue 80009)
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 - Test if :f works.
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 f:\$(MACRO:f):
28 EOT
30 output1=`eval ${DMAKEPROG} -r -f $file1`
31 result1=$?
32 if test "$output1" != "f:yyy.ext \"xxx.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 MACRO:=/tmp/yyy.ext "/tmp/a b/xxx.ext"
46 all :
47 @echo d:\$(MACRO:d):
49 EOT
51 output2=`eval ${DMAKEPROG} -r -f $file1`
52 result2=$?
53 if test "$output2" != "d:/tmp/ \"/tmp/a b/\":"; 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 e:\$(MACRO:e):
71 EOT
73 output3=`eval ${DMAKEPROG} -r -f $file1`
74 result3=$?
75 if test "$output3" != "e:.ext \".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 all :
91 @echo b:\$(MACRO:b):
93 EOT
95 output4=`eval ${DMAKEPROG} -r -f $file1`
96 result4=$?
97 if test "$output4" != "b:yyy \"xxx\":"; then
98 echo "Subtest 4: Wrong result: $output4"
99 result4=1
100 else
101 echo "Subtest 4: OK"
105 # Test 5
106 cat > $file1 <<EOT
107 SHELL*:=/bin/sh
108 SHELLFLAGS*:=-ce
110 MACRO:=/tmp/yyy.ext "/tmp/a b/xxx.ext"
112 all :
113 @echo de:\$(MACRO:de):
117 output5=`eval ${DMAKEPROG} -r -f $file1`
118 result5=$?
119 if test "$output5" != "de:/tmp/.ext \"/tmp/a b/.ext\":"; then
120 echo "Subtest 5: Wrong result: $output5"
121 result5=1
122 else
123 echo "Subtest 5: OK"
127 # Test 6
128 cat > $file1 <<EOT
129 SHELL*:=/bin/sh
130 SHELLFLAGS*:=-ce
132 MACROd:=/tmp/yyy "/tmp/a b/xxx"
134 all :
135 @echo e:\$(MACROd:e):
139 output6=`eval ${DMAKEPROG} -r -f $file1`
140 result6=$?
141 if test "$output6" != "e::"; then
142 echo "Subtest 6: Wrong result: $output6"
143 result6=1
144 else
145 echo "Subtest 6: OK"
149 if test $result1 -eq 0 -a $result2 -eq 0 \
150 -a $result3 -eq 0 -a $result4 -eq 0 \
151 -a $result5 -eq 0 -a $result6 -eq 0 ; then
152 echo "Success - Cleaning up" && rm -f ${tmpfiles}
153 exit
154 else
155 echo "Failure!"
156 exit 1