diff options
Diffstat (limited to 'dmake/tests')
85 files changed, 5636 insertions, 0 deletions
diff --git a/dmake/tests/Makefile.am b/dmake/tests/Makefile.am new file mode 100644 index 000000000000..87be868bec2d --- /dev/null +++ b/dmake/tests/Makefile.am @@ -0,0 +1,22 @@ +## Makefile for the tests subdirectory of dmake. + +TESTS = infra-0 function_macros-1 function_macros-2 function_macros-3 \ + function_macros-4 function_macros-5 function_macros-6 \ + function_macros-7 function_macros-8 function_macros-9 \ + function_macros-10 \ + macros-1 macros-2 macros-3 macros-4 macros-5 macros-6 macros-7 \ + macros-8 macros-9 macros-10 macros-11 \ + recipes-1 recipes-2 recipes-3 recipes-4 recipes-5 recipes-6 \ + recipes-7 recipes-8 recipes-9 \ + misc-1 misc-2 misc-3 misc-4 misc-5 misc-6 misc-7 misc-8 misc-9 \ + misc-10 misc-11 misc-12 misc-13 misc-14 misc-15 misc-16 misc-17 \ + misc-18 misc-19 misc-20 misc-21 \ + targets-1 targets-2 targets-3 targets-4 targets-5 targets-6 \ + targets-7 targets-8 targets-9 targets-10 targets-11 targets-12 \ + targets-13 targets-14 targets-15 targets-16 targets-17 targets-18 \ + targets-19 targets-20 targets-21 targets-22 targets-23 targets-24 \ + targets-25 targets-26 targets-27 targets-28 targets-29 targets-30 + +TESTS_ENVIRONMENT = DMAKEPROG="../dmake" + +EXTRA_DIST = $(TESTS) diff --git a/dmake/tests/Makefile.in b/dmake/tests/Makefile.in new file mode 100644 index 000000000000..40868002e6be --- /dev/null +++ b/dmake/tests/Makefile.in @@ -0,0 +1,392 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +LIBOBJDIR = +subdir = tests +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DBUG_FALSE = @DBUG_FALSE@ +DBUG_TRUE = @DBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DMAKEROOT_H_LINE1 = @DMAKEROOT_H_LINE1@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +OSTYPEUNIX_FALSE = @OSTYPEUNIX_FALSE@ +OSTYPEUNIX_TRUE = @OSTYPEUNIX_TRUE@ +OSTYPEWIN32_FALSE = @OSTYPEWIN32_FALSE@ +OSTYPEWIN32_TRUE = @OSTYPEWIN32_TRUE@ +OS_TYPE = @OS_TYPE@ +OS_VERSION = @OS_VERSION@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +TESTS = infra-0 function_macros-1 function_macros-2 function_macros-3 \ + function_macros-4 function_macros-5 function_macros-6 \ + function_macros-7 function_macros-8 function_macros-9 \ + function_macros-10 \ + macros-1 macros-2 macros-3 macros-4 macros-5 macros-6 macros-7 \ + macros-8 macros-9 macros-10 macros-11 \ + recipes-1 recipes-2 recipes-3 recipes-4 recipes-5 recipes-6 \ + recipes-7 recipes-8 recipes-9 \ + misc-1 misc-2 misc-3 misc-4 misc-5 misc-6 misc-7 misc-8 misc-9 \ + misc-10 misc-11 misc-12 misc-13 misc-14 misc-15 misc-16 misc-17 \ + misc-18 misc-19 misc-20 misc-21 \ + targets-1 targets-2 targets-3 targets-4 targets-5 targets-6 \ + targets-7 targets-8 targets-9 targets-10 targets-11 targets-12 \ + targets-13 targets-14 targets-15 targets-16 targets-17 targets-18 \ + targets-19 targets-20 targets-21 targets-22 targets-23 targets-24 \ + targets-25 targets-26 targets-27 targets-28 targets-29 targets-30 + +TESTS_ENVIRONMENT = DMAKEPROG="../dmake" +EXTRA_DIST = $(TESTS) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-TESTS check-am clean clean-generic \ + distclean distclean-generic distdir dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/dmake/tests/README b/dmake/tests/README new file mode 100644 index 000000000000..ac0af7a8e571 --- /dev/null +++ b/dmake/tests/README @@ -0,0 +1,12 @@ +DMAKE TESTCASES +=============== + +The testcases in this directory will be executed by "make check" in +this or the top directory. + +Each test can be executed as a standalone script that will test the +first dmake that is found in the path. A different dmake to be tested +can be specified by setting the DMAKEPROG environment variable. + +Example: +$ DMAKEPROG=../dmake ./misc-4 diff --git a/dmake/tests/function_macros-1 b/dmake/tests/function_macros-1 new file mode 100755 index 000000000000..6e5368005a63 --- /dev/null +++ b/dmake/tests/function_macros-1 @@ -0,0 +1,96 @@ +#!/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
\ No newline at end of file diff --git a/dmake/tests/function_macros-10 b/dmake/tests/function_macros-10 new file mode 100755 index 000000000000..db6ce88b0ded --- /dev/null +++ b/dmake/tests/function_macros-10 @@ -0,0 +1,122 @@ +#!/bin/sh + +# 28.08.2007 Volker Quetschke +# Test mktmp function macro. +# (issue 64234) + +: ${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 - Check that mktmp can write special characters into a file. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +FOO:=test1\n\ttest2\n\ + test3 + +all : + @cat \$(mktmp \$(FOO:m)) + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +comparewith=`printf "test1\n\ttest2\n test3"` +if test $result1 = 0 -a "$output1" = "$comparewith" ; 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 - Check output of '(' +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + @cat \${mktmp text (to dump to file} + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1` +result2=$? +if test $result2 = 0 -a "$output2" = "text (to dump to file" ; 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 - Test multiple line output. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +OBJ = fred.obj mary.obj + +./all : + @cat \$(mktmp \$(OBJ:t"+\n")) +EOT + +output3=`eval OOODMAKEMODE=y ${DMAKEPROG} -r -f $file1` +result3=$? +comparewith=`printf "fred.obj+\nmary.obj"` +if test $result3 = 0 -a "$output3" = "$comparewith" ; 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 - Test <+ ... +> +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +OBJ = fred.obj mary.obj joe.obj + +./all : + @cat <+\$(OBJ)+> +EOT + +output4=`eval ${DMAKEPROG} -r -f $file1` +result4=$? +if test $result4 = 0 -a "$output4" = "fred.obj mary.obj joe.obj" ; 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 -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/function_macros-2 b/dmake/tests/function_macros-2 new file mode 100755 index 000000000000..c17501f2aa5d --- /dev/null +++ b/dmake/tests/function_macros-2 @@ -0,0 +1,64 @@ +#!/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
\ No newline at end of file diff --git a/dmake/tests/function_macros-3 b/dmake/tests/function_macros-3 new file mode 100755 index 000000000000..bd8d06b3de27 --- /dev/null +++ b/dmake/tests/function_macros-3 @@ -0,0 +1,40 @@ +#!/bin/sh + +# 04.09.2005 Volker Quetschke +# Tests $(shell ..) function macro when using two concurrend processes. +# (issue 53148) + +: ${DMAKEPROG:=dmake} +file1="makefile.mk" +file2="stdout.txt" +tmpfiles="$file1 $file2" + +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 continuation char in recipes +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +AA=X\$(shell +echo shellexec)X + +$file2 : + +@echo b0 + +@echo b1 + +@echo b2 + +@echo A\$(AA)A > $file2 +EOT + +${DMAKEPROG} -P2 -r -f $file1 +result=$? +if test "`cat $file2`" != "AXshellexecXA"; then + echo "Wrong result: `cat $file2`, AXshellexecXA expected!" + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/function_macros-4 b/dmake/tests/function_macros-4 new file mode 100755 index 000000000000..eef22e334ab9 --- /dev/null +++ b/dmake/tests/function_macros-4 @@ -0,0 +1,35 @@ +#!/bin/sh + +# 04.09.2005 Volker Quetschke +# Tests $(shell ..) if function macro is executed after previous recipe lines +# when using two concurrend (or more) processes. +# (issue 53148) + +: ${DMAKEPROG:=dmake} +file1="makefile.mk" +file2="stdout.txt" +tmpfiles="$file1 $file2" + +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 continuation char in recipes +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +aaa : + +echo b0 + +echo b1 + +echo teststring > $file2 + +echo A\$(shell cat $file2)A +EOT + +${DMAKEPROG} -P2 -r -f $file1 +result=$? + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/function_macros-5 b/dmake/tests/function_macros-5 new file mode 100755 index 000000000000..1be199068c7b --- /dev/null +++ b/dmake/tests/function_macros-5 @@ -0,0 +1,46 @@ +#!/bin/sh + +# 03.14.2006 Volker Quetschke +# Verifies that $(shell ..) does not pick up stdout output from +# concurrent processes. (Stronger test for the spawn case.) +# (issue 61856 / issue 61940) + +: ${DMAKEPROG:=dmake} +file1="makefile.mk" +file2="stdout.txt" +tmpfiles="$file1 $file2" + +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 continuation char in recipes +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : all1 all2 + @+echo "Y\$(DYNMAC)Y" > $file2 + +all1 : + @+echo "Before the sleeps ..." + @+echo A; sleep 1; echo B; sleep 1; echo C; sleep 1; echo D; sleep 1; echo E + @+echo "After the sleeps ..." + +all2 : + @+sleep 1; + @+echo "X\$(assign DYNMAC:=\$(shell @+echo "(shellpre)";sleep 2; echo "(shellpost)"))X" + @+echo "Z\$(DYNMAC)Z" +EOT + +${DMAKEPROG} -P3 -r -f $file1 +result=$? +if test "`cat $file2`" != "Y(shellpre) (shellpost)Y"; then + echo "Wrong result: `cat $file2`, Y(shellpre) (shellpost)Y expected!" + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/function_macros-6 b/dmake/tests/function_macros-6 new file mode 100755 index 000000000000..ce22d9c6e913 --- /dev/null +++ b/dmake/tests/function_macros-6 @@ -0,0 +1,42 @@ +#!/bin/sh + +# 22.07.2006 Volker Quetschke +# Verifies that $(nil expression) expand expression but returns "". +# (issue 67585) + +: ${DMAKEPROG:=dmake} +file1="makefile.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 nil function macro +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : dep + @+echo "X\$(AAA)X" + +dep : + \$(nil \$(assign AAA := OK)) + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test $output1 = "XOKX" ; then + dummy=1 + # OK +else + echo "Wrong result: $output1" + result1=1 +fi + +test $result1 -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result1 -ne 0 && echo "Failure!" +exit $result1 diff --git a/dmake/tests/function_macros-7 b/dmake/tests/function_macros-7 new file mode 100755 index 000000000000..e6fc03a3d84a --- /dev/null +++ b/dmake/tests/function_macros-7 @@ -0,0 +1,39 @@ +#!/bin/sh + +# 24.07.2006 Volker Quetschke +# Checks that $(mktmp ...) works. +# (issue 64583) + +: ${DMAKEPROG:=dmake} +file1="makefile.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 mktmp function macro +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + @+cat \$(mktmp WRITTENTODISK) + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test $output1 = "WRITTENTODISK" ; then + dummy=1 + # OK +else + echo "Wrong result: $output1" + result1=1 +fi + +test $result1 -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result1 -ne 0 && echo "Failure!" +exit $result1 diff --git a/dmake/tests/function_macros-8 b/dmake/tests/function_macros-8 new file mode 100755 index 000000000000..911b1cff306a --- /dev/null +++ b/dmake/tests/function_macros-8 @@ -0,0 +1,101 @@ +#!/bin/sh + +# 24.07.2007 Volker Quetschke +# Test the $(normpath ..) function macro. +# (issue 78776) + +: ${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 normpath works. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.WINPATH:= + +all : + @echo 1\$(normpath /tmp/./a "/tmp/a b/xxx/../b" /tmp)1 +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test "$output1" != "1/tmp/a \"/tmp/a b/b\" /tmp1"; then + echo "Subtest 1: Wrong result: $output1" + result1=1 +else + echo "Subtest 1: OK" +fi + +# Test 2 - Test if normpath honors .WINPATH setting +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all .WINPATH : + @echo 2\$(normpath /tmp)2 + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1` +result2=$? +if test x`uname -o 2> /dev/null` = "xCygwin"; then + if test "$output2" != "2`cygpath -m /tmp`2"; then + echo "Subtest 2: Wrong result: $output2" + result2=1 + else + echo "Subtest 2: OK" + fi +else + if test "$output2" != "2/tmp2"; then + echo "Subtest 2: Wrong result: $output2" + result2=1 + else + echo "Subtest 2: OK" + fi +fi + +# Test 3 - Test if the optional parameter works +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + @echo 3\$(normpath,"" /tmp)3\$(normpath,"abc" /tmp)3 + +EOT + +output3=`eval ${DMAKEPROG} -r -f $file1` +result3=$? +if test x`uname -o 2> /dev/null` = "xCygwin"; then + if test "$output3" != "3/tmp3`cygpath -m /tmp`3"; then + echo "Subtest 3: Wrong result: $output3" + result3=1 + else + echo "Subtest 3: OK" + fi +else + if test "$output3" != "3/tmp3/tmp3"; then + echo "Subtest 3: Wrong result: $output3" + result3=1 + else + echo "Subtest 3: OK" + fi +fi + + +if test $result1 -eq 0 -a $result2 -eq 0 \ + -a $result3 -eq 0 ; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/function_macros-9 b/dmake/tests/function_macros-9 new file mode 100755 index 000000000000..e8d4d3a070a7 --- /dev/null +++ b/dmake/tests/function_macros-9 @@ -0,0 +1,70 @@ +#!/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 diff --git a/dmake/tests/infra-0 b/dmake/tests/infra-0 new file mode 100755 index 000000000000..494ffa44283a --- /dev/null +++ b/dmake/tests/infra-0 @@ -0,0 +1,44 @@ +#!/bin/sh + +# 01.06.2005 Volker Quetschke +# Basic test of dmake existence and the needed infrastructure. + +: ${DMAKEPROG:=dmake} +file1="mymakefile.mk" +file2="mytestfile" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +# Test for "test" programm in path +which test > /dev/null || { echo "Failure! \"test\" program missing." ; exit 1; } +echo "Found \"test\" program." +test=`which test` + +# Test for "echo" programm in path +which echo > /dev/null || { echo "Failure! \"echo\" program missing." ; exit 1; } +echo "Found \"echo\" program." + +# Test for dmake program +${test} -x "${DMAKEPROG}" || { echo "Failure! \"dmake\" is missing." ; exit 1; } +echo "Found \"dmake\" program." + +# Remember to quote variables in generated makefiles( $ -> \$ ). +cat > $file1 <<EOT +# simple makefile +${file2}: + @echo 'Generating ${file2}' + touch ${file2} +EOT + +${DMAKEPROG} -r -f $file1 +result=$? +if ${test} ! -e "${file2}"; then + echo "File missing" + result=1 +fi + +${test} $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +${test} $result -ne 0 && echo "Failure!" +exit $result + diff --git a/dmake/tests/macros-1 b/dmake/tests/macros-1 new file mode 100755 index 000000000000..3eb0d57704f3 --- /dev/null +++ b/dmake/tests/macros-1 @@ -0,0 +1,41 @@ +#!/bin/sh + +# 01.06.2005 Volker Quetschke +# Tests for special dmake macros. +# (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 macros +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +TEST1:=a b c +PAT:=Z + +all: + +@echo -e '\n\$\$(SPACECHAR) section' + +test ": :" = ":\$(SPACECHAR):" + + +@echo -e '\n\$\$(MACRO:s/pat/rep/) section' + +test ":aZbZc:" = ":\$(TEST1:s/ /Z/):" + +test ":aZbZc:" = ":\$(TEST1:s/\$(SPACECHAR)/Z/):" + +test ":aZbZc:" = ":\$(TEST1:s/ /\$(PAT)/ ):" + +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 + diff --git a/dmake/tests/macros-10 b/dmake/tests/macros-10 new file mode 100755 index 000000000000..b2e7d373713f --- /dev/null +++ b/dmake/tests/macros-10 @@ -0,0 +1,99 @@ +#!/bin/sh + +# 08.08.2007 Volker Quetschke +# Test macro assignment syntax check. +# (issue 69510) + +: ${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 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +AAA:=BBB +\$(AAA) := 123 + +X) := YYY + +all : + @echo :\$(BBB):\${X)}: +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test "$output1" != ":123:YYY:"; then + echo "Subtest 1: Wrong result: $output1" + result1=1 +else + echo "Subtest 1: OK" +fi + +# Test 2 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +{ := fail + +all : + @echo Should fail + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result2=$? + +if test $result2 != 0 && echo $output2 | grep 'Error: -- Syntax error in macro assignment' > /dev/null 2>&1 ; then + echo "Subtest 2: OK" + result2=0 +else + echo "Subtest 2: Wrong result: $output2" + echo + result2=1 +fi + + +# Test 3 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +X := : + +AA\$XBB = 098 + +all : + @echo Should fail + +EOT + +output3=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result3=$? +if test $result3 != 0 && echo $output3 | grep 'Error: -- Syntax error in macro assignment' > /dev/null 2>&1 ; then + echo "Subtest 3: OK" + result3=0 +else + echo "Subtest 3: Wrong result: $output3" + echo + result3=1 +fi + + + +if test $result1 -eq 0 -a $result2 -eq 0 \ + -a $result3 -eq 0 ; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/macros-11 b/dmake/tests/macros-11 new file mode 100755 index 000000000000..023b8a140e1d --- /dev/null +++ b/dmake/tests/macros-11 @@ -0,0 +1,147 @@ +#!/bin/sh + +# 26.08.2007 Volker Quetschke +# Test OOODMAKEMODE macro. +# (issue 74007) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="startup.mk" +tmpfiles="$file1 $file2" + +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 - Without OOODMAKEMODE set strip leading ./ +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +#OOODMAKEMODE= + +./all : + @echo X\$@Y +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test $result1 = 0 -a "$output1" = "XallY" ; 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 - With OOODMAKEMODE=y do not strip leading ./ +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +OOODMAKEMODE:=y + +./all : + @echo X\$@Y +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1` +result2=$? +if test $result2 = 0 -a "$output2" = "X./allY" ; 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 - Test OOODMAKEMODE from environment. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.IMPORT : OOODMAKEMODE + +./all : + @echo X\$@Y +EOT + +output3=`eval OOODMAKEMODE=y ${DMAKEPROG} -r -f $file1` +result3=$? +if test $result3 = 0 -a "$output3" = "X./allY" ; 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 - With OOODMAKEMODE= leading ./ +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +OOODMAKEMODE:= + +./all : + @echo X\$@Y +EOT + +output4=`eval ${DMAKEPROG} -r -f $file1` +result4=$? +if test $result4 = 0 -a "$output4" = "XallY" ; then + echo "Subtest 4: OK" + result4=0 +else + echo "Subtest 4: Wrong result: $output4" + echo + result4=1 +fi + + +# Remember to quote variables in generated makefiles( $ -> \$ ). +# Test 5 - Import from environment / targets from command line. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%target : + @echo X\$@Y +EOT + +cat > $file2 <<EOT +.IMPORT : OOODMAKEMODE +EOT + +output5=`eval DMAKEROOT=. OOODMAKEMODE=y ${DMAKEPROG} -f $file1 ./mytarget` +result5=$? +if test $result5 = 0 -a "$output5" = "X./mytargetY" ; then + echo "Subtest 5: OK" + result5=0 +else + echo "Subtest 5: Wrong result: $output5" + echo + result5=1 +fi + + +if test $result1 -eq 0 -a $result2 -eq 0 \ + -a $result3 -eq 0 -a $result4 -eq 0 \ + -a $result5 -eq 0 ; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/macros-2 b/dmake/tests/macros-2 new file mode 100755 index 000000000000..c0d26260e0b6 --- /dev/null +++ b/dmake/tests/macros-2 @@ -0,0 +1,62 @@ +#!/bin/sh + +# 26.01.2006 Volker Quetschke +# TMD is sometimes set incorrectly (issue 61170). + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mfile2.mk" +file3="dirwith space" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles "$file3"; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles "$file3" + +# Remember to quote variables in generated makefiles( $ -> \$ ). +# Testcase 1 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all .SETDIR=${TMP} : + +@echo \$(TMD) + +EOT + +# Testcase 2 +mkdir -p "$file3" +cat > $file2 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + + +all ".SETDIR=dirwith space" : + +@echo \$(TMD) +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +output2=`eval ${DMAKEPROG} -r -f $file2` +result2=$? + +if test "$output1" = ""; then + echo "Test 1: Wrong result" + result1=1 +fi +if test "$output2" != ".."; then + echo "Test 2: Wrong result" + result2=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles "$file3" +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/macros-3 b/dmake/tests/macros-3 new file mode 100755 index 000000000000..f3428fb8307c --- /dev/null +++ b/dmake/tests/macros-3 @@ -0,0 +1,71 @@ +#!/bin/sh + +# 17.05.2006 Volker Quetschke +# Check that .INIT and .DONE are not mistaken for .<suffix> targets +# and that dmake warns if .<suffix> targets have prerequisites. +# (issue 65333). + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mfile2.mk" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +# Testcase 1 - No warning expected +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + +@echo "all" + +.INIT .DONE : something + +@echo "Dummy recipe" + +something : + +@echo "just a target" + +EOT + +# Testcase 2 - dmake should warn +cat > $file2 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.MYTARGET : something + +@echo ".MYTARGET" + +something : + +@echo "just a target" + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? +output2=`eval ${DMAKEPROG} -r -f $file2 2>&1 ` +result2=$? + +if test "$output1" != "all"; then + echo "Test 1: Wrong result: $output1" + result1=1 +fi +if echo $output2 | grep -v 'Warning: -- Ignoring' ; then + echo "Test 2: Wrong result: $output2" + result2=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/macros-4 b/dmake/tests/macros-4 new file mode 100755 index 000000000000..89134d2fa9c3 --- /dev/null +++ b/dmake/tests/macros-4 @@ -0,0 +1,92 @@ +#!/bin/sh + +# 15.08.2006 Volker Quetschke +# Check that single letter macros with (, {, ), } and : are rejected. +# (issue 44961). + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mfile2.mk" +file3="mfile3.mk" +file4="mfile4.mk" +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( $ -> \$ ). +# Testcase 1 - Warn about miising closing braket. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + +@echo "X\$(subst Y" +EOT + +# Testcase 2 - warn about $) +cat > $file2 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + +@echo "X\$)Y" +EOT + +# Testcase 3 - warn about $: +cat > $file3 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + +@echo "X\$:Y" +EOT + +# Testcase 4 - don't warn +cat > $file4 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + +@printf "X\$BLA)Y" + +@echo "X\$XX:Y" +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? +output2=`eval ${DMAKEPROG} -r -f $file2 2>&1 ` +result2=$? +output3=`eval ${DMAKEPROG} -r -f $file3 2>&1 ` +result3=$? +output4=`eval ${DMAKEPROG} -r -f $file4 2>&1 ` +result4=$? + +if echo $output1 | grep -v 'Error: -- Syntax error'; then + echo "Test 1: Missing error: $output1" + result1=0 +fi +if echo $output2 | grep -v 'Error: -- Syntax error' ; then + echo "Test 2: Missing error: $output2" + result2=0 +fi +if echo $output3 | grep -v 'Error: -- Syntax error'; then + echo "Test 3: Missing error: $output3" + result3=0 +fi +if test "$output4" != "XLA)YXX:Y"; then + echo "Test 2: Wrong result: $output4" + result4=1 +fi + +if test $result1 -ne 0 -a $result2 -ne 0 -a $result3 -ne 0 -a $result4 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/macros-5 b/dmake/tests/macros-5 new file mode 100755 index 000000000000..d175271ee6f9 --- /dev/null +++ b/dmake/tests/macros-5 @@ -0,0 +1,68 @@ +#!/bin/sh + +# 24.09.2006 Volker Quetschke +# TMD is sometimes set incorrectly (issue 69821). + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mfile2.mk" +file3="test1/aaa" +file4="test2/aaa" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles test1 test2; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles test1 test2 + +# Remember to quote variables in generated makefiles( $ -> \$ ). +# Testcase 1 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + +@echo \$(TMD) + +EOT + +# Testcase 2 +mkdir -p "$file3" +mkdir -p "$file4" +cat > $file2 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + + +all ".SETDIR=../../$file3" : + +@echo \$(TMD) +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +output2=`eval cd $file4 ; ../../${DMAKEPROG} -r -f ../../$file2` +result2=$? + +if test "$output1" != "."; then + echo "Test 1: Wrong result: $output1" + result1=1 +else + echo " Subtest 1: OK" +fi +if test "$output2" != "../../test2/aaa"; then + echo "Test 2: Wrong result: $output2" + result2=1 +else + echo " Subtest 2: OK" +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles test1 test2 +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/macros-6 b/dmake/tests/macros-6 new file mode 100755 index 000000000000..8119f2ae84bb --- /dev/null +++ b/dmake/tests/macros-6 @@ -0,0 +1,62 @@ +#!/bin/sh + +# 09.11.2006 Volker Quetschke +# Check that TMD honors if .SETDIR is used (with drive letters on cygwin) +# (issue 69821). + +: ${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( $ -> \$ ). +# Testcase 1 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.IMPORT .IGNORE : TEMP +.IF "\$(TEMP)"=="" +TEMP:=/tmp +.ENDIF + + +# Test if .SETDIR works with drive letters +.IF "\$(subst,Cygwin, \$(shell @uname))"!="\$(shell @uname)" +SDIR:=\$(shell @+cygpath -d "\$(TEMP)") +.ELSE +SDIR:=\$(TEMP) +.ENDIF + +# Make TEMP the target directory, cd to TMD should go back to +# the original directory +all ".SETDIR=\$(SDIR)" : + @+cd \$(TMD); pwd + +EOT + + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? + +if test "$output1" != "`pwd`"; then + echo "Test 1: Wrong result: ${output1}" + result1=1 +else + echo "Test 1: OK" +fi + +if test $result1 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/macros-7 b/dmake/tests/macros-7 new file mode 100755 index 000000000000..2c7d0849172f --- /dev/null +++ b/dmake/tests/macros-7 @@ -0,0 +1,76 @@ +#!/bin/sh + +# 24.07.2007 Volker Quetschke +# Test the $(macro:n) macro extension. +# (issue 78776) + +: ${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 :n works. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.WINPATH:= + +MACRO:=/tmp/./a "/tmp/a b/xxx/../b" /tmp + +all : + @echo 1\$(MACRO:n)1 +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test "$output1" != "1/tmp/a \"/tmp/a b/b\" /tmp1"; then + echo "Subtest 1: Wrong result: $output1" + result1=1 +else + echo "Subtest 1: OK" +fi + +# Test 2 - Test if the .WINPATH setting is honored +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACRO:=/tmp + +all .WINPATH : + @echo 2\$(MACRO:n)2 + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1` +result2=$? +if test x`uname -o 2> /dev/null` = "xCygwin"; then + if test "$output2" != "2`cygpath -m /tmp`2"; then + echo "Subtest 2: Wrong result: $output2" + result2=1 + else + echo "Subtest 2: OK" + fi +else + if test "$output2" != "2/tmp2"; then + echo "Subtest 2: Wrong result: $output2" + result2=1 + else + echo "Subtest 2: OK" + fi +fi + + +if test $result1 -eq 0 -a $result2 -eq 0 ; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/macros-8 b/dmake/tests/macros-8 new file mode 100755 index 000000000000..705a92878ad0 --- /dev/null +++ b/dmake/tests/macros-8 @@ -0,0 +1,157 @@ +#!/bin/sh + +# 24.07.2007 Volker Quetschke +# Test the :b :d :e :f macro extensions. +# (issue 80009) + +: ${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 :f works. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.WINPATH:= + +MACRO:=/tmp/yyy.ext "/tmp/a b/xxx.ext" + +all : + @echo f:\$(MACRO:f): +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test "$output1" != "f:yyy.ext \"xxx.ext\":"; then + echo "Subtest 1: Wrong result: $output1" + result1=1 +else + echo "Subtest 1: OK" +fi + +# Test 2 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACRO:=/tmp/yyy.ext "/tmp/a b/xxx.ext" + +all : + @echo d:\$(MACRO:d): + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1` +result2=$? +if test "$output2" != "d:/tmp/ \"/tmp/a b/\":"; then + echo "Subtest 2: Wrong result: $output2" + result2=1 +else + echo "Subtest 2: OK" +fi + + +# Test 3 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACRO:=/tmp/yyy.ext "/tmp/a b/xxx.ext" + +all : + @echo e:\$(MACRO:e): + +EOT + +output3=`eval ${DMAKEPROG} -r -f $file1` +result3=$? +if test "$output3" != "e:.ext \".ext\":"; then + echo "Subtest 3: Wrong result: $output3" + result3=1 +else + echo "Subtest 3: OK" +fi + + +# Test 4 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACRO:=/tmp/yyy.ext "/tmp/a b/xxx.ext" + +all : + @echo b:\$(MACRO:b): + +EOT + +output4=`eval ${DMAKEPROG} -r -f $file1` +result4=$? +if test "$output4" != "b:yyy \"xxx\":"; then + echo "Subtest 4: Wrong result: $output4" + result4=1 +else + echo "Subtest 4: OK" +fi + + +# Test 5 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACRO:=/tmp/yyy.ext "/tmp/a b/xxx.ext" + +all : + @echo de:\$(MACRO:de): + +EOT + +output5=`eval ${DMAKEPROG} -r -f $file1` +result5=$? +if test "$output5" != "de:/tmp/.ext \"/tmp/a b/.ext\":"; then + echo "Subtest 5: Wrong result: $output5" + result5=1 +else + echo "Subtest 5: OK" +fi + + +# Test 6 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACROd:=/tmp/yyy "/tmp/a b/xxx" + +all : + @echo e:\$(MACROd:e): + +EOT + +output6=`eval ${DMAKEPROG} -r -f $file1` +result6=$? +if test "$output6" != "e::"; then + echo "Subtest 6: Wrong result: $output6" + result6=1 +else + echo "Subtest 6: OK" +fi + + +if test $result1 -eq 0 -a $result2 -eq 0 \ + -a $result3 -eq 0 -a $result4 -eq 0 \ + -a $result5 -eq 0 -a $result6 -eq 0 ; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/macros-9 b/dmake/tests/macros-9 new file mode 100755 index 000000000000..edfaf343fccf --- /dev/null +++ b/dmake/tests/macros-9 @@ -0,0 +1,141 @@ +#!/bin/sh + +# 27.07.2007 Volker Quetschke +# Test the :i :1 macro extensions. +# (issue 80010) + +: ${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 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.WINPATH:= + +MACRO:="/tmp/yyy.ext" "/tmp/a b/xxx.ext" + +all : + @echo 1:\$(MACRO:1): +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test "$output1" != "1:\"/tmp/yyy.ext\":"; then + echo "Subtest 1: Wrong result: $output1" + result1=1 +else + echo "Subtest 1: OK" +fi + +# Test 2 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACRO2:=/tmp/zzz.ext /tmp/aaa + +all : + @echo 1:\$(MACRO2:1): + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1` +result2=$? +if test "$output2" != "1:/tmp/zzz.ext:"; then + echo "Subtest 2: Wrong result: $output2" + result2=1 +else + echo "Subtest 2: OK" +fi + + +# Test 3 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACRO:="/tmp/yyy.ext" "/tmp/a b/xxx.ext" + +all : + @echo i:\$(MACRO:i): + +EOT + +output3=`eval ${DMAKEPROG} -r -f $file1` +result3=$? +if test "$output3" != "i:\"/tmp/yyy.ext\" \"/tmp/a b/xxx.ext\":"; then + echo "Subtest 3: Wrong result: $output3" + result3=1 +else + echo "Subtest 3: OK" +fi + + +# Test 4 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACRO:="/tmp/yyy.ext" "/tmp/a b/xxx.ext" + +.WINPATH= + +all : + @echo 1n:\$(MACRO:1n): + +EOT + +output4=`eval ${DMAKEPROG} -r -f $file1` +result4=$? +if test "$output4" != "1n:\"/tmp/yyy.ext\":"; then + echo "Subtest 4: Wrong result: $output4" + result4=1 +else + echo "Subtest 4: OK" +fi + + +# Test 5 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MACROi:="./expand.c" + +.WINPATH= + +.SOURCE : .. + +all : expand.c + @echo i:\$(MACROi:i): + +EOT + +output5=`eval ${DMAKEPROG} -r -f $file1` +result5=$? +if test "$output5" != "i:\"../expand.c\":"; then + echo "Subtest 5: Wrong result: $output5" + result5=1 +else + echo "Subtest 5: OK" +fi + + +if test $result1 -eq 0 -a $result2 -eq 0 \ + -a $result3 -eq 0 -a $result4 -eq 0 \ + -a $result5 -eq 0 ; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/misc-1 b/dmake/tests/misc-1 new file mode 100755 index 000000000000..5b4f581afda4 --- /dev/null +++ b/dmake/tests/misc-1 @@ -0,0 +1,35 @@ +#!/bin/sh + +# 04.06.2005 Volker Quetschke +# Test for a bug that dmake complained about a continuation char followed +# by a newline. This could happen if \<nl> was used in an imported +# environment variable. +# This bug was <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=310107?> + +: ${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 ( $ -> \$ ). +# Also quote line continuations ( \<nl> -> \\<nl> ). +cat > $file1 <<EOT +# Testing continuation char in recipes +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce +.IMPORT : MYMACRO +all: + +echo "\$(MYMACRO)" + +EOT + +MYMACRO=`echo 'aa\\\\\naa'` ;export MYMACRO; ${DMAKEPROG} -r -f $file1 +result=$? + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result + diff --git a/dmake/tests/misc-10 b/dmake/tests/misc-10 new file mode 100755 index 000000000000..42d2bea5bfba --- /dev/null +++ b/dmake/tests/misc-10 @@ -0,0 +1,41 @@ +#!/bin/sh + +# 10.05.2006 Volker Quetschke +# A comparison with the empty string crashes dmake. +# (issue 65182/65281) + +: ${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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +MYVAR= + +all: +.IF \$(MYVAR) >= "122" + +@echo "true" +.ELSE + +@echo "false" +.ENDIF + +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? + +if test "$output" != "false"; then + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-11 b/dmake/tests/misc-11 new file mode 100755 index 000000000000..93829497474c --- /dev/null +++ b/dmake/tests/misc-11 @@ -0,0 +1,42 @@ +#!/bin/sh + +# 16.06.2006 Volker Quetschke +# A comparison with the empty string crashes dmake - equality test with empty +# string must work too. +# (issue 65281) + +: ${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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +RHS= + +all: +.IF \$(LHS) == \$(RHS) + +@echo "true" +.ELSE + +@echo "false" +.ENDIF + +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? + +if test "$output" != "true"; then + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-12 b/dmake/tests/misc-12 new file mode 100755 index 000000000000..f8e4f7a1dcdb --- /dev/null +++ b/dmake/tests/misc-12 @@ -0,0 +1,40 @@ +#!/bin/sh + +# 22.06.2006 Volker Quetschke +# Conditional expressions failed before with line continuations. +# (issue 66659) + +: ${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 ( $ -> \$ ). +# Also quote line continuations ( \<nl> -> \\<nl> ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all: +.IF "a" == "a" && \\ + "b" == "b" + @+echo OK +.ELSE + @+echo WRONG +.ENDIF +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? + +if test "$output" != "OK"; then + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-13 b/dmake/tests/misc-13 new file mode 100755 index 000000000000..7493e744b6b6 --- /dev/null +++ b/dmake/tests/misc-13 @@ -0,0 +1,51 @@ +#!/bin/sh + +# 29.09.2006 Volker Quetschke +# Check if the directory cache can be made case insensitive +# (issue 69814) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="TeSt.target" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles + +echo "Something" > $file2 + +# Remember to quote variables in generated makefiles ( $ -> \$ ). +# Also quote line continuations ( \<nl> -> \\<nl> ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.DIRCACHE=yes + +# Only test the directory cache for case insensitivity if the FS is also +# case insensitive. +.IF "\$(.DIRCACHERESPCASE)"!="y" +test.target : + @echo "Building \$@" + +.ELSE +TeSt.target : + @echo "Building \$@" + +.ENDIF + +EOT + +output=`eval ${DMAKEPROG} -vm -r -f $file1` +result=$? + +if echo "$output" | grep -v ".target' is up to date" > /dev/null 2>&1 ; then + echo "Wrong result: ${output}" + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-14 b/dmake/tests/misc-14 new file mode 100755 index 000000000000..6f71b373c2df --- /dev/null +++ b/dmake/tests/misc-14 @@ -0,0 +1,44 @@ +#!/bin/sh + +# 07.10.2006 Volker Quetschke +# Check if the line of the error is issued +# (issue 70027) + +: ${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 ( $ -> \$ ). +# Also quote line continuations ( \<nl> -> \\<nl> ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + +echo allA + +all : + +echo allB +EOT + +output=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result=$? + +if echo "$output" | grep 'line .: Error: --' > /dev/null 2>&1 ; then + dummy=1 + result=0 + # OK +else + echo "Test 1: Wrong result: $output" + echo + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-15 b/dmake/tests/misc-15 new file mode 100755 index 000000000000..a213c2d885af --- /dev/null +++ b/dmake/tests/misc-15 @@ -0,0 +1,53 @@ +#!/bin/sh + +# 09.11.2006 Volker Quetschke +# Check DOS style paths and directory caching with cygwin dmake or just +# normal paths with other versions. +# issue 69742, 69943 + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="target.abc" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles + +echo "Something" > $file2 + +# Remember to quote variables in generated makefiles ( $ -> \$ ). +# Also quote line continuations ( \<nl> -> \\<nl> ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.DIRCACHE=yes + +# Test if .SETDIR works with drive letters +.IF "\$(subst,Cygwin, \$(shell @uname))"!="\$(shell @uname)" +MYTARGET:=\$(shell @+cygpath -d "\$(PWD)")\target.abc +.ELSE +MYTARGET:=\$(PWD)/target.abc +.ENDIF + +"\$(MYTARGET)" : + @echo "Building \$@ - \$(MYTARGET)" + +EOT + +output=`eval ${DMAKEPROG} -vm -r -f $file1` +result=$? + +if echo "$output" | grep "target.abc' is up to date" > /dev/null 2>&1 ; then + # OK + dummy=1 +else + echo "Wrong result: ${output}" + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-16 b/dmake/tests/misc-16 new file mode 100755 index 000000000000..2e234d3d15a1 --- /dev/null +++ b/dmake/tests/misc-16 @@ -0,0 +1,48 @@ +#!/bin/sh + +# 17.11.2006 Volker Quetschke +# Check that parallel builds $(shell ...) only waits its own target and +# not for all previous recipe lines. +# (issue 61856) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mytarget.dpcc" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : all1 all2 + @+echo all + +all1 : + @+printf "1" + @+sleep 2 + @+printf "4" + +all2 : + @+sleep 1 + @+printf "2" + @+printf "\$(shell @+echo "3")" + +EOT + +output=`eval ${DMAKEPROG} -r -P2 -f $file1` +result=$? + +if test "$output" != "1234all"; then + echo "Wrong result: $output - expecting: 1234all" + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-17 b/dmake/tests/misc-17 new file mode 100755 index 000000000000..158b11575752 --- /dev/null +++ b/dmake/tests/misc-17 @@ -0,0 +1,42 @@ +#!/bin/sh + +# 19.11.2006 Volker Quetschke +# Check that a global .SEQUENTIAL attribute enforces MAXPROCESS=1. +# (issue 71704) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="my.inc" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +cat > $file1 <<EOT +SHELL=/bin/sh +SHELLFLAGS=-c + +my.inc : + @+echo "MYMAXPROCESS!:=\$(MAXPROCESS)" > my.inc + +.INCLUDE : my.inc + +all: + @+echo "MYMAXPROCESS:\$(MYMAXPROCESS):" + +EOT + +output=`eval ${DMAKEPROG} -S -P2 -rf $file1 all` +result=$? + +if test "$output" != "MYMAXPROCESS:1:"; then + echo "Wrong result: $output - expecting: MYMAXPROCESS:1:" + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-18 b/dmake/tests/misc-18 new file mode 100755 index 000000000000..a676df6580e2 --- /dev/null +++ b/dmake/tests/misc-18 @@ -0,0 +1,169 @@ +#!/bin/sh + +# 23.03.2007 Volker Quetschke +# Test .WINPATH attribute (A cygwin only attribute that is ignored +# elsewhere). +# (issue 73499) + +: ${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 .WINPATH is accepted as global attribute +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.WINPATH : + +all : + @echo OK1 + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test "$output1" != "OK1"; then + echo "Subtest 1: Wrong result: $output1" + result1=1 +else + echo "Subtest 1: OK" +fi + +# Test 2 - Test if .WINPATH is accepted as local attribute +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all .WINPATH : + @echo OK2 + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1` +result2=$? +if test "$output2" != "OK2"; then + echo "Subtest 2: Wrong result: $output2" + result2=1 +else + echo "Subtest 2: OK" +fi + + +# Test 3 - Test if $@ and $* are DOSified. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +/tmp/blah.xx .WINPATH : + @echo at:\$@:star:\$*: + +EOT + +if test x`uname -o 2> /dev/null` = "xCygwin"; then + output3=`eval ${DMAKEPROG} -r -f $file1` + result3=$? + if test "$output3" != "at:`cygpath -m /tmp/blah.xx`:star:`cygpath -m /tmp/blah`:"; then + echo "Subtest : Wrong result: $output3" + result3=1 + else + echo "Subtest 3: OK" + fi +else + echo "Subtest 3 ignored for non cygwin environment" + result3=0 +fi + + +# Test 4 - Test if $(PWD), $(MAKEDIR) are DOSified. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all .WINPATH .SETDIR=/tmp : + @echo :\$(PWD):\$(MAKEDIR): + +EOT + +if test x`uname -o 2> /dev/null` = "xCygwin"; then + output4=`eval ${DMAKEPROG} -r -f $file1` + result4=$? + mypwd=`pwd` + if test "$output4" != ":`cygpath -m /tmp`:`cygpath -m $mypwd`:"; then + echo "Subtest : Wrong result: $output4" + result4=1 + else + echo "Subtest 4: OK" + fi +else + echo "Subtest 4 ignored for non cygwin environment" + result4=0 +fi + + +# Test 5 - Test if $(TMD) is DOSified (if it is an absolute path). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all .WINPATH .SETDIR=/ : + @echo :\$(PWD):\$(TMD): + +EOT + +if test x`uname -o 2> /dev/null` = "xCygwin"; then + output5=`eval ${DMAKEPROG} -r -f $file1` + result5=$? + mypwd=`pwd` + if test "$output5" != ":`cygpath -m /`:`cygpath -m $mypwd`:"; then + echo "Subtest : Wrong result: $output5" + result5=1 + else + echo "Subtest 5: OK" + fi +else + echo "Subtest 5 ignored for non cygwin environment" + result5=0 +fi + + +# Test 6 - Test if .WINPATH changes $@ in conditional macro. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +/tmp/all.bla ?= QQQ=\$@ +/tmp/all.bla .WINPATH : + @echo :\$(QQQ): +EOT + +if test x`uname -o 2> /dev/null` = "xCygwin"; then + output6=`eval ${DMAKEPROG} -r -f $file1` + result6=$? + if test "$output6" != ":`cygpath -m /tmp/all.bla`:"; then + echo "Subtest : Wrong result: $output6" + result6=1 + else + echo "Subtest 6: OK" + fi +else + echo "Subtest 6 ignored for non cygwin environment" + result6=0 +fi + + +if test $result1 -eq 0 -a $result2 -eq 0 \ + -a $result3 -eq 0 -a $result4 -eq 0 \ + -a $result5 -eq 0 -a $result6 -eq 0; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/misc-19 b/dmake/tests/misc-19 new file mode 100755 index 000000000000..af824571219d --- /dev/null +++ b/dmake/tests/misc-19 @@ -0,0 +1,45 @@ +#!/bin/sh + +# 02.09.2007 Volker Quetschke +# Check that temporary filenames are kept alive between recipe lines. +# (issue 67911) + +: ${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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + @noop \$(assign TMPFILE:=\$(mktmp abcd)) + @cat \$(TMPFILE) + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test $result1 = 0 -a "$output1" = "abcd"; then + echo "OK" +else + echo "Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/misc-2 b/dmake/tests/misc-2 new file mode 100755 index 000000000000..06748dd98037 --- /dev/null +++ b/dmake/tests/misc-2 @@ -0,0 +1,40 @@ +#!/bin/sh + +# 01.09.2005 Volker Quetschke +# Tests if dmake can work with makefiles with DOS lineendings. +# (issue 52238) + +: ${DMAKEPROG:=dmake} +file1="mymakefile.mk" +file2="mymakefile_dos.mk" +tmpfiles="$file1 $file2" + +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 continuation char in recipes +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.NOTABS !:= yes + +all: + + echo aaa + +EOT + +#more compatible version of: unix2dos $file1 +: ${AWK:=awk} +#$AWK 'sub("$", "\r")' $file1 > $file2 +$AWK '{print $0"\r"}' $file1 > $file2 + +${DMAKEPROG} -r -f $file2 +result=$? + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-20 b/dmake/tests/misc-20 new file mode 100755 index 000000000000..c25bf05d8342 --- /dev/null +++ b/dmake/tests/misc-20 @@ -0,0 +1,121 @@ +#!/bin/sh + +# 16.09.2007 Volker Quetschke +# Check that inferred makefiles for .INCLUDE do not disturb the dependency +# checking afterwards. +# (issue 81296) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="my.c" +file3="my.obj" +file4="my.foo" +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 - from testcase t_81296_5.mk +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +# Test that my.c is build when my.foo is newer. + +# rules.mk --- +%.obj : %.c ; @+printf "\$@:" +# @sleep 1 + @touch \$@ + +%.dpo : %.c ; @+printf "incbuild:\$@:" +# @sleep 1 + +# target.mk --- +all : my.obj ; @echo all + +# If the file exist no inference is done for it. +.INCLUDE .IGNORE : my.dpo + +# When inference was run on the %.dpo with an existing +# %.c these rule gets ignored. +# local makefile.mk --- +%.c : %.foo ; @+printf "\$@:" +# @sleep 1 + @touch \$@ +EOT + +# Create test environment +touch my.c +sleep 1 +touch my.foo + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test $result1 = 0 -a "$output1" = "incbuild:my.dpo:my.c:my.obj:all"; then + echo "Subtest 1: OK" +else + echo "Subtest 1: Wrong result: $output1" + echo + result1=1 +fi + +# Remove files from prior run +rm -rf $tmpfiles +# Remember to quote variables in generated makefiles( $ -> \$ ). +# Test 2 - from testcase t_81296_6.mk +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +# Test that no circular dependency error is issued: +# $ rm -f my.* ; touch my.c ; ./dmake/dmake.exe -rf t_81296_6.mk + +# rules.mk --- +%.obj : %.c ; @+printf "\$@:" + @touch \$@ + +%.dpo : %.c ; @+printf "incbuild:\$@:" + +# target.mk --- +all : my.obj ; @echo all + +# If the file exist no inference is done for it. +.INCLUDE .IGNORE : my.dpo + +%.c : %.foo ; @+printf "\$@:" + @touch \$@ + +# This leads to a (wrong) circular dependency error +my.obj : my.c + +EOT + +# Create test environment +touch my.c +sleep 1 +touch my.foo + +output2=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result2=$? + +if test $result2 = 0 -a "$output2" = "incbuild:my.dpo:my.c:my.obj:all"; then + echo "Subtest 2: OK" +else + echo "Subtest 2: Wrong result: $output2" + echo + result2=1 +fi + + +if test $result1 -eq 0 -a $result2 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/misc-21 b/dmake/tests/misc-21 new file mode 100755 index 000000000000..9dea6cc234a2 --- /dev/null +++ b/dmake/tests/misc-21 @@ -0,0 +1,41 @@ +#!/bin/sh + +# 13.10.2007 Volker Quetschke +# Check that SHELLCMDQUOTE adds the characters to the command. +# issue 81252 + +: ${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 ( $ -> \$ ). +cat > $file1 <<EOT +SHELL!:=printf +SHELLFLAGS!:= + +SHELLCMDQUOTE=X + +all : + @+testtest + +EOT + +output=`eval ${DMAKEPROG} -rf $file1` +result=$? + +if test "$result" = "0" && test "$output" = "XtesttestX" ; then + # OK + dummy=1 +else + echo "Wrong result: ${output}" + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-3 b/dmake/tests/misc-3 new file mode 100755 index 000000000000..acd7ce4822b4 --- /dev/null +++ b/dmake/tests/misc-3 @@ -0,0 +1,44 @@ +#!/bin/sh + +# 17.09.2005 Volker Quetschke +# Test for line continuation in comments. +# (issue 49461) + +: ${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 continuation char in recipes +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +AAA:=aaa + +# A continued comment line followed/ended by an empty line \ + +AAA+=bbb + +all: + +@echo \$(AAA) + +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? + +# The space between aaa and bbb comes from the += +if test "$output" != "aaa bbb"; then + echo "Wrong result" + result=1 +fi + + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-4 b/dmake/tests/misc-4 new file mode 100755 index 000000000000..ed11a8e20098 --- /dev/null +++ b/dmake/tests/misc-4 @@ -0,0 +1,62 @@ +#!/bin/sh + +# 06.10.2005 Volker Quetschke +# Test for parallel operation. +# (no issue, sanity check only) + +: ${DMAKEPROG:=dmake} +file1="mymakefile.mk" +file2="testfile" +file3="testfile1" +file4="testfile2" +file5="testfile3" +tmpfiles="$file1 $file2 $file3 $file4 $file5" + +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( $ -> \$ ). +cat > $file1 <<EOT +# Testing parallel execution +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +testfile : testfile2 testfile3 testfile1 + +@echo xx > \$@ + +testfile1 : + +@echo making \$@ 1>&2 + +@sleep 1 + +@printf t1 + +@echo 1 > \$@ + +testfile2 : + +@echo making \$@ 1>&2 + +@sleep 2 + +@printf t2 + +@echo 2 > \$@ + +testfile3 : + +@echo making \$@ 1>&2 + +@sleep 3 + +@printf t3 + +@echo 3 > \$@ + +EOT + +output=`eval ${DMAKEPROG} -r -P3 -f $file1` +result=$? + +# In parallel operation the targets with the smaller sleep value +# will finish first. +if test "$output" != "t1t2t3"; then + echo "Wrong result" + result=1 +fi + + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-5 b/dmake/tests/misc-5 new file mode 100755 index 000000000000..5c458482d7c7 --- /dev/null +++ b/dmake/tests/misc-5 @@ -0,0 +1,49 @@ +#!/bin/sh + +# 06.10.2005 Volker Quetschke +# Test if infered makefile generation works. +# (issue 54938) + +: ${DMAKEPROG:=dmake} +file1="mymakefile.mk" +file2="incfile.mk" +file3="incfiledepend" +tmpfiles="$file1 $file2 $file3" + +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( $ -> \$ ). +cat > $file1 <<EOT +# Verify that makefile generation is finished when using it +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +incfile.mk : incfiledepend + +@echo AA:=123 > \$@ + +incfiledepend : + +@sleep 1 + +@echo 1234 > \$@ + +.INCLUDE : incfile.mk + +all : + +@echo aa:\$(AA):bb +EOT + +output=`eval ${DMAKEPROG} -r -P2 -f $file1 all` +result=$? + +# The space between aaa and bbb comes from the += +if test "$output" != "aa:123:bb"; then + echo "Wrong result" + result=1 +fi + + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/misc-6 b/dmake/tests/misc-6 new file mode 100755 index 000000000000..9f74f1e77cc6 --- /dev/null +++ b/dmake/tests/misc-6 @@ -0,0 +1,65 @@ +#!/bin/sh + +# 05.01.2006 Volker Quetschke +# Old dmakes throw a segmentation fault in special cases with +# dynamic prerequisits ( $$@ ). +# (issue 58259) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mfile2.mk" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +# Testcase 1 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : allA allB + +all : \$\$@A \$\$@B + +allA : + +echo XaX + +allB : + +echo XbX +EOT + +# Testcase 2 +cat > $file2 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : \$\$@A \$\$@B + +all : allA allB + +allA : + +echo XaX + +allB : + +echo XbX +EOT + +${DMAKEPROG} -r -f $file1 >/dev/null 2>&1 +result1=$? +${DMAKEPROG} -r -f $file2 >/dev/null 2>&1 +result2=$? + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -f ${tmpfiles} + result=0 +else + test $result1 -ne 0 && echo "Failure in testcase 1! Remove the corefile!" + test $result2 -ne 0 && echo "Failure in testcase 2! Remove the corefile!" + result=1 +fi +exit $result diff --git a/dmake/tests/misc-7 b/dmake/tests/misc-7 new file mode 100755 index 000000000000..285f44d50e81 --- /dev/null +++ b/dmake/tests/misc-7 @@ -0,0 +1,47 @@ +#!/bin/sh + +# 06.02.2006 Volker Quetschke +# Verify that the .SETDIR attribute works separately from the target +# definition. (issue 61714) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="subdir" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.SETDIR=subdir : all + +all : + @+echo ":\$(PWD:f):" + +EOT + +mkdir -p "$file2" + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? + +if test "$output1" != ":$file2:"; then + echo "Wrong result - use of .SETDIR was not successful." + result1=1 +fi + +if test $result1 -eq 0; then + echo "Success - Cleaning up" + rm -rf ${tmpfiles} + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/misc-8 b/dmake/tests/misc-8 new file mode 100755 index 000000000000..28d27595ab84 --- /dev/null +++ b/dmake/tests/misc-8 @@ -0,0 +1,39 @@ +#!/bin/sh + +# 26.02.2006 Volker Quetschke +# Test if dmake complains about circular dependencies when using +# infered .INCLUDE targets +# (issue 62118) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mytarget.dpcc" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +cat > $file1 <<EOT +# Verify that makefile generation is finished when using it +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.dpcc : + @echo making: \$@ + @+echo AA=123 > \$@ + +.INCLUDE : mytarget.dpcc + +ALL : mytarget.dpcc + +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure! Invalid circular dependency detected." +exit $result diff --git a/dmake/tests/misc-9 b/dmake/tests/misc-9 new file mode 100755 index 000000000000..c3f8aad1ab39 --- /dev/null +++ b/dmake/tests/misc-9 @@ -0,0 +1,53 @@ +#!/bin/sh + +# 01.03.2006 Volker Quetschke +# If a dependency is added to a target after it is already build as an +# indered .INCLUDE makefile the new dependency can be lost in parallel +# builds. +# (issue 61969) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mytarget.dpcc" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.dpcc : + @sleep 1 +# The following line adds a dependency to %.obj when the %.dpcc is included + @+echo \$@ : \$(@:b).obj > \$@ + +# This has to be build if mytarget.dpcc is included and is requested +# as a target +# Adding the wait makes sure that the unpatched dmake is ended before the +# next recipe line is started, therefore loosing it. +%.obj : + @sleep 1 + @echo making: \$@ + +.INCLUDE : mytarget.dpcc + +# Make this the main target +mytarget.dpcc : + +EOT + +output=`eval ${DMAKEPROG} -r -P2 -f $file1` +result=$? + +if test "$output" != "making: mytarget.obj"; then + result=1 +fi + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure! Recipe line got lost." +exit $result diff --git a/dmake/tests/recipes-1 b/dmake/tests/recipes-1 new file mode 100755 index 000000000000..c9108d86198f --- /dev/null +++ b/dmake/tests/recipes-1 @@ -0,0 +1,38 @@ +#!/bin/sh + +# 01.06.2005 Volker Quetschke +# Tests for line continuation in recipes. +# (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 continuation char in recipes +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all: + +@echo line1\ +line2 + +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? +if test "$output" != "line1line2"; then + echo "Wrong result" + result=1 +fi + + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result + diff --git a/dmake/tests/recipes-2 b/dmake/tests/recipes-2 new file mode 100755 index 000000000000..3e31fa1eb619 --- /dev/null +++ b/dmake/tests/recipes-2 @@ -0,0 +1,41 @@ +#!/bin/sh + +# 24.07.2006 Volker Quetschke +# Simple tests for group recipes. +# (issue 64583) + +: ${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 +# Test group recipes +SHELL:=/bin/sh +SHELLFLAGS:=-ce +GROUPSHELL:=/bin/sh +GROUPSUFFIX:=.sh + +all : +@[ + printf "line1" + printf "line2" +] +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? +if test "$output" != "line1line2"; then + echo "Wrong result: $output" + result=1 +fi + + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result + diff --git a/dmake/tests/recipes-3 b/dmake/tests/recipes-3 new file mode 100755 index 000000000000..a4e4a24b6653 --- /dev/null +++ b/dmake/tests/recipes-3 @@ -0,0 +1,40 @@ +#!/bin/sh + +# 29.07.2006 Volker Quetschke +# Test builtin commands. +# (issue 67589) + +: ${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 +# Test noop and empty lines +SHELL:=/bin/sh +SHELLFLAGS:=-ce + +all : + \$(NULL) + +\$(NULL) + @noop bla bla \$(assign NOSHELL:=ABC) + @+noop bla bla \$(assign WITHSHELL:=DEF) + @echo \$(NOSHELL)\$(WITHSHELL) + +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? +if test "$output" != "ABCDEF"; then + echo "Wrong result: $output" + result=1 +fi + + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/recipes-4 b/dmake/tests/recipes-4 new file mode 100755 index 000000000000..378a2b4fa372 --- /dev/null +++ b/dmake/tests/recipes-4 @@ -0,0 +1,38 @@ +#!/bin/sh + +# 29.07.2006 Volker Quetschke +# Test builtin echo command. +# (issue 67589) + +: ${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 +# internal echo - This test might fail later if the internal echo ever +# learns to handle quotes. +SHELL:=/bin/sh +SHELLFLAGS:=-ce + +all : + @echo -n "AB CD" + @+echo XY + +EOT + +output=`eval ${DMAKEPROG} -r -f $file1` +result=$? +if test "$output" != "\"AB CD\"XY"; then + echo "Wrong result: $output" + result=1 +fi + + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/recipes-5 b/dmake/tests/recipes-5 new file mode 100755 index 000000000000..b8887212a272 --- /dev/null +++ b/dmake/tests/recipes-5 @@ -0,0 +1,62 @@ +#!/bin/sh + +# 13.11.2006 Volker Quetschke +# Test @@ recipe property. +# (issue 71422) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="ofile1.out" +tmpfiles="$file1 $file2" + +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 +# Test @@ recipe +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + @@+echo someoutput > $file2 + @@+echo something +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test "$output1" != ""; then + echo "Wrong result: $output1" + result1=1 +fi +if test -f $file2; then + if test `cat $file2 ` != "someoutput"; then + echo "Wrong file content: `cat $file2`" + result1=1 + fi +else + echo "No such file : $file2" + result1=1 +fi + +# Test if -vr enables the output again +output2=`eval ${DMAKEPROG} -vr -rf $file1` +result2=$? +if echo $output2 | grep -v 'echo someoutput > ofile1.out'; then + echo "Missing output: echo someoutput > ofile1.out" + result2=1 +fi +if echo $output2 | grep -v 'something'; then + echo "Missing output: something" + result2=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -f ${tmpfiles} + exit 0 +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/recipes-6 b/dmake/tests/recipes-6 new file mode 100755 index 000000000000..2a0af305ef6a --- /dev/null +++ b/dmake/tests/recipes-6 @@ -0,0 +1,66 @@ +#!/bin/sh + +# 13.11.2006 Volker Quetschke +# Test @@ recipe property with group recipes. +# (issue 71422) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="ofile1.out" +tmpfiles="$file1 $file2" + +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 +# Test @@ recipe +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce +GROUPSHELL*:=/bin/sh +GROUPSUFFIX:=.sh + +all : +@@[ + echo someoutput > $file2 + echo something +] +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1` +result1=$? +if test "$output1" != ""; then + echo "Wrong result: $output1" + result1=1 +fi +if test -f $file2; then + if test `cat $file2` != "someoutput"; then + echo "Wrong file content: `cat $file2`" + result1=1 + fi +else + echo "No such file : $file2" + result1=1 +fi + +# Test if -vr enables the output again +output2=`eval ${DMAKEPROG} -vr -rf $file1` +result2=$? +if echo $output2 | grep -v 'echo someoutput > ofile1.out'; then + echo "Missing output: echo someoutput > ofile1.out" + result2=1 +fi +if echo $output2 | grep -v 'something'; then + echo "Missing output: something" + result2=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -f ${tmpfiles} + exit 0 +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/recipes-7 b/dmake/tests/recipes-7 new file mode 100755 index 000000000000..3a932bb597b0 --- /dev/null +++ b/dmake/tests/recipes-7 @@ -0,0 +1,38 @@ +#!/bin/sh + +# 01.12.2006 Volker Quetschke +# Test that the '-' recipe switch is honored. +# (issue 72210) + +: ${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 +# internal echo - This test might fail later if the internal echo ever +# learns to handle quotes. +SHELL:=/bin/sh +SHELLFLAGS:=-ce + +all : + @-blabla + @echo OK + +EOT + +output=`eval ${DMAKEPROG} -r -f $file1 2> /dev/null` +result=$? +if test $result -eq 0 -a "$output" != "OK"; then + echo "Wrong result: $output" + result=1 +fi + + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result diff --git a/dmake/tests/recipes-8 b/dmake/tests/recipes-8 new file mode 100755 index 000000000000..b4264a33df0c --- /dev/null +++ b/dmake/tests/recipes-8 @@ -0,0 +1,104 @@ +#!/bin/sh + +# 08.08.2007 Volker Quetschke +# Test group recipes syntax check. +# (issue 67709) + +: ${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 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce +GROUPSHELL*:=/bin/sh + +all : +[ This should warn! + @echo "Group recipe line" +] + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result1=$? + +if test $result1 != 0 && echo $output1 | grep 'Warning: -- Found non-white space character after' > /dev/null 2>&1 ; then + echo "Subtest 1: OK" + result1=0 +else + echo "Subtest 1: Wrong result: $output1" + echo + result1=1 +fi + + +# Test 2 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce +GROUPSHELL*:=/bin/sh + +all : + echo hallo +[ + echo "Group recipe line" +] + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result2=$? + +if test $result2 != 0 && echo $output2 | grep 'Error: -- Cannot mix single and group recipe lines.' > /dev/null 2>&1 ; then + echo "Subtest 2: OK" + result2=0 +else + echo "Subtest 2: Wrong result: $output2" + echo + result2=1 +fi + + +# Test 3 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce +GROUPSHELL*:=/bin/sh + +all : +[ + [ + echo "Group recipe line" +] + +EOT + +output3=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result3=$? +if test $result3 != 0 && echo $output3 | grep 'Error: -- New group recipe begin found within group recipe.' > /dev/null 2>&1 ; then + echo "Subtest 3: OK" + result3=0 +else + echo "Subtest 3: Wrong result: $output3" + echo + result3=1 +fi + + + +if test $result1 -eq 0 -a $result2 -eq 0 \ + -a $result3 -eq 0 ; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/recipes-9 b/dmake/tests/recipes-9 new file mode 100755 index 000000000000..409b6cbabe33 --- /dev/null +++ b/dmake/tests/recipes-9 @@ -0,0 +1,117 @@ +#!/bin/sh + +# 11.08.2007 Volker Quetschke +# Test that recipes with error can be ignored. +# (issue 80598) + +: ${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 - Ignore, but display failed execution. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all .IGNORE : + tttouch all + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result1=$? + +if test "$result1" = "0" && echo $output1 | grep '(Ignored)' > /dev/null 2>&1 ; then + echo "Subtest 1: OK" + result1=0 +else + echo "Subtest 1: Wrong result: $output1" + echo + result1=1 +fi + + +# Test 2 - Ignore, but display failed execution. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + -ttttouch all + +EOT + +output2=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result2=$? + +if test "$result2" = "0" && echo $output2 | grep '(Ignored)' > /dev/null 2>&1 ; then + echo "Subtest 2: OK" + result2=0 +else + echo "Subtest 2: Wrong result: $output2" + echo + result2=1 +fi + + +# Test 3 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce +GROUPSHELL*:=/bin/sh + +all : + ttttouch all + +EOT + +output3=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result3=$? +if test $result3 != 0 && echo $output3 | grep 'Error code -1, while making ' > /dev/null 2>&1 ; then + echo "Subtest 3: OK" + result3=0 +else + echo "Subtest 3: Wrong result: $output3" + echo + result3=1 +fi + + +# Test 4 - Ignore a succesfully executed, but failing recipe. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + -false all + +EOT + +output4=`eval ${DMAKEPROG} -r -f $file1 2>&1` +result4=$? + +if test "$result4" = "0" -a "$output4" = "false all" ; 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 -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-1 b/dmake/tests/targets-1 new file mode 100644 index 000000000000..688c33cf024b --- /dev/null +++ b/dmake/tests/targets-1 @@ -0,0 +1,78 @@ +#!/bin/sh + +# 03.06.2006 Volker Quetschke +# Percent target definitions were not handled properly before. +# (issue 64869) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mfile2.mk" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +# Testcase 1 - This segfaulted before 4.5 +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +allnew : all + +%.x all : %.c + +true $@ + +qqq.c : + +echo OK + +EOT + +# Testcase 2 - earlier than dmake 4.5 the second %-target was defined +# without the prerequisites, i.e. qqq.c was not build +cat > $file2 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +allnew : qqq.y + +%.x %.y : %.c + +true "building %.y" + +qqq.c : + +echo building qqq.c + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? +output2=`eval ${DMAKEPROG} -r -f $file2 2>&1 ` +result2=$? + +if echo $output1 | grep 'Error: -- A non-%' > /dev/null 2>&1 ; then + #echo "Test 1: Right result: $output1" + result1=0 +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if echo $output2 | grep -v 'building qqq.c' > /dev/null 2>&1 ; then + echo "Test 2: Wrong result: $output2" + echo + result2=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-10 b/dmake/tests/targets-10 new file mode 100644 index 000000000000..3f7931242b02 --- /dev/null +++ b/dmake/tests/targets-10 @@ -0,0 +1,50 @@ +#!/bin/sh + +# 14.06.2006 Volker Quetschke +# If %-targets are defined with more than one (not indirect) prerequisite +# only the first is used. This is supposed to be fixed at one point but +# currently we issue a warning that it not working (yet). +# (issue 48087) + +: ${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( $ -> \$ ). +# Check that we warn. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.xx : %.yy %.pp ; touch $@ + +abc.xx : ; echo nix + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? + +if echo $output1 | grep 'Warning: -- More than one prerequisite' > /dev/null 2>&1 ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-11 b/dmake/tests/targets-11 new file mode 100644 index 000000000000..5dbff149d806 --- /dev/null +++ b/dmake/tests/targets-11 @@ -0,0 +1,38 @@ +#!/bin/sh + +# 09.07.2006 Volker Quetschke +# If %-targets are defined with the .SILENT attribute and the -vr verbose +# flag is used dmake 4.5 stops falsely with an error. +# (issue 67025) + +: ${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( $ -> \$ ). +# Check that we don't issue an error. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.xx .SILENT : + +echo "OK" +EOT + +output1=`eval ${DMAKEPROG} -vr -rf $file1 all.xx 2>&1 ` +result1=$? + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure! dmake failed with error." + result=1 +fi +exit $result diff --git a/dmake/tests/targets-12 b/dmake/tests/targets-12 new file mode 100644 index 000000000000..ba9982c4f6be --- /dev/null +++ b/dmake/tests/targets-12 @@ -0,0 +1,47 @@ +#!/bin/sh + +# 10.07.2006 Volker Quetschke +# Check that dmake warns if it encounters .SUFFIXES +# (issue 66567) + +: ${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( $ -> \$ ). +# Check that we issue a warning. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.SUFFIXES : .aa .bb + +all: ; @echo OK +EOT + +output1=`eval ${DMAKEPROG} -vw -rf $file1 2>&1 ` +result1=$? + +if echo $output1 | grep 'Warning: -- The .SUFFIXES' > /dev/null 2>&1 ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure! dmake failed to issue a warning." + result=1 +fi +exit $result diff --git a/dmake/tests/targets-13 b/dmake/tests/targets-13 new file mode 100755 index 000000000000..702a9b0a10ca --- /dev/null +++ b/dmake/tests/targets-13 @@ -0,0 +1,49 @@ +#!/bin/sh + +# 16.07.2006 Volker Quetschke +# Check that dmake warns if a previously unset macro (i.e. it is +# assumed to be empty) is used and later set to a different value. +# (issue 67166) + +: ${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( $ -> \$ ). +# Check that we issue a warning. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all: \$(NEWDEP) + @+echo all + +NEWDEP=my_dependency +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if echo $output1 | grep 'Warning: -- Macro .* redefined after use' > /dev/null 2>&1 ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure! dmake failed to issue a warning." + result=1 +fi +exit $result diff --git a/dmake/tests/targets-14 b/dmake/tests/targets-14 new file mode 100755 index 000000000000..7e1fae45f8d4 --- /dev/null +++ b/dmake/tests/targets-14 @@ -0,0 +1,53 @@ +#!/bin/sh + +# 16.07.2006 Volker Quetschke +# Check that evaluating an empty macro and thereby initializing it does not +# prevent the *= and *:= operator from assigning a new value. +# (issue 67166) + +: ${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( $ -> \$ ). +# Check that we set AAA to set_AAA. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.IF \$(AAA)!=321 +BLA=bla +.ENDIF + +AAA*=set_AAA + +all: + @+echo "\$(AAA)" +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test $output1 = "set_AAA" ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure! Unexpected result." + result=1 +fi +exit $result diff --git a/dmake/tests/targets-15 b/dmake/tests/targets-15 new file mode 100755 index 000000000000..6a5310a6e4b0 --- /dev/null +++ b/dmake/tests/targets-15 @@ -0,0 +1,56 @@ +#!/bin/sh + +# 06.10.2006 Volker Quetschke +# Check that normalized targets are treated as equal. +# (issue 69742) + +: ${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( $ -> \$ ). +# Check that we set AAA to set_AAA. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +# On cygwin add c:/temp/try5.xx to the prerequisites to test cygwin related +# normalization +all : try1.xx try2.xx ../..//d/try3.xx xxx//yyy/../../try4.xx +# c:/temp/try5.xx + echo all + +./try1.xx : + echo try1 + +./././try2.xx : + echo try2 + +../../d/try3.xx : + echo try3 + +./xxx/..////try4.xx : + echo try4 + +/cygdrive/c/temp/try5.xx : + echo try5 + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +else + echo "Failure! dmake reported:" + echo "$output1" +fi +exit $result diff --git a/dmake/tests/targets-16 b/dmake/tests/targets-16 new file mode 100755 index 000000000000..795fb7a63650 --- /dev/null +++ b/dmake/tests/targets-16 @@ -0,0 +1,49 @@ +#!/bin/sh + +# 08.10.2006 Volker Quetschke +# Check that $ in dynamic prerequisites are handled correctly. +# (issue 70168) + +: ${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( $ -> \$ ). +# Check that we set AAA to set_AAA. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +DYNPRQS=a\$\$xx1 a\$\$xx2 + +all : \$\$(DYNPRQS) a\$\$\$\$xx3 + echo all + +a\$\$xx1 : + echo a1:\$@ + +a\$\$xx2 : + echo a2:\$@ + +a\$\$xx3 : + echo a3:\$@ + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +else + echo "Failure! dmake reported:" + echo "$output1" +fi +exit $result diff --git a/dmake/tests/targets-17 b/dmake/tests/targets-17 new file mode 100755 index 000000000000..cea9c633615d --- /dev/null +++ b/dmake/tests/targets-17 @@ -0,0 +1,38 @@ +#!/bin/sh + +# 08.10.2006 Volker Quetschke +# Check that empty dynamic prerequisites are handled correctly. +# (issue 70210) + +: ${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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +EMPTYPRQ= + +all : \$\$(EMPTYPRQ) + echo all +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +else + echo "Failure! dmake reported:" + echo "$output1" +fi +exit $result diff --git a/dmake/tests/targets-18 b/dmake/tests/targets-18 new file mode 100755 index 000000000000..0e75ddb0f55e --- /dev/null +++ b/dmake/tests/targets-18 @@ -0,0 +1,52 @@ +#!/bin/sh + +# 21.06.2007 Volker Quetschke +# Check that OOODMAKEMODE can switches of the ./foo to foo normalization. +# (issue 74007) + +: ${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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.IMPORT : OOODMAKEMODE + +# See if OOODMAKEMODE works +./all : + @echo X\$@Y + +EOT + + +output1=`eval OOODMAKEMODE="" ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? +if test $result1 -ne 0 -o "$output1" != "XallY"; then + echo "Test 1: Wrong result: $output1" + result1=1 +fi + + +output2=`eval OOODMAKEMODE=y ${DMAKEPROG} -rf $file1 2>&1 ` +result2=$? +if test $result2 -ne 0 -o "$output2" != "X./allY"; then + echo "Test 2: Wrong result: $output2" + result2=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit 0 +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-19 b/dmake/tests/targets-19 new file mode 100755 index 000000000000..3ca904f53e8d --- /dev/null +++ b/dmake/tests/targets-19 @@ -0,0 +1,68 @@ +#!/bin/sh + +# 22.06.2007 Volker Quetschke +# Check that multiple leading slashes are normalized. +# (issue 78061) + +: ${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 excess leading slashes get removed +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +////all : + @echo X\$@Y + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? +if test "$output1" != "X/allY"; then + echo "Subtest 1: Wrong result: $output1" + result1=1 +else + echo "Subtest 1: OK" +fi + + +# Test 2 - Test if excess leading slashes in DOS paths get removed +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +"c:////all" .WINPATH : + @echo X\$@Y + +EOT + +if test x`uname -o 2> /dev/null` = "xCygwin"; then + output2=`eval ${DMAKEPROG} -r -f $file1` + result2=$? + if test "$output2" != "Xc:/allY"; then + echo "Subtest 2: Wrong result: $output2" + result2=1 + else + echo "Subtest 2: OK" + fi +else + echo "Subtest 2 ignored for non cygwin environment" + result2=0 +fi + + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" && rm -f ${tmpfiles} + exit +else + echo "Failure!" + exit 1 +fi
\ No newline at end of file diff --git a/dmake/tests/targets-2 b/dmake/tests/targets-2 new file mode 100644 index 000000000000..fbc1b0e39c7c --- /dev/null +++ b/dmake/tests/targets-2 @@ -0,0 +1,70 @@ +#!/bin/sh + +# 03.06.2006 Volker Quetschke +# Percent target definitions were not handled properly before. +# (issue 64869) - Two more testcases + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mfile2.mk" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +# Testcase 1 - %-target prerequisite - syntax error +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.PHONY all : %.c + +true all + +EOT + +# Testcase 2 - The recipe part is ignored - syntax error +cat > $file2 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : + +true all + +.PHONY : all ; +echo no recipe expected + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? +output2=`eval ${DMAKEPROG} -r -f $file2 2>&1 ` +result2=$? + +if echo $output1 | grep 'Error: -- Syntax' > /dev/null 2>&1 ; then + result1=0 +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if echo $output2 | grep 'Error: -- Unexpected recipe' > /dev/null 2>&1 ; then + result2=0 +else + echo "Test 2: Wrong result: $output2" + echo + result1=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-20 b/dmake/tests/targets-20 new file mode 100755 index 000000000000..64a6a5b06ad0 --- /dev/null +++ b/dmake/tests/targets-20 @@ -0,0 +1,65 @@ +#!/bin/sh + +# 12.07.2007 Volker Quetschke +# Make sure that intermediate targets get created. BUG: If an intermediate +# %-target does not exist it inherits the time stamp of it's parent and +# doesn not get made. +# Recipe: Create ptarget.c and then (newer) ptarget.a but ptarget.b did +# not get made. +# (issue 69462) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="ptarget.a" +file3="ptarget.b" +file4="ptarget.c" +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 + +# Create test environment +touch ptarget.c +touch ptarget.a + +# Remember to quote variables in generated makefiles( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.a : %.b + @cp \$< \$@ + +%.b .PRECIOUS : %.c + @cp \$< \$@ + @+printf "OK" + +%.c : + @touch \$@ + +all : ptarget.a + @+echo "done" + + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test "$output1" != "OKdone"; then + echo "Wrong result: $output1" + result1=1 +else + echo "OK" +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-21 b/dmake/tests/targets-21 new file mode 100755 index 000000000000..2aff2285ab69 --- /dev/null +++ b/dmake/tests/targets-21 @@ -0,0 +1,55 @@ +#!/bin/sh + +# 12.07.2007 Volker Quetschke +# Another %-target testcase. +# (issue 78837) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="aaa.aaa" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles + +# Create test environment +touch aaa.aaa + +# Remember to quote variables in generated makefiles( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.aaa : %.bbb + @sleep 1 + @touch \$@ + +%.bbb : + @echo building \$@ + + +all : aaa.aaa + @noop Done + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test "$output1" != "building aaa.bbb"; then + echo "Wrong result: $output1" + result1=1 +else + echo "OK" +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-22 b/dmake/tests/targets-22 new file mode 100755 index 000000000000..14474f09792e --- /dev/null +++ b/dmake/tests/targets-22 @@ -0,0 +1,55 @@ +#!/bin/sh + +# 12.07.2007 Volker Quetschke +# Check that intermediate targets are marked removable. +# (issue 80143) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="aaa.aaa" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles + +# Create test environment +touch aaa.aaa + +# Remember to quote variables in generated makefiles( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.REMOVE : ; @echo remove \$< + +%.a : %.b + @noop $@ + +%.b : + @noop $@ + +all : xx.a + @noop all + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test "$output1" != "remove xx.b"; then + echo "Wrong result: $output1" + result1=1 +else + echo "OK" +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-23 b/dmake/tests/targets-23 new file mode 100755 index 000000000000..ee670d496b34 --- /dev/null +++ b/dmake/tests/targets-23 @@ -0,0 +1,56 @@ +#!/bin/sh + +# 03.08.2007 Volker Quetschke +# Check that a %-target without prereq has precedence over one with +# prerequisite. +# (issue 80144) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="aaa.aaa" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles + +# Create test environment +touch aaa.aaa + +# Remember to quote variables in generated makefiles( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.REMOVE : ; @echo remove \$< + +%.a : %.b + @echo Wrong choice - $@ + +%.a : + @echo Right choice + +all : xx.a + @noop all + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test "$output1" != "Right choice"; then + echo "Wrong result: $output1" + result1=1 +else + echo "OK" +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-24 b/dmake/tests/targets-24 new file mode 100755 index 000000000000..98c7603980fa --- /dev/null +++ b/dmake/tests/targets-24 @@ -0,0 +1,61 @@ +#!/bin/sh + +# 03.08.2007 Volker Quetschke +# Check that ambigous %-target are found. +# prerequisite. +# (issue 80144) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="aaa.aaa" +tmpfiles="$file1 $file2" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +# Remove files from prior failed run +rm -rf $tmpfiles + +# Create test environment +touch aaa.aaa + +# Remember to quote variables in generated makefiles( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.REMOVE : ; @echo remove \$< + +%.a : %.b + @echo Blah + +%.a : xx.b + @echo Blue + +%.b : + touch $@ + +all : xx.a + @noop all + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if echo $output1 | grep ': -- Ambiguous inference chains for target' > /dev/null 2>&1 ; then + echo "OK" +else + echo "Test 1: Wrong result: $output1" + echo + result1=0 +fi + +# Errorcode in $result1 means successfull test +if test $result1 -ne 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-25 b/dmake/tests/targets-25 new file mode 100755 index 000000000000..fa95f655bbb1 --- /dev/null +++ b/dmake/tests/targets-25 @@ -0,0 +1,51 @@ +#!/bin/sh + +# 03.08.2007 Volker Quetschke +# Check that the .PRECIOUS attribute works. +# (issue 80352) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.REMOVE : ; @echo remove \$< + +%.a : %.b + @noop Blah + +%.b .PRECIOUS : + @noop xx.b + +all : xx.a + @echo Done + +EOT + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? + +if test "$output1" != "Done"; then + echo "Wrong result: $output1" + result1=1 +else + echo "OK" +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-26 b/dmake/tests/targets-26 new file mode 100755 index 000000000000..10ac0d43f2b7 --- /dev/null +++ b/dmake/tests/targets-26 @@ -0,0 +1,57 @@ +#!/bin/sh + +# 10.08.2007 Volker Quetschke +# Check that the .PHONY attribute works with %-targets. +# (issue 66751) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="phonyfile.a" +file3="phonyfile.b" +tmpfiles="$file1 $file2 $file3" + +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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.a : %.b + @sleep 1 + @touch \$@ + @+printf " and \$@.\n" + +#%.b : +%.b .PHONY : + @touch \$@ + @+printf "Build \$@" + +EOT + +touch phonyfile.a phonyfile.b +# Avoid that phonyfile.a has the same time stamp as phonyfile.b after +# that has been rebuild. +sleep 1 + +output1=`eval ${DMAKEPROG} -rf $file1 phonyfile.a 2>&1 ` +result1=$? + +if test "$output1" != "Build phonyfile.b and phonyfile.a."; then + echo "Wrong result: $output1" + result1=1 +else + echo "OK" +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-27 b/dmake/tests/targets-27 new file mode 100755 index 000000000000..3ad33b4c20ff --- /dev/null +++ b/dmake/tests/targets-27 @@ -0,0 +1,59 @@ +#!/bin/sh + +# 15.08.2007 Volker Quetschke +# Another check that the .PHONY attribute works with %-targets. This test +# was still failing after issue 66751. +# (issue 80687) + +: ${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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.x : %.y + @sleep 1 + @+printf " and \$@.\n" + @touch \$@ + +aa.y .PHONY : aa.z + @+printf "Build \$@" + @touch \$@ + +EOT + +# Create test environment +touch aa.z; sleep 1; touch aa.y ; sleep 1 ;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 aa.x 2>&1 ` +result1=$? + +if test "$output1" != "Build aa.y and aa.x."; then + echo "Wrong result: $output1" + result1=1 +else + echo "OK" +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-28 b/dmake/tests/targets-28 new file mode 100755 index 000000000000..0943eb6677ff --- /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} -vm -rf $file1 2>&1` +result3=$? + +if test $result3 = 0 && echo "$output3" | grep "aa.x' is up to date" > /dev/null 2>&1 ; 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 diff --git a/dmake/tests/targets-29 b/dmake/tests/targets-29 new file mode 100755 index 000000000000..004553eb93d5 --- /dev/null +++ b/dmake/tests/targets-29 @@ -0,0 +1,59 @@ +#!/bin/sh + +# 24.09.2007 Volker Quetschke +# Check that the .REMOVE target does not crash dmake in parallel builds. +# (issue 80012) + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="aaa.aaa" +file3="aaa.bbb" +file4="aaa.ccc" +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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.REMOVE :; @echo remove intermediate target: \$< + +%.aaa : %.bbb + @echo built \$@ + +%.bbb : %.ccc + @sleep 1 + @echo built \$@ + +%.ccc : + @echo built \$@ + +all : aaa.aaa + @echo Done + +EOT + +output1=`eval ${DMAKEPROG} -P2 -rf $file1 2>&1` +result1=$? + +if test $result1 -ne 0; then + echo "Failure! Remove the corefile!" + echo "Output: $output1" + result1=1 +else + echo "OK" +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-3 b/dmake/tests/targets-3 new file mode 100644 index 000000000000..288dd67f1e25 --- /dev/null +++ b/dmake/tests/targets-3 @@ -0,0 +1,49 @@ +#!/bin/sh + +# 03.06.2006 Volker Quetschke +# .<suffix> targets were silently ignored despite the illegal syntax. +# (issue 65360) + +: ${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( $ -> \$ ). +# Testcase 1 - Check that warning is issued if .<suffix> targets are ignored +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.nada : something + +something : + +echo "A target." + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? + +if echo $output1 | grep 'Warning: -- Ignoring AUGMAKE meta-target' > /dev/null 2>&1 ; then + result1=0 +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-30 b/dmake/tests/targets-30 new file mode 100755 index 000000000000..31e2e9712504 --- /dev/null +++ b/dmake/tests/targets-30 @@ -0,0 +1,64 @@ +#!/bin/sh + +# 05.02.2008 Volker Quetschke +# Check that OOODMAKEMODE=y does not normalize ./../foo. +# (issue 84800) + +: ${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( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +OOODMAKEMODE:=y + +# See if OOODMAKEMODE keeps ./../all +./../all : + @echo X\$@Y + +EOT + + +output1=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result1=$? +if test $result1 -ne 0 -o "$output1" != "X./../allY"; then + echo "Test 1: Wrong result: $output1" + result1=1 +fi +# Remember to quote variables in generated makefiles( $ -> \$ ). +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +OOODMAKEMODE:= + +# See if OOODMAKEMODE= removes the leading . +./../all : + @echo X\$@Y + +EOT + + +output2=`eval ${DMAKEPROG} -rf $file1 2>&1 ` +result2=$? +if test $result2 -ne 0 -o "$output2" != "X../allY"; then + echo "Test 2: Wrong result: $output2" + result2=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + exit 0 +else + echo "Failure!" + exit 1 +fi diff --git a/dmake/tests/targets-4 b/dmake/tests/targets-4 new file mode 100644 index 000000000000..2bc66d9ec519 --- /dev/null +++ b/dmake/tests/targets-4 @@ -0,0 +1,70 @@ +#!/bin/sh + +# 03.06.2006 Volker Quetschke +# Check that a warning is issued for special or meta targets with +# empty recipes. +# (issue 65360) - Well, the issue is talking about slightly a different +# issue but a related patch was committed with this issue reference. + +: ${DMAKEPROG:=dmake} +file1="mfile1.mk" +file2="mfile2.mk" +tmpfiles="$file1 $file2" + +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( $ -> \$ ). +# Testcase 1 - AUGMAKE meta targets +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.NIX : + +something : + +echo "A target." + +EOT + +# Testcase 2 - Percent targets +cat > $file2 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.a : %.b + +something : + +echo "A target." + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? +output2=`eval ${DMAKEPROG} -r -f $file2 2>&1 ` +result2=$? + +if echo $output1 | grep -v 'Warning: -- Empty recipe' > /dev/null 2>&1 ; then + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if echo $output2 | grep -v 'Warning: -- Empty recipe' > /dev/null 2>&1 ; then + echo "Test 2: Wrong result: $output2" + echo + result1=1 +fi + +if test $result1 -eq 0 -a $result2 -eq 0; then + echo "Success - Cleaning up" + rm -rf $tmpfiles +exit + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-5 b/dmake/tests/targets-5 new file mode 100644 index 000000000000..0e83ca43107c --- /dev/null +++ b/dmake/tests/targets-5 @@ -0,0 +1,51 @@ +#!/bin/sh + +# 13.06.2006 Volker Quetschke +# Error out if AUGMAKE meta and normal targets occur in the same rule +# definition. +# (issue 66083) + +: ${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( $ -> \$ ). +# Testcase 1 - Check that warning is issued if .<suffix> targets are ignored +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +.NIX.NUX aaa : ; @+echo "Normal and meta target together" + +something : + @+echo "A target." + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? + +if echo $output1 | grep 'Error: -- A non AUGMAKE meta target must' > /dev/null 2>&1 ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=0 +fi + +# Errorcode in $result1 means successfull test +if test $result1 -ne 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-6 b/dmake/tests/targets-6 new file mode 100644 index 000000000000..08ec6591a29a --- /dev/null +++ b/dmake/tests/targets-6 @@ -0,0 +1,52 @@ +#!/bin/sh + +# 13.06.2006 Volker Quetschke +# Pre 4.5 dmakes didn't handle .<suffix> targets if AUGMAKE was set. +# (issue 66365) + +: ${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( $ -> \$ ). +# Check that .NIX is treated as meta target, making all the target +# that gets build. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +AUGMAKE=yes + +.NIX : ; @+echo ".NIX Treated as a normal target" + +all : + @+echo "Fallthrough" + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? + +if echo $output1 | grep 'Fallthrough' > /dev/null 2>&1 ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-7 b/dmake/tests/targets-7 new file mode 100644 index 000000000000..7fb091bd5bdf --- /dev/null +++ b/dmake/tests/targets-7 @@ -0,0 +1,54 @@ +#!/bin/sh + +# 13.06.2006 Volker Quetschke +# Check that `%.a %.b :| %.x %.y 'Z' ; recipe` rules are handled correctly. +# (issues 48087 and 65122) + +: ${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( $ -> \$ ). +# Expect dummy, all.pp and all.xx to be build +# that gets build. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.xx %.rr :| %.yy %.pp 'dummy' ; @+printf "\$@" + +%.pp : + @sleep 1 + @+printf "\$@" + +dummy : + @+printf "\$@" + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 all.xx 2>&1 ` +result1=$? + +if echo $output1 | grep 'dummyall.ppall.xx' > /dev/null 2>&1 ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-8 b/dmake/tests/targets-8 new file mode 100644 index 000000000000..1bb31959a4f6 --- /dev/null +++ b/dmake/tests/targets-8 @@ -0,0 +1,50 @@ +#!/bin/sh + +# 13.06.2006 Volker Quetschke +# .SETDIR used to fail for multiple percent targets. +# (issue 64431) + +: ${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( $ -> \$ ). +# Expect xxx.1 and xxx.2 to be build +# that gets build. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +all : xxx.1 xxx.2 + +xxx.% .SETDIR=. : + @+printf "OK" + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? + +if echo $output1 | grep 'OKOK' > /dev/null 2>&1 ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure!" + result=1 +fi +exit $result diff --git a/dmake/tests/targets-9 b/dmake/tests/targets-9 new file mode 100644 index 000000000000..b82d3796750d --- /dev/null +++ b/dmake/tests/targets-9 @@ -0,0 +1,49 @@ +#!/bin/sh + +# 14.06.2006 Volker Quetschke +# Prior to dmake 4.5 only one %-target per target-definition worked reliably. +# (issue 48087) + +: ${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( $ -> \$ ). +# Check that we warn. +cat > $file1 <<EOT +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +%.xx %.rr : %.yy 'a' 'b' ; touch $@ + +dummy : + @+echo "A target" + +EOT + +output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 ` +result1=$? + +if echo $output1 | grep 'Warning: -- Prior to dmake 4.5 only one' > /dev/null 2>&1 ; then + dummy=1 + # OK +else + echo "Test 1: Wrong result: $output1" + echo + result1=1 +fi + +if test $result1 -eq 0 ; then + echo "Success - Cleaning up" + rm -rf $tmpfiles + result=0 +else + echo "Failure!" + result=1 +fi +exit $result |