Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dmake / tests / function_macros-10
blobdb6ce88b0ded7215cb8667b7bfcd5cd57c688cb0
1 #!/bin/sh
3 # 28.08.2007 Volker Quetschke
4 # Test mktmp function macro.
5 # (issue 64234)
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 - Check that mktmp can write special characters into a file.
18 cat > $file1 <<EOT
19 SHELL*:=/bin/sh
20 SHELLFLAGS*:=-ce
22 FOO:=test1\n\ttest2\n\
23 test3
25 all :
26 @cat \$(mktmp \$(FOO:m))
28 EOT
30 output1=`eval ${DMAKEPROG} -r -f $file1`
31 result1=$?
32 comparewith=`printf "test1\n\ttest2\n test3"`
33 if test $result1 = 0 -a "$output1" = "$comparewith" ; then
34 echo "Subtest 1: OK"
35 result1=0
36 else
37 echo "Subtest 1: Wrong result: $output1"
38 echo
39 result1=1
43 # Remember to quote variables in generated makefiles( $ -> \$ ).
44 # Test 2 - Check output of '('
45 cat > $file1 <<EOT
46 SHELL*:=/bin/sh
47 SHELLFLAGS*:=-ce
49 all :
50 @cat \${mktmp text (to dump to file}
52 EOT
54 output2=`eval ${DMAKEPROG} -r -f $file1`
55 result2=$?
56 if test $result2 = 0 -a "$output2" = "text (to dump to file" ; then
57 echo "Subtest 2: OK"
58 result2=0
59 else
60 echo "Subtest 2: Wrong result: $output2"
61 echo
62 result2=1
66 # Remember to quote variables in generated makefiles( $ -> \$ ).
67 # Test 3 - Test multiple line output.
68 cat > $file1 <<EOT
69 SHELL*:=/bin/sh
70 SHELLFLAGS*:=-ce
72 OBJ = fred.obj mary.obj
74 ./all :
75 @cat \$(mktmp \$(OBJ:t"+\n"))
76 EOT
78 output3=`eval OOODMAKEMODE=y ${DMAKEPROG} -r -f $file1`
79 result3=$?
80 comparewith=`printf "fred.obj+\nmary.obj"`
81 if test $result3 = 0 -a "$output3" = "$comparewith" ; then
82 echo "Subtest 3: OK"
83 result3=0
84 else
85 echo "Subtest 3: Wrong result: $output3"
86 echo
87 result3=1
91 # Remember to quote variables in generated makefiles( $ -> \$ ).
92 # Test 4 - Test <+ ... +>
93 cat > $file1 <<EOT
94 SHELL*:=/bin/sh
95 SHELLFLAGS*:=-ce
97 OBJ = fred.obj mary.obj joe.obj
99 ./all :
100 @cat <+\$(OBJ)+>
103 output4=`eval ${DMAKEPROG} -r -f $file1`
104 result4=$?
105 if test $result4 = 0 -a "$output4" = "fred.obj mary.obj joe.obj" ; then
106 echo "Subtest 4: OK"
107 result4=0
108 else
109 echo "Subtest 4: Wrong result: $output4"
110 echo
111 result4=1
115 if test $result1 -eq 0 -a $result2 -eq 0 \
116 -a $result3 -eq 0 -a $result4 -eq 0 ; then
117 echo "Success - Cleaning up" && rm -f ${tmpfiles}
118 exit
119 else
120 echo "Failure!"
121 exit 1