diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2007-10-15 14:52:10 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2007-10-15 14:52:10 +0000 |
commit | f5047827faba05afd4fa70e97f544498ed015e44 (patch) | |
tree | 575f42cfc849a77f0ee2a7d273a9eadff7591752 /dmake | |
parent | 8c57f7ce5654bb1e9477c270b2eeed56ad57df7a (diff) |
INTEGRATION: CWS dmake411 (1.1.2); FILE ADDED
2007/08/31 05:24:13 vq 1.1.2.2: #i64572# Issue a warning for virtual targets with corresponding files.
Update testcases.
2007/08/25 20:50:32 vq 1.1.2.1: #i64572# Add testcases.
Diffstat (limited to 'dmake')
-rwxr-xr-x | dmake/tests/targets-28 | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/dmake/tests/targets-28 b/dmake/tests/targets-28 new file mode 100755 index 000000000000..da202b0d2025 --- /dev/null +++ b/dmake/tests/targets-28 @@ -0,0 +1,175 @@ +#!/bin/sh + +# 25.08.2007 Volker Quetschke +# Check that dmake handles dependencies correctly. +# (issue 64572) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="aa.x" +file3="aa.y" +file4="aa.z" +tmpfiles="$file1 $file2 $file3 $file4" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles + +# Remember to quote variables in generated makefiles( $ -> \$ ). +# Test 1 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +aa.x : aa.y + @echo nothing + +aa.y : + @echo \$@ + +EOT + +# Create test environment +touch aa.x +# Avoid that aa.x has the same time stamp as aa.y after +# that has been rebuild. +sleep 1 + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1` +result1=$? + +if test $result1 = 0 && echo $output1 | grep 'Warning: -- Target \[aa.x\] was made but the time stamp has not been updated.' > /dev/null 2>&1 ; then + echo "Subtest 1: OK" + result1=0 +else + echo "Subtest 1: Wrong result: $output1" + echo + result1=1 +fi + + +# Remember to quote variables in generated makefiles( $ -> \$ ). +# Test 2 - Warn if virtual targets have a corresponding file. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +aa.x : aa.y + @echo X\$@X + @touch \$@ + +# Should warn - aa.y exists. +aa.y : aa.z + +aa.z : + @printf Z\$@Z + +EOT + +# Create test environment +rm -f aa.x +touch aa.y +# Avoid the same time after build. +sleep 1 + +output2=`eval ${DMAKEPROG} -rf $file1 2>&1` +result2=$? + +if test $result2 = 0 && echo $output2 | grep 'Warning: -- Found file corresponding to virtual target \[aa.y\].' > /dev/null 2>&1 ; then + echo "Subtest 2: OK" + result2=0 +else + echo "Subtest 2: Wrong result: $output2" + echo + result2=1 +fi + + +# Remember to quote variables in generated makefiles( $ -> \$ ). +# Test 3 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +aa.x : aa.y + @echo X\$@X + @touch \$@ + +aa.y : aa.z + +aa.z : + @printf Z\$@Z + @touch \$@ + +EOT + +# Create test environment +rm -f aa.y +touch aa.z ; sleep 1 ; touch aa.x +# Avoid the same time after build. +sleep 1 + +# This tests that aa.x is not build as the dependency chain is intact with +# the virtual target aa.y having the same time stamp as aa.z. +output3=`eval ${DMAKEPROG} -rf $file1 2>&1` +result3=$? + +if test $result3 = 0 -a "$output3" = "\`aa.x' is up to date" ; then + echo "Subtest 3: OK" + result3=0 +else + echo "Subtest 3: Wrong result: :$output3:" + echo + result3=1 +fi + + +# Remember to quote variables in generated makefiles( $ -> \$ ). +# Test 4 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +aa.x : aa.y + @echo Build \$@ + @touch \$@ + +aa.y : aa.z + +aa.z : + @printf Z\$@Z + @touch \$@ + +EOT + +# Create test environment +touch aa.z ; sleep 1 ; touch aa.x +# Create a file for the virtual target that is newer than aa.x +sleep 1 ; touch aa.y +# Avoid the same time after build. +sleep 1 + +# This tests that aa.x is build. +output4=`eval ${DMAKEPROG} -rf $file1 2>&1` +result4=$? + +if test $result4 = 0 -a "$output4" = "Build aa.x" ; then + echo "Subtest 4: OK" + result4=0 +else + echo "Subtest 4: Wrong result: :$output4:" + echo + result4=1 +fi + + +if test $result1 -eq 0 -a $result2 -eq 0 \ + -a $result3 -eq 0 -a $result4 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi |