office-gobmx/dmake/tests/function_macros-9

71 lines
1.4 KiB
Text
Raw Normal View History

#!/bin/sh
# 05.08.2007 Volker Quetschke
# Test the $(shell,expand ..) function macro.
# (issue 50092)
: ${DMAKEPROG:=dmake}
file1="mfile1.mk"
tmpfiles="$file1"
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 - Test if it works.
cat > $file1 <<EOT
# The printf on Solaris seems to need bash.
SHELL:=/bin/bash
SHELLFLAGS*:=-ce
AAA!=123
all :
noop X\$(shell,expand +@printf "\x24(AAA)")Y\$(shell +@printf \\\\x24\\(AAA\\))Z
EOT
output1=`eval ${DMAKEPROG} -r -f $file1`
result1=$?
if test "$output1" != "noop X123Y\$(AAA)Z"; then
echo "Subtest 1: Wrong result: $output1"
result1=1
else
echo "Subtest 1: OK"
fi
# Test 2 - Test if wrong arguments are catched.
cat > $file1 <<EOT
# The printf on Solaris seems to need bash.
SHELL:=/bin/bash
SHELLFLAGS*:=-ce
AAA!=123
all :
noop X\$(shell,XXX +@printf ABC\\\\x24\\(AAA\\))Y
EOT
output2=`eval ${DMAKEPROG} -rf $file1 2>&1`
result2=$?
if echo $output2 | grep 'Error: -- Unknown argument \[XXX\] to shell' > /dev/null 2>&1 ; then
echo "Subtest 2: OK"
else
echo "Subtest 2: Wrong result: $output2"
echo
result2=0
fi
if test $result1 -eq 0 -a $result2 -ne 0 ; then
echo "Success - Cleaning up" && rm -f ${tmpfiles}
exit
else
echo "Failure!"
exit 1
fi