Update ooo320-m1
[ooovba.git] / dmake / tests / misc-20
blobc25bf05d8342f64ddb4058709823e682dda0cd1e
1 #!/bin/sh
3 # 16.09.2007 Volker Quetschke
4 # Check that inferred makefiles for .INCLUDE do not disturb the dependency
5 # checking afterwards.
6 # (issue 81296)
8 : ${DMAKEPROG:=dmake}
9 file1="mfile1.mk"
10 file2="my.c"
11 file3="my.obj"
12 file4="my.foo"
13 tmpfiles="$file1 $file2 $file3 $file4"
15 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
17 # Remove files from prior failed run
18 rm -rf $tmpfiles
20 # Remember to quote variables in generated makefiles( $ -> \$ ).
21 # Test 1 - from testcase t_81296_5.mk
22 cat > $file1 <<EOT
23 SHELL*:=/bin/sh
24 SHELLFLAGS*:=-ce
26 # Test that my.c is build when my.foo is newer.
28 # rules.mk ---
29 %.obj : %.c ; @+printf "\$@:"
30 # @sleep 1
31 @touch \$@
33 %.dpo : %.c ; @+printf "incbuild:\$@:"
34 # @sleep 1
36 # target.mk ---
37 all : my.obj ; @echo all
39 # If the file exist no inference is done for it.
40 .INCLUDE .IGNORE : my.dpo
42 # When inference was run on the %.dpo with an existing
43 # %.c these rule gets ignored.
44 # local makefile.mk ---
45 %.c : %.foo ; @+printf "\$@:"
46 # @sleep 1
47 @touch \$@
48 EOT
50 # Create test environment
51 touch my.c
52 sleep 1
53 touch my.foo
55 output1=`eval ${DMAKEPROG} -rf $file1 2>&1 `
56 result1=$?
58 if test $result1 = 0 -a "$output1" = "incbuild:my.dpo:my.c:my.obj:all"; then
59 echo "Subtest 1: OK"
60 else
61 echo "Subtest 1: Wrong result: $output1"
62 echo
63 result1=1
64 fi
66 # Remove files from prior run
67 rm -rf $tmpfiles
68 # Remember to quote variables in generated makefiles( $ -> \$ ).
69 # Test 2 - from testcase t_81296_6.mk
70 cat > $file1 <<EOT
71 SHELL*:=/bin/sh
72 SHELLFLAGS*:=-ce
74 # Test that no circular dependency error is issued:
75 # $ rm -f my.* ; touch my.c ; ./dmake/dmake.exe -rf t_81296_6.mk
77 # rules.mk ---
78 %.obj : %.c ; @+printf "\$@:"
79 @touch \$@
81 %.dpo : %.c ; @+printf "incbuild:\$@:"
83 # target.mk ---
84 all : my.obj ; @echo all
86 # If the file exist no inference is done for it.
87 .INCLUDE .IGNORE : my.dpo
89 %.c : %.foo ; @+printf "\$@:"
90 @touch \$@
92 # This leads to a (wrong) circular dependency error
93 my.obj : my.c
95 EOT
97 # Create test environment
98 touch my.c
99 sleep 1
100 touch my.foo
102 output2=`eval ${DMAKEPROG} -rf $file1 2>&1 `
103 result2=$?
105 if test $result2 = 0 -a "$output2" = "incbuild:my.dpo:my.c:my.obj:all"; then
106 echo "Subtest 2: OK"
107 else
108 echo "Subtest 2: Wrong result: $output2"
109 echo
110 result2=1
114 if test $result1 -eq 0 -a $result2 -eq 0 ; then
115 echo "Success - Cleaning up"
116 rm -rf $tmpfiles
117 exit
118 else
119 echo "Failure!"
120 exit 1