office-gobmx/dmake/tests/function_macros-2
Jens-Heiner Rechtien 16db6e1142 INTEGRATION: CWS dmake43p01 (1.1.2); FILE ADDED
2005/06/02 03:41:19 vq 1.1.2.1: #i39248# Add testsuite for dmake (only tor targets using the autotools).
2006-04-20 11:15:03 +00:00

64 lines
No EOL
1.6 KiB
Bash
Executable file

#!/bin/sh
# 01.06.2005 Volker Quetschke
# Tests for dmake function macros - part 2.
# (issue 36027, issue 37053, issue 37491)
: ${DMAKEPROG:=dmake}
file1="mymakefile.mk"
tmpfiles="$file1"
trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
trap 'rm -rf $tmpfiles' 1 2 3 15
# Remember to quote variables in generated makefiles( $ -> \$ ).
cat > $file1 <<EOT
# Testing function macros
SHELL*:=/bin/sh
SHELLFLAGS*:=-ce
TEST1:=a b c
PAT:=Z
all:
+@echo -e '\n\$\$(shell ...) section'
+test ":123:" = ":\$(shell echo 123 ):"
+test ":123:" = ":\$(shell \
echo 123 ):"
+test ":123:" = ":\$(shell echo \
123 ):"
+@echo -e '\n\$\$(sort ...) section'
+test ":a b c:" = ":\$(sort c a b ):"
+test ":a b c:" = ":\$(sort\
c a b ):"
+test ":a b c:" = ":\$(sort c \
a b ):"
+@echo -e '\n\$\$(strip ...) section'
+test ":c a b:" = ":\$(strip c a b ):"
+test ":c a b:" = ":\$(strip c \
a b ):"
+@echo -e '\n\$\$(subst ...) section'
+test ":aZbZc:" = ":\$(subst,\$(SPACECHAR),\$(PAT) \$(TEST1)):"
+test ":aZbZc:" = ":\$(subst,%Z*Z%,\$(PAT) \$(TEST1:s/ /%Z*Z%/)):"
+test ":aZbZc:" = ":\$(subst,Y,\$(PAT) aYbYc ):"
+test ":aZbZc:" = ":{\$(subst,Y,Z aYbYc )}:"
# Undefined
# +test ":Should error out:BUG:\$(subst, ,\$(PAT) \$(TEST1)):"
+@echo -e '\n\$\$(uniq ...) section'
+test ":a b c:" = ":\$(uniq c a b c ):"
+test ":a b c:" = ":\$(uniq c \
a b c ):"
EOT
${DMAKEPROG} -r -f $file1
result=$?
test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles}
test $result -ne 0 && echo "Failure!"
exit $result