merge the formfield patch from ooo-build
[ooovba.git] / dmake / tests / function_macros-9
blobe8d4d3a070a7b168f22402e90919bc52e41516a1
1 #!/bin/sh
3 # 05.08.2007 Volker Quetschke
4 # Test the $(shell,expand ..) function macro.
5 # (issue 50092)
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 it works.
18 cat > $file1 <<EOT
19 # The printf on Solaris seems to need bash.
20 SHELL:=/bin/bash
21 SHELLFLAGS*:=-ce
23 AAA!=123
25 all :
26 noop X\$(shell,expand +@printf "\x24(AAA)")Y\$(shell +@printf \\\\x24\\(AAA\\))Z
27 EOT
29 output1=`eval ${DMAKEPROG} -r -f $file1`
30 result1=$?
31 if test "$output1" != "noop X123Y\$(AAA)Z"; then
32 echo "Subtest 1: Wrong result: $output1"
33 result1=1
34 else
35 echo "Subtest 1: OK"
38 # Test 2 - Test if wrong arguments are catched.
39 cat > $file1 <<EOT
40 # The printf on Solaris seems to need bash.
41 SHELL:=/bin/bash
42 SHELLFLAGS*:=-ce
44 AAA!=123
46 all :
47 noop X\$(shell,XXX +@printf ABC\\\\x24\\(AAA\\))Y
49 EOT
51 output2=`eval ${DMAKEPROG} -rf $file1 2>&1`
52 result2=$?
54 if echo $output2 | grep 'Error: -- Unknown argument \[XXX\] to shell' > /dev/null 2>&1 ; then
55 echo "Subtest 2: OK"
56 else
57 echo "Subtest 2: Wrong result: $output2"
58 echo
59 result2=0
64 if test $result1 -eq 0 -a $result2 -ne 0 ; then
65 echo "Success - Cleaning up" && rm -f ${tmpfiles}
66 exit
67 else
68 echo "Failure!"
69 exit 1