Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / dmake / tests / function_macros-8
blob911b1cff306a8c80f54fb445ca8761ed9ff5c1b1
1 #!/bin/sh
3 # 24.07.2007 Volker Quetschke
4 # Test the $(normpath ..) function macro.
5 # (issue 78776)
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 normpath works.
18 cat > $file1 <<EOT
19 SHELL*:=/bin/sh
20 SHELLFLAGS*:=-ce
22 .WINPATH:=
24 all :
25 @echo 1\$(normpath /tmp/./a "/tmp/a b/xxx/../b" /tmp)1
26 EOT
28 output1=`eval ${DMAKEPROG} -r -f $file1`
29 result1=$?
30 if test "$output1" != "1/tmp/a \"/tmp/a b/b\" /tmp1"; then
31 echo "Subtest 1: Wrong result: $output1"
32 result1=1
33 else
34 echo "Subtest 1: OK"
35 fi
37 # Test 2 - Test if normpath honors .WINPATH setting
38 cat > $file1 <<EOT
39 SHELL*:=/bin/sh
40 SHELLFLAGS*:=-ce
42 all .WINPATH :
43 @echo 2\$(normpath /tmp)2
45 EOT
47 output2=`eval ${DMAKEPROG} -r -f $file1`
48 result2=$?
49 if test x`uname -o 2> /dev/null` = "xCygwin"; then
50 if test "$output2" != "2`cygpath -m /tmp`2"; then
51 echo "Subtest 2: Wrong result: $output2"
52 result2=1
53 else
54 echo "Subtest 2: OK"
56 else
57 if test "$output2" != "2/tmp2"; then
58 echo "Subtest 2: Wrong result: $output2"
59 result2=1
60 else
61 echo "Subtest 2: OK"
65 # Test 3 - Test if the optional parameter works
66 cat > $file1 <<EOT
67 SHELL*:=/bin/sh
68 SHELLFLAGS*:=-ce
70 all :
71 @echo 3\$(normpath,"" /tmp)3\$(normpath,"abc" /tmp)3
73 EOT
75 output3=`eval ${DMAKEPROG} -r -f $file1`
76 result3=$?
77 if test x`uname -o 2> /dev/null` = "xCygwin"; then
78 if test "$output3" != "3/tmp3`cygpath -m /tmp`3"; then
79 echo "Subtest 3: Wrong result: $output3"
80 result3=1
81 else
82 echo "Subtest 3: OK"
84 else
85 if test "$output3" != "3/tmp3/tmp3"; then
86 echo "Subtest 3: Wrong result: $output3"
87 result3=1
88 else
89 echo "Subtest 3: OK"
94 if test $result1 -eq 0 -a $result2 -eq 0 \
95 -a $result3 -eq 0 ; then
96 echo "Success - Cleaning up" && rm -f ${tmpfiles}
97 exit
98 else
99 echo "Failure!"
100 exit 1