update dev300-m58
[ooovba.git] / dmake / tests / misc-18
bloba676df6580e2b2101c33ffb90743776ff1404b29
1 #!/bin/sh
3 # 23.03.2007 Volker Quetschke
4 # Test .WINPATH attribute (A cygwin only attribute that is ignored
5 # elsewhere).
6 # (issue 73499)
8 : ${DMAKEPROG:=dmake}
9 file1="mfile1.mk"
10 tmpfiles="$file1"
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 # Test 1 - Test if .WINPATH is accepted as global attribute
19 cat > $file1 <<EOT
20 SHELL*:=/bin/sh
21 SHELLFLAGS*:=-ce
23 .WINPATH :
25 all :
26 @echo OK1
28 EOT
30 output1=`eval ${DMAKEPROG} -r -f $file1`
31 result1=$?
32 if test "$output1" != "OK1"; then
33 echo "Subtest 1: Wrong result: $output1"
34 result1=1
35 else
36 echo "Subtest 1: OK"
37 fi
39 # Test 2 - Test if .WINPATH is accepted as local attribute
40 cat > $file1 <<EOT
41 SHELL*:=/bin/sh
42 SHELLFLAGS*:=-ce
44 all .WINPATH :
45 @echo OK2
47 EOT
49 output2=`eval ${DMAKEPROG} -r -f $file1`
50 result2=$?
51 if test "$output2" != "OK2"; then
52 echo "Subtest 2: Wrong result: $output2"
53 result2=1
54 else
55 echo "Subtest 2: OK"
56 fi
59 # Test 3 - Test if $@ and $* are DOSified.
60 cat > $file1 <<EOT
61 SHELL*:=/bin/sh
62 SHELLFLAGS*:=-ce
64 /tmp/blah.xx .WINPATH :
65 @echo at:\$@:star:\$*:
67 EOT
69 if test x`uname -o 2> /dev/null` = "xCygwin"; then
70 output3=`eval ${DMAKEPROG} -r -f $file1`
71 result3=$?
72 if test "$output3" != "at:`cygpath -m /tmp/blah.xx`:star:`cygpath -m /tmp/blah`:"; then
73 echo "Subtest : Wrong result: $output3"
74 result3=1
75 else
76 echo "Subtest 3: OK"
78 else
79 echo "Subtest 3 ignored for non cygwin environment"
80 result3=0
81 fi
84 # Test 4 - Test if $(PWD), $(MAKEDIR) are DOSified.
85 cat > $file1 <<EOT
86 SHELL*:=/bin/sh
87 SHELLFLAGS*:=-ce
89 all .WINPATH .SETDIR=/tmp :
90 @echo :\$(PWD):\$(MAKEDIR):
92 EOT
94 if test x`uname -o 2> /dev/null` = "xCygwin"; then
95 output4=`eval ${DMAKEPROG} -r -f $file1`
96 result4=$?
97 mypwd=`pwd`
98 if test "$output4" != ":`cygpath -m /tmp`:`cygpath -m $mypwd`:"; then
99 echo "Subtest : Wrong result: $output4"
100 result4=1
101 else
102 echo "Subtest 4: OK"
104 else
105 echo "Subtest 4 ignored for non cygwin environment"
106 result4=0
110 # Test 5 - Test if $(TMD) is DOSified (if it is an absolute path).
111 cat > $file1 <<EOT
112 SHELL*:=/bin/sh
113 SHELLFLAGS*:=-ce
115 all .WINPATH .SETDIR=/ :
116 @echo :\$(PWD):\$(TMD):
120 if test x`uname -o 2> /dev/null` = "xCygwin"; then
121 output5=`eval ${DMAKEPROG} -r -f $file1`
122 result5=$?
123 mypwd=`pwd`
124 if test "$output5" != ":`cygpath -m /`:`cygpath -m $mypwd`:"; then
125 echo "Subtest : Wrong result: $output5"
126 result5=1
127 else
128 echo "Subtest 5: OK"
130 else
131 echo "Subtest 5 ignored for non cygwin environment"
132 result5=0
136 # Test 6 - Test if .WINPATH changes $@ in conditional macro.
137 cat > $file1 <<EOT
138 SHELL*:=/bin/sh
139 SHELLFLAGS*:=-ce
141 /tmp/all.bla ?= QQQ=\$@
142 /tmp/all.bla .WINPATH :
143 @echo :\$(QQQ):
146 if test x`uname -o 2> /dev/null` = "xCygwin"; then
147 output6=`eval ${DMAKEPROG} -r -f $file1`
148 result6=$?
149 if test "$output6" != ":`cygpath -m /tmp/all.bla`:"; then
150 echo "Subtest : Wrong result: $output6"
151 result6=1
152 else
153 echo "Subtest 6: OK"
155 else
156 echo "Subtest 6 ignored for non cygwin environment"
157 result6=0
161 if test $result1 -eq 0 -a $result2 -eq 0 \
162 -a $result3 -eq 0 -a $result4 -eq 0 \
163 -a $result5 -eq 0 -a $result6 -eq 0; then
164 echo "Success - Cleaning up" && rm -f ${tmpfiles}
165 exit
166 else
167 echo "Failure!"
168 exit 1