office-gobmx/dmake/tests/function_macros-1
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

96 lines
No EOL
2.3 KiB
Bash
Executable file

#!/bin/sh
# 01.06.2005 Volker Quetschke
# Tests for dmake function macros. (issue 36027, issue 37053)
: ${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
all:
@echo \$\$(and ...) section
test "::" = ":\$(and \$(nil) \$(nil) ):"
test ":t:" = ":\$(and a b ):"
test "::" = ":\$(and \$(nil) \
\$(nil) ):"
test "::" = ":\$(and \
):"
@echo -e \n\$\$(assign ...) section
test ":A:" = ":\$(assign A := B ):"
test "\$(A)" = "B"
test ":A:" = ":\$(assign A\
:= C ):"
test "\$(A)" = "C"
@echo -e \n\$\$(echo ...) section
test ":123:" = ":\$(echo 123 ):"
test ":123:" = ":\$(echo 123 ):"
test ":123:" = ":\$(echo\
123 ):"
test ":123:" = ":\$(echo \
123 ):"
@echo -e \n\$\$(eq ...) section
test ":true:" = ":\$(eq,1,1 true false):"
test ":true:" = ":\$(eq,1,1\
true false):"
# These tests need to use a shell
+@echo -e '\n\$\$(foreach ...) section'
+test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i]):"
+test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i]):"
+test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i] ):"
+test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) \
[\$i] ):"
@echo -e \n\$\$(nil ...) section
test "::" = ":\$(nil abc):"
# Fails with syntax error
test "::" = ":\$(nil \
):"
@echo -e \n\$\$(not ...) section
test "::" = ":\$(not abc):"
test ":t:" = ":\$(not \$(NULL)):"
test ":t:" = ":\$(not ):"
test ":t:" = ":\$(not \
):"
@echo -e \n\$\$(null ...) section
test ":true:" = ":\$(null, true false):"
test ":false:" = ":\$(null,a true false):"
test ":false:" = ":\$(null,a true false ):"
test ":false:" = ":\$(null,a \
true false ):"
test ":true:" = ":\$(null, \
true false ):"
@echo -e \n\$\$(or ...) section
test "::" = ":\$(or \$(nil) \$(nil) ):"
test ":t:" = ":\$(or a \$(nil) ):"
test "::" = ":\$(or \$(nil) \
\$(nil) ):"
test "::" = ":\$(or \
):"
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