From 602fdc5e5e266095bc3074b9c38607f2667723e6 Mon Sep 17 00:00:00 2001 From: harti Date: Thu, 28 Apr 2005 13:20:48 +0000 Subject: Add an initial regression test suite for make(1). Submitted by: Max Okumoto (partly, initial version) --- tools/regression/usr.bin/make/README | 60 +++++ tools/regression/usr.bin/make/all.sh | 16 ++ tools/regression/usr.bin/make/archives/t0/Makefile | 63 +++++ .../usr.bin/make/archives/t0/expected.status | 1 + .../usr.bin/make/archives/t0/expected.stderr | 3 + .../usr.bin/make/archives/t0/expected.stdout | 7 + .../regression/usr.bin/make/archives/t0/libtest.a | Bin 0 -> 2104 bytes tools/regression/usr.bin/make/archives/t0/test.t | 18 ++ tools/regression/usr.bin/make/archives/t1/Makefile | 66 +++++ .../usr.bin/make/archives/t1/expected.status | 1 + .../usr.bin/make/archives/t1/expected.stderr | 3 + .../usr.bin/make/archives/t1/expected.stdout | 7 + .../regression/usr.bin/make/archives/t1/libtest.a | Bin 0 -> 2104 bytes tools/regression/usr.bin/make/archives/t1/test.t | 18 ++ tools/regression/usr.bin/make/archives/t2/Makefile | 64 +++++ .../usr.bin/make/archives/t2/expected.status | 1 + .../usr.bin/make/archives/t2/expected.stderr | 2 + .../usr.bin/make/archives/t2/expected.stdout | 7 + .../regression/usr.bin/make/archives/t2/libtest.a | Bin 0 -> 2016 bytes tools/regression/usr.bin/make/archives/t2/test.t | 18 ++ .../usr.bin/make/basic/t0/expected.status | 1 + .../usr.bin/make/basic/t0/expected.stderr | 1 + .../usr.bin/make/basic/t0/expected.stdout | 0 tools/regression/usr.bin/make/basic/t0/test.t | 18 ++ .../usr.bin/make/basic/t1/expected.status | 1 + .../usr.bin/make/basic/t1/expected.stderr | 0 .../usr.bin/make/basic/t1/expected.stdout | 0 tools/regression/usr.bin/make/basic/t1/test.t | 20 ++ .../usr.bin/make/basic/t2/expected.status | 1 + .../usr.bin/make/basic/t2/expected.stderr | 0 .../usr.bin/make/basic/t2/expected.stdout | 2 + tools/regression/usr.bin/make/basic/t2/test.t | 21 ++ .../usr.bin/make/basic/t3/expected.status | 1 + .../usr.bin/make/basic/t3/expected.stderr | 1 + .../usr.bin/make/basic/t3/expected.stdout | 0 tools/regression/usr.bin/make/basic/t3/test.t | 18 ++ tools/regression/usr.bin/make/common.sh | 276 +++++++++++++++++++++ tools/regression/usr.bin/make/suffixes/t0/Makefile | 11 + tools/regression/usr.bin/make/suffixes/t0/TEST1.a | 1 + .../usr.bin/make/suffixes/t0/expected.status | 1 + .../usr.bin/make/suffixes/t0/expected.stderr | 0 .../usr.bin/make/suffixes/t0/expected.stdout | 2 + tools/regression/usr.bin/make/suffixes/t0/test.t | 30 +++ tools/regression/usr.bin/make/suffixes/t1/Makefile | 7 + tools/regression/usr.bin/make/suffixes/t1/TEST1.a | 1 + tools/regression/usr.bin/make/suffixes/t1/TEST2.a | 1 + .../usr.bin/make/suffixes/t1/expected.status | 1 + .../usr.bin/make/suffixes/t1/expected.stderr | 0 .../usr.bin/make/suffixes/t1/expected.stdout | 2 + tools/regression/usr.bin/make/suffixes/t1/test.t | 30 +++ tools/regression/usr.bin/make/suffixes/t2/Makefile | 9 + tools/regression/usr.bin/make/suffixes/t2/TEST1.a | 1 + tools/regression/usr.bin/make/suffixes/t2/TEST2.a | 1 + .../usr.bin/make/suffixes/t2/expected.status | 1 + .../usr.bin/make/suffixes/t2/expected.stderr | 0 .../usr.bin/make/suffixes/t2/expected.stdout | 2 + tools/regression/usr.bin/make/suffixes/t2/test.t | 30 +++ .../usr.bin/make/variables/t0/expected.status | 1 + .../usr.bin/make/variables/t0/expected.stderr | 0 .../usr.bin/make/variables/t0/expected.stdout | 31 +++ tools/regression/usr.bin/make/variables/t0/test.t | 38 +++ .../usr.bin/make/variables/t1/expected.status | 1 + .../usr.bin/make/variables/t1/expected.stderr | 0 .../usr.bin/make/variables/t1/expected.stdout | 7 + tools/regression/usr.bin/make/variables/t1/test.t | 33 +++ 65 files changed, 958 insertions(+) create mode 100644 tools/regression/usr.bin/make/README create mode 100644 tools/regression/usr.bin/make/all.sh create mode 100644 tools/regression/usr.bin/make/archives/t0/Makefile create mode 100644 tools/regression/usr.bin/make/archives/t0/expected.status create mode 100644 tools/regression/usr.bin/make/archives/t0/expected.stderr create mode 100644 tools/regression/usr.bin/make/archives/t0/expected.stdout create mode 100644 tools/regression/usr.bin/make/archives/t0/libtest.a create mode 100644 tools/regression/usr.bin/make/archives/t0/test.t create mode 100644 tools/regression/usr.bin/make/archives/t1/Makefile create mode 100644 tools/regression/usr.bin/make/archives/t1/expected.status create mode 100644 tools/regression/usr.bin/make/archives/t1/expected.stderr create mode 100644 tools/regression/usr.bin/make/archives/t1/expected.stdout create mode 100644 tools/regression/usr.bin/make/archives/t1/libtest.a create mode 100644 tools/regression/usr.bin/make/archives/t1/test.t create mode 100644 tools/regression/usr.bin/make/archives/t2/Makefile create mode 100644 tools/regression/usr.bin/make/archives/t2/expected.status create mode 100644 tools/regression/usr.bin/make/archives/t2/expected.stderr create mode 100644 tools/regression/usr.bin/make/archives/t2/expected.stdout create mode 100644 tools/regression/usr.bin/make/archives/t2/libtest.a create mode 100644 tools/regression/usr.bin/make/archives/t2/test.t create mode 100644 tools/regression/usr.bin/make/basic/t0/expected.status create mode 100644 tools/regression/usr.bin/make/basic/t0/expected.stderr create mode 100644 tools/regression/usr.bin/make/basic/t0/expected.stdout create mode 100644 tools/regression/usr.bin/make/basic/t0/test.t create mode 100644 tools/regression/usr.bin/make/basic/t1/expected.status create mode 100644 tools/regression/usr.bin/make/basic/t1/expected.stderr create mode 100644 tools/regression/usr.bin/make/basic/t1/expected.stdout create mode 100644 tools/regression/usr.bin/make/basic/t1/test.t create mode 100644 tools/regression/usr.bin/make/basic/t2/expected.status create mode 100644 tools/regression/usr.bin/make/basic/t2/expected.stderr create mode 100644 tools/regression/usr.bin/make/basic/t2/expected.stdout create mode 100644 tools/regression/usr.bin/make/basic/t2/test.t create mode 100644 tools/regression/usr.bin/make/basic/t3/expected.status create mode 100644 tools/regression/usr.bin/make/basic/t3/expected.stderr create mode 100644 tools/regression/usr.bin/make/basic/t3/expected.stdout create mode 100644 tools/regression/usr.bin/make/basic/t3/test.t create mode 100644 tools/regression/usr.bin/make/common.sh create mode 100644 tools/regression/usr.bin/make/suffixes/t0/Makefile create mode 100644 tools/regression/usr.bin/make/suffixes/t0/TEST1.a create mode 100644 tools/regression/usr.bin/make/suffixes/t0/expected.status create mode 100644 tools/regression/usr.bin/make/suffixes/t0/expected.stderr create mode 100644 tools/regression/usr.bin/make/suffixes/t0/expected.stdout create mode 100644 tools/regression/usr.bin/make/suffixes/t0/test.t create mode 100644 tools/regression/usr.bin/make/suffixes/t1/Makefile create mode 100644 tools/regression/usr.bin/make/suffixes/t1/TEST1.a create mode 100644 tools/regression/usr.bin/make/suffixes/t1/TEST2.a create mode 100644 tools/regression/usr.bin/make/suffixes/t1/expected.status create mode 100644 tools/regression/usr.bin/make/suffixes/t1/expected.stderr create mode 100644 tools/regression/usr.bin/make/suffixes/t1/expected.stdout create mode 100644 tools/regression/usr.bin/make/suffixes/t1/test.t create mode 100644 tools/regression/usr.bin/make/suffixes/t2/Makefile create mode 100644 tools/regression/usr.bin/make/suffixes/t2/TEST1.a create mode 100644 tools/regression/usr.bin/make/suffixes/t2/TEST2.a create mode 100644 tools/regression/usr.bin/make/suffixes/t2/expected.status create mode 100644 tools/regression/usr.bin/make/suffixes/t2/expected.stderr create mode 100644 tools/regression/usr.bin/make/suffixes/t2/expected.stdout create mode 100644 tools/regression/usr.bin/make/suffixes/t2/test.t create mode 100644 tools/regression/usr.bin/make/variables/t0/expected.status create mode 100644 tools/regression/usr.bin/make/variables/t0/expected.stderr create mode 100644 tools/regression/usr.bin/make/variables/t0/expected.stdout create mode 100644 tools/regression/usr.bin/make/variables/t0/test.t create mode 100644 tools/regression/usr.bin/make/variables/t1/expected.status create mode 100644 tools/regression/usr.bin/make/variables/t1/expected.stderr create mode 100644 tools/regression/usr.bin/make/variables/t1/expected.stdout create mode 100644 tools/regression/usr.bin/make/variables/t1/test.t (limited to 'tools/regression/usr.bin') diff --git a/tools/regression/usr.bin/make/README b/tools/regression/usr.bin/make/README new file mode 100644 index 0000000..351d541 --- /dev/null +++ b/tools/regression/usr.bin/make/README @@ -0,0 +1,60 @@ +$FreeBSD$ + +This directory contains regression tests for make(1). + +The tests are invoked via the test.sh script or prove(1) from p5-Test-Harness + + % test.sh [-v] [-m path_to_make_binary] command + + clean - Remove the results and the other temp files that + are produced by running the test. This brings the + test into its initial state. + + compare - Check if results of the test match the expected + output from stdout, stderr, and the status. + + desc - print description of test + + diff - Output the diffs from the tests and the expected + stdout, stderr, and the status files. + + run - Invoke test, compare, and clean in sequence. + + test - Invoke the test code + + update - Copy the output of the last test run as the expected + output from stdout, stderr, and the status. + + % [MAKE_PROG=path_to_make_binary] prove [options] [files/directories] + +Example: + % sh test.t -m `pwd`/../obj/make run + % MAKE_PROG=/usr/obj/usr/src/usr.bin/make/make prove -r + +Variables +--------- +WORK_BASE - base directory for working files +SRC_BASE - test source base directory +SUBDIR - subdirectory below WORK_BASE and SRC_BASE for current test +WORK_DIR - ${WORK_BASE}/${SUBDIR} +SRC_DIR - ${SRC_BASE}/${SUBDIR} +MAKE_PROG - path to the make program to test + +WORK_BASE and MAKE_PROG are intented to be set by the user. All other +variables are set by the script and can be used in scripts. + +Directory layout +---------------- +common.sh - common code +all.sh - recursively call test scripts + +basic/ + t0/test.t - regression test + t1/test.t - regression test + t2/test.t - regression test +variables/ + t0/test.t - regression test + t1/test.t - regression test + +Each test directory should contain at least a test.t script +and the expected output files. diff --git a/tools/regression/usr.bin/make/all.sh b/tools/regression/usr.bin/make/all.sh new file mode 100644 index 0000000..42f9e73 --- /dev/null +++ b/tools/regression/usr.bin/make/all.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# $FreeBSD$ + +# find all test scripts below our current directory +SCRIPTS=`find . -name test.t` + +if [ -z "${SCRIPTS}" ] ; then + exit 0 +fi + +for i in ${SCRIPTS} ; do + ( + cd `dirname $i` + sh ./test.t $1 + ) +done diff --git a/tools/regression/usr.bin/make/archives/t0/Makefile b/tools/regression/usr.bin/make/archives/t0/Makefile new file mode 100644 index 0000000..ecb991a --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t0/Makefile @@ -0,0 +1,63 @@ +# $FreeBSD$ +# This test checks the code reading archive files. The archive file +# is a BSD4.4 file with __.SYMTAB and #1/N long file names. + +all: + -@make test_ok1 && echo "1 ok" + -@make test_ok2 && echo "2 ok" + -@make test_ok3 && echo "3 ok" + -@make test_ok4 && echo "4 ok" + -@make test_fail5 || echo "5 ok" + -@make test_fail6 || echo "6 ok" + -@make test_fail7 || echo "7 ok" + +############################################################################# + +test_ok1: libtest.a(short.o) + @: + +libtest.a(short.o): ood + @: + +############################################################################# + +test_ok2: libtest.a(exactly15char.o) + @: + +libtest.a(exactly15char.o): ood + @: + +############################################################################# + +test_ok3: libtest.a(exactly16chars.o) + @: + +libtest.a(exactly16chars.o): ood + @: + +############################################################################# + +test_ok4: libtest.a(verylongobjectname.o) + @: + +libtest.a(verylongobjectname.o): ood + @: + +############################################################################# + +# Truncated to 16 characters +test_fail5: libtest.a(verylongobjectna) + @: + +############################################################################# + +# Truncated to 15 characters +test_fail6: libtest.a(verylongobjectn) + @: + +############################################################################# + +test_fail7: libtest.a(\#1/20) + @: + +ood: diff --git a/tools/regression/usr.bin/make/archives/t0/expected.status b/tools/regression/usr.bin/make/archives/t0/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t0/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/archives/t0/expected.stderr b/tools/regression/usr.bin/make/archives/t0/expected.stderr new file mode 100644 index 0000000..8dedeaf --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t0/expected.stderr @@ -0,0 +1,3 @@ +make: don't know how to make verylongobjectna. Stop +make: don't know how to make verylongobjectn. Stop +make: don't know how to make #1/20. Stop diff --git a/tools/regression/usr.bin/make/archives/t0/expected.stdout b/tools/regression/usr.bin/make/archives/t0/expected.stdout new file mode 100644 index 0000000..7cd22e1 --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t0/expected.stdout @@ -0,0 +1,7 @@ +1 ok +2 ok +3 ok +4 ok +5 ok +6 ok +7 ok diff --git a/tools/regression/usr.bin/make/archives/t0/libtest.a b/tools/regression/usr.bin/make/archives/t0/libtest.a new file mode 100644 index 0000000..891ce6e Binary files /dev/null and b/tools/regression/usr.bin/make/archives/t0/libtest.a differ diff --git a/tools/regression/usr.bin/make/archives/t0/test.t b/tools/regression/usr.bin/make/archives/t0/test.t new file mode 100644 index 0000000..6c58fbe --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t0/test.t @@ -0,0 +1,18 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cp libtest.a ${WORK_DIR} +} + +desc_test() +{ + echo "Archive parsing (BSD4.4 format)." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/archives/t1/Makefile b/tools/regression/usr.bin/make/archives/t1/Makefile new file mode 100644 index 0000000..c8c3d58 --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t1/Makefile @@ -0,0 +1,66 @@ +# $FreeBSD$ +# This test checks the code reading archive files. The archive file +# is a BSD4.4 file with __.SYMTAB and #1/N long file names. +# +# The modification of the archive consists in slashes appended to short names. +# + +all: + -@make test_ok1 && echo "1 ok" + -@make test_ok2 && echo "2 ok" + -@make test_ok3 && echo "3 ok" + -@make test_ok4 && echo "4 ok" + -@make test_fail5 || echo "5 ok" + -@make test_fail6 || echo "6 ok" + -@make test_fail7 || echo "7 ok" + +############################################################################# + +test_ok1: libtest.a(short.o) + @: + +libtest.a(short.o): ood + @: + +############################################################################# + +test_ok2: libtest.a(exactly15char.o) + @: + +libtest.a(exactly15char.o): ood + @: + +############################################################################# + +test_ok3: libtest.a(exactly16chars.o) + @: + +libtest.a(exactly16chars.o): ood + @: + +############################################################################# + +test_ok4: libtest.a(verylongobjectname.o) + @: + +libtest.a(verylongobjectname.o): ood + @: + +############################################################################# + +# Truncated to 16 characters +test_fail5: libtest.a(verylongobjectna) + @: + +############################################################################# + +# Truncated to 15 characters +test_fail6: libtest.a(verylongobjectn) + @: + +############################################################################# + +test_fail7: libtest.a(\#1/20) + @: + +ood: diff --git a/tools/regression/usr.bin/make/archives/t1/expected.status b/tools/regression/usr.bin/make/archives/t1/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t1/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/archives/t1/expected.stderr b/tools/regression/usr.bin/make/archives/t1/expected.stderr new file mode 100644 index 0000000..8dedeaf --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t1/expected.stderr @@ -0,0 +1,3 @@ +make: don't know how to make verylongobjectna. Stop +make: don't know how to make verylongobjectn. Stop +make: don't know how to make #1/20. Stop diff --git a/tools/regression/usr.bin/make/archives/t1/expected.stdout b/tools/regression/usr.bin/make/archives/t1/expected.stdout new file mode 100644 index 0000000..7cd22e1 --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t1/expected.stdout @@ -0,0 +1,7 @@ +1 ok +2 ok +3 ok +4 ok +5 ok +6 ok +7 ok diff --git a/tools/regression/usr.bin/make/archives/t1/libtest.a b/tools/regression/usr.bin/make/archives/t1/libtest.a new file mode 100644 index 0000000..57bc407 Binary files /dev/null and b/tools/regression/usr.bin/make/archives/t1/libtest.a differ diff --git a/tools/regression/usr.bin/make/archives/t1/test.t b/tools/regression/usr.bin/make/archives/t1/test.t new file mode 100644 index 0000000..23e9d0c --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t1/test.t @@ -0,0 +1,18 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cp libtest.a ${WORK_DIR} +} + +desc_test() +{ + echo "Archive parsing (modified BSD4.4 format)." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/archives/t2/Makefile b/tools/regression/usr.bin/make/archives/t2/Makefile new file mode 100644 index 0000000..be58a91 --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t2/Makefile @@ -0,0 +1,64 @@ +# $FreeBSD$ +# This test checks the code reading archive files. The archive file +# is an old BSD file with __.SYMTAB and no long file names. Filenames +# are truncated to 16 characters. + +all: + -@make test_ok1 && echo "1 ok" + -@make test_ok2 && echo "2 ok" + -@make test_ok3 && echo "3 ok" + -@make test_ok4 && echo "4 ok" + -@make test_fail5 && echo "5 ok" + -@make test_fail6 || echo "6 ok" + -@make test_fail7 || echo "7 ok" + +############################################################################# + +test_ok1: libtest.a(short.o) + @: + +libtest.a(short.o): ood + @: + +############################################################################# + +test_ok2: libtest.a(exactly15char.o) + @: + +libtest.a(exactly15char.o): ood + @: + +############################################################################# + +test_ok3: libtest.a(exactly16chars.o) + @: + +libtest.a(exactly16chars.o): ood + @: + +############################################################################# + +test_ok4: libtest.a(verylongobjectname.o) + @: + +libtest.a(verylongobjectname.o): ood + @: + +############################################################################# + +# Truncated to 16 characters +test_fail5: libtest.a(verylongobjectna) + @: + +############################################################################# + +# Truncated to 15 characters +test_fail6: libtest.a(verylongobjectn) + @: + +############################################################################# + +test_fail7: libtest.a(\#1/20) + @: + +ood: diff --git a/tools/regression/usr.bin/make/archives/t2/expected.status b/tools/regression/usr.bin/make/archives/t2/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t2/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/archives/t2/expected.stderr b/tools/regression/usr.bin/make/archives/t2/expected.stderr new file mode 100644 index 0000000..b0d6c00 --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t2/expected.stderr @@ -0,0 +1,2 @@ +make: don't know how to make verylongobjectn. Stop +make: don't know how to make #1/20. Stop diff --git a/tools/regression/usr.bin/make/archives/t2/expected.stdout b/tools/regression/usr.bin/make/archives/t2/expected.stdout new file mode 100644 index 0000000..7cd22e1 --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t2/expected.stdout @@ -0,0 +1,7 @@ +1 ok +2 ok +3 ok +4 ok +5 ok +6 ok +7 ok diff --git a/tools/regression/usr.bin/make/archives/t2/libtest.a b/tools/regression/usr.bin/make/archives/t2/libtest.a new file mode 100644 index 0000000..3434c53 Binary files /dev/null and b/tools/regression/usr.bin/make/archives/t2/libtest.a differ diff --git a/tools/regression/usr.bin/make/archives/t2/test.t b/tools/regression/usr.bin/make/archives/t2/test.t new file mode 100644 index 0000000..f83be0b --- /dev/null +++ b/tools/regression/usr.bin/make/archives/t2/test.t @@ -0,0 +1,18 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cp libtest.a ${WORK_DIR} +} + +desc_test() +{ + echo "Archive parsing (old BSD format)." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/basic/t0/expected.status b/tools/regression/usr.bin/make/basic/t0/expected.status new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t0/expected.status @@ -0,0 +1 @@ +2 diff --git a/tools/regression/usr.bin/make/basic/t0/expected.stderr b/tools/regression/usr.bin/make/basic/t0/expected.stderr new file mode 100644 index 0000000..90280c8 --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t0/expected.stderr @@ -0,0 +1 @@ +make: no target to make. diff --git a/tools/regression/usr.bin/make/basic/t0/expected.stdout b/tools/regression/usr.bin/make/basic/t0/expected.stdout new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/basic/t0/test.t b/tools/regression/usr.bin/make/basic/t0/test.t new file mode 100644 index 0000000..768e269 --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t0/test.t @@ -0,0 +1,18 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cp /dev/null ${WORK_DIR}/Makefile +} + +desc_test() +{ + echo "An empty Makefile file." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/basic/t1/expected.status b/tools/regression/usr.bin/make/basic/t1/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t1/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/basic/t1/expected.stderr b/tools/regression/usr.bin/make/basic/t1/expected.stderr new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/basic/t1/expected.stdout b/tools/regression/usr.bin/make/basic/t1/expected.stdout new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/basic/t1/test.t b/tools/regression/usr.bin/make/basic/t1/test.t new file mode 100644 index 0000000..ea5b62f --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t1/test.t @@ -0,0 +1,20 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cat > ${WORK_DIR}/Makefile << _EOF_ +all: +_EOF_ +} + +desc_test() +{ + echo "A Makefile file with only a 'all:' file dependency specification." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/basic/t2/expected.status b/tools/regression/usr.bin/make/basic/t2/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t2/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/basic/t2/expected.stderr b/tools/regression/usr.bin/make/basic/t2/expected.stderr new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/basic/t2/expected.stdout b/tools/regression/usr.bin/make/basic/t2/expected.stdout new file mode 100644 index 0000000..e618540 --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t2/expected.stdout @@ -0,0 +1,2 @@ +echo hello +hello diff --git a/tools/regression/usr.bin/make/basic/t2/test.t b/tools/regression/usr.bin/make/basic/t2/test.t new file mode 100644 index 0000000..861305b --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t2/test.t @@ -0,0 +1,21 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cat > ${WORK_DIR}/Makefile << _EOF_ +all: + echo hello +_EOF_ +} + +desc_test() +{ + echo "A Makefile file with only a 'all:' file dependency specification, and shell command." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/basic/t3/expected.status b/tools/regression/usr.bin/make/basic/t3/expected.status new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t3/expected.status @@ -0,0 +1 @@ +2 diff --git a/tools/regression/usr.bin/make/basic/t3/expected.stderr b/tools/regression/usr.bin/make/basic/t3/expected.stderr new file mode 100644 index 0000000..90280c8 --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t3/expected.stderr @@ -0,0 +1 @@ +make: no target to make. diff --git a/tools/regression/usr.bin/make/basic/t3/expected.stdout b/tools/regression/usr.bin/make/basic/t3/expected.stdout new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/basic/t3/test.t b/tools/regression/usr.bin/make/basic/t3/test.t new file mode 100644 index 0000000..fb6cc41 --- /dev/null +++ b/tools/regression/usr.bin/make/basic/t3/test.t @@ -0,0 +1,18 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + rm -f ${WORK_DIR}/Makefile +} + +desc_test() +{ + echo "No Makefile file." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/common.sh b/tools/regression/usr.bin/make/common.sh new file mode 100644 index 0000000..4bd9f7f --- /dev/null +++ b/tools/regression/usr.bin/make/common.sh @@ -0,0 +1,276 @@ +#!/bin/sh +# +# Common code used run regression tests for usr.bin/make. +# +# $FreeBSD$ + +# +# Output usage messsage. +# +print_usage() +{ + echo "Usage: $0 command" + echo " clean - remove temp files (get initial state)" + echo " compare - compare result of test to expected" + echo " desc - print description of test" + echo " diff - print diffs between results and expected" + echo " harness - produce output suiteable for Test::Harness" + echo " run - run the {test, compare, clean}" + echo " test - run test case" + echo " update - update the expected with current results" +} + +# +# Check if the test result is the same as the expected result. +# +# $1 Input file +# +hack_cmp() +{ + local EXPECTED RESULT + EXPECTED="expected.$1" + RESULT=${WORK_DIR}/$1 + + if [ -f $EXPECTED ]; then + diff -q $EXPECTED $RESULT 1> /dev/null 2> /dev/null + return $? + else + return 1 # FAIL + fi +} + +# +# Check if the test result is the same as the expected result. +# +# $1 Input file +# +hack_diff() +{ + local EXPECTED RESULT + EXPECTED="expected.$1" + RESULT=${WORK_DIR}/$1 + + echo diff -u $EXPECTED $RESULT + if [ -f $EXPECTED ]; then + diff -u $EXPECTED $RESULT + return $? + else + return 1 # FAIL + fi +} + +# +# Default setup_test() function. +# +# The default function just does nothing. +# +# Both the variables SRC_BASE WORK_BASE are available. +# +setup_test() +{ +} + +# +# Default run_test() function. It can be replace by the +# user specified regression test. +# +# Both the variables SRC_BASE WORK_BASE are available. +# +# Note: this function executes from a subshell. +# +run_test() +{ + cd ${WORK_DIR} + $MAKE_PROG 1> stdout 2> stderr + echo $? > status +} + +# +# Default clean routine +# +clean_test() +{ +} + +# +# Clean working directory +# +eval_clean() +{ + rm -f ${WORK_DIR}/stdout + rm -f ${WORK_DIR}/stderr + rm -f ${WORK_DIR}/status + clean_test +} + +# +# Compare results with expected results +# +eval_compare() +{ + hack_cmp stdout || FAIL="stdout $FAIL" + hack_cmp stderr || FAIL="stderr $FAIL" + hack_cmp status || FAIL="status $FAIL" + + if [ ! -z "$FAIL" ]; then + FAIL=`echo $FAIL` + echo "$SUBDIR: Test failed {$FAIL}" + fi +} + +# +# Compare results with expected results for prove(1) +# +eval_hcompare() +{ + FAIL= + hack_cmp stdout || FAIL="stdout $FAIL" + hack_cmp stderr || FAIL="stderr $FAIL" + hack_cmp status || FAIL="status $FAIL" + + if [ ! -z "$FAIL" ]; then + FAIL=`echo $FAIL` + echo "not ok 1 $SUBDIR # reason: {$FAIL}" + else + echo "ok 1 $SUBDIR" + fi +} + +# +# Print description +# +eval_desc() +{ + echo -n "$SUBDIR: " + desc_test +} + +# +# Prepare and run the test +# +eval_test() +{ + [ -d ${WORK_DIR} ] || mkdir -p ${WORK_DIR} + if [ -f Makefile ] ; then + cp Makefile ${WORK_DIR} + fi + setup_test + ( run_test ) +} + +# +# Diff current and expected results +# +eval_diff() +{ + eval_test + echo "------------------------" + echo "- $SUBDIR" + echo "------------------------" + hack_diff stdout + hack_diff stderr + hack_diff status +} + +# +# Run the test for prove(1) +# +eval_harness() +{ + echo 1..1 + eval_test + eval_hcompare + eval_clean +} + +# +# Run the test +# +eval_run() +{ + eval_test + eval_compare + eval_clean +} + +# +# Update expected results +# +eval_update() +{ + eval_test + cat ${WORK_DIR}/stdout > expected.stdout + cat ${WORK_DIR}/stderr > expected.stderr + cat ${WORK_DIR}/status > expected.status +} + +# +# Note: Uses global variable $DIR which might be assigned by +# the script which sourced this file. +# +eval_cmd() +{ + if [ $# -eq 0 ] ; then + set -- harness + fi + + case $1 in + clean|compare|hcompare|desc|diff|harness|run|test|update) + eval eval_$1 + ;; + *) + print_usage + ;; + esac +} + +# +# Parse command line arguments. +# +args=`getopt m:w:v $*` +if [ $? != 0 ]; then + echo 'Usage: ...' + exit 2 +fi +set -- $args +for i; do + case "$i" in + -m) + MAKE_PROG="$2" + shift + shift + ;; + -w) + WORK_BASE="$2" + shift + shift + ;; + -v) + VERBOSE=1 + shift + ;; + --) + shift + break + ;; + esac +done + +# +# Determine our sub-directory. Argh. +# +SRC_DIR=`pwd` +SRC_BASE=`while [ ! -f common.sh ] ; do cd .. ; done ; pwd` +SUBDIR=`echo ${SRC_DIR} | sed "s@${SRC_BASE}/@@"` + +WORK_BASE=${WORK_BASE:-"/tmp/$USER.make.test"} +WORK_DIR=${WORK_BASE}/${SUBDIR} +MAKE_PROG=${MAKE_PROG:-/usr/bin/make} + +export MAKE_PROG +export VERBOSE +export SRC_BASE +export WORK_BASE +export SUBDIR +export SRC_DIR +export WORK_DIR diff --git a/tools/regression/usr.bin/make/suffixes/t0/Makefile b/tools/regression/usr.bin/make/suffixes/t0/Makefile new file mode 100644 index 0000000..1f9753a --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t0/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +all: TEST1.b + diff -u TEST1.a TEST1.b + +.SUFFIXES: + +.SUFFIXES: .a .b + +.a.b: + cat ${.IMPSRC} >${.TARGET} diff --git a/tools/regression/usr.bin/make/suffixes/t0/TEST1.a b/tools/regression/usr.bin/make/suffixes/t0/TEST1.a new file mode 100644 index 0000000..da5569b --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t0/TEST1.a @@ -0,0 +1 @@ +I'm test file 1. diff --git a/tools/regression/usr.bin/make/suffixes/t0/expected.status b/tools/regression/usr.bin/make/suffixes/t0/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t0/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/suffixes/t0/expected.stderr b/tools/regression/usr.bin/make/suffixes/t0/expected.stderr new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/suffixes/t0/expected.stdout b/tools/regression/usr.bin/make/suffixes/t0/expected.stdout new file mode 100644 index 0000000..582927e --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t0/expected.stdout @@ -0,0 +1,2 @@ +cat TEST1.a >TEST1.b +diff -u TEST1.a TEST1.b diff --git a/tools/regression/usr.bin/make/suffixes/t0/test.t b/tools/regression/usr.bin/make/suffixes/t0/test.t new file mode 100644 index 0000000..3715377 --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t0/test.t @@ -0,0 +1,30 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cp TEST1.a $WORK_DIR +} + +run_test() +{ + cd $WORK_DIR + $MAKE_PROG -r 1>stdout 2>stderr + echo $? >status +} + +clean_test() +{ + rm -f TEST1.b +} + +desc_test() +{ + echo "Basic suffix operation." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/suffixes/t1/Makefile b/tools/regression/usr.bin/make/suffixes/t1/Makefile new file mode 100644 index 0000000..38a4573 --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t1/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +all: TEST1.b + cat TEST1.a TEST2.a | diff -u - TEST1.b + +TEST1.b: *.a + cat ${.ALLSRC} >${.TARGET} diff --git a/tools/regression/usr.bin/make/suffixes/t1/TEST1.a b/tools/regression/usr.bin/make/suffixes/t1/TEST1.a new file mode 100644 index 0000000..da5569b --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t1/TEST1.a @@ -0,0 +1 @@ +I'm test file 1. diff --git a/tools/regression/usr.bin/make/suffixes/t1/TEST2.a b/tools/regression/usr.bin/make/suffixes/t1/TEST2.a new file mode 100644 index 0000000..34f8508 --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t1/TEST2.a @@ -0,0 +1 @@ +I'm test file 2. diff --git a/tools/regression/usr.bin/make/suffixes/t1/expected.status b/tools/regression/usr.bin/make/suffixes/t1/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t1/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/suffixes/t1/expected.stderr b/tools/regression/usr.bin/make/suffixes/t1/expected.stderr new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/suffixes/t1/expected.stdout b/tools/regression/usr.bin/make/suffixes/t1/expected.stdout new file mode 100644 index 0000000..3cd2129 --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t1/expected.stdout @@ -0,0 +1,2 @@ +cat TEST1.a TEST2.a >TEST1.b +cat TEST1.a TEST2.a | diff -u - TEST1.b diff --git a/tools/regression/usr.bin/make/suffixes/t1/test.t b/tools/regression/usr.bin/make/suffixes/t1/test.t new file mode 100644 index 0000000..844b8a0 --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t1/test.t @@ -0,0 +1,30 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cp TEST[12].a ${WORK_DIR} +} + +run_test() +{ + cd ${WORK_DIR} + ${MAKE_PROG} -r 1>stdout 2>stderr + echo $? >status +} + +clean_test() +{ + rm -f TEST1.b +} + +desc_test() +{ + echo "Source wildcard expansion." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/suffixes/t2/Makefile b/tools/regression/usr.bin/make/suffixes/t2/Makefile new file mode 100644 index 0000000..42e26fb --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t2/Makefile @@ -0,0 +1,9 @@ +# $FreeBSD$ + +SRC=*.a + +all: TEST1.b + cat TEST1.a TEST2.a | diff -u - TEST1.b + +TEST1.b: ${SRC} + cat ${.ALLSRC} >${.TARGET} diff --git a/tools/regression/usr.bin/make/suffixes/t2/TEST1.a b/tools/regression/usr.bin/make/suffixes/t2/TEST1.a new file mode 100644 index 0000000..da5569b --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t2/TEST1.a @@ -0,0 +1 @@ +I'm test file 1. diff --git a/tools/regression/usr.bin/make/suffixes/t2/TEST2.a b/tools/regression/usr.bin/make/suffixes/t2/TEST2.a new file mode 100644 index 0000000..34f8508 --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t2/TEST2.a @@ -0,0 +1 @@ +I'm test file 2. diff --git a/tools/regression/usr.bin/make/suffixes/t2/expected.status b/tools/regression/usr.bin/make/suffixes/t2/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t2/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/suffixes/t2/expected.stderr b/tools/regression/usr.bin/make/suffixes/t2/expected.stderr new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/suffixes/t2/expected.stdout b/tools/regression/usr.bin/make/suffixes/t2/expected.stdout new file mode 100644 index 0000000..3cd2129 --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t2/expected.stdout @@ -0,0 +1,2 @@ +cat TEST1.a TEST2.a >TEST1.b +cat TEST1.a TEST2.a | diff -u - TEST1.b diff --git a/tools/regression/usr.bin/make/suffixes/t2/test.t b/tools/regression/usr.bin/make/suffixes/t2/test.t new file mode 100644 index 0000000..844b8a0 --- /dev/null +++ b/tools/regression/usr.bin/make/suffixes/t2/test.t @@ -0,0 +1,30 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cp TEST[12].a ${WORK_DIR} +} + +run_test() +{ + cd ${WORK_DIR} + ${MAKE_PROG} -r 1>stdout 2>stderr + echo $? >status +} + +clean_test() +{ + rm -f TEST1.b +} + +desc_test() +{ + echo "Source wildcard expansion." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/variables/t0/expected.status b/tools/regression/usr.bin/make/variables/t0/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/variables/t0/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/variables/t0/expected.stderr b/tools/regression/usr.bin/make/variables/t0/expected.stderr new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/variables/t0/expected.stdout b/tools/regression/usr.bin/make/variables/t0/expected.stdout new file mode 100644 index 0000000..dfe03b8 --- /dev/null +++ b/tools/regression/usr.bin/make/variables/t0/expected.stdout @@ -0,0 +1,31 @@ +echo 0 +0 +echo 1 +1 +echo 0 +0 +# The following are soo broken why no syntax error? +echo + +echo + +echo + +echo + +echo + +echo + +echo + +echo + +echo + +echo + +echo + +echo + diff --git a/tools/regression/usr.bin/make/variables/t0/test.t b/tools/regression/usr.bin/make/variables/t0/test.t new file mode 100644 index 0000000..7cbc35c --- /dev/null +++ b/tools/regression/usr.bin/make/variables/t0/test.t @@ -0,0 +1,38 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cat > ${WORK_DIR}/Makefile << "_EOF_" +A = 0 +AV = 1 +all: + echo $A + echo ${AV} + echo ${A} + # The following are soo broken why no syntax error? + echo $( + echo $) + echo ${ + echo ${A + echo ${A) + echo ${A){ + echo ${AV + echo ${AV) + echo ${AV){ + echo ${AV{ + echo ${A{ + echo $} +_EOF_ +} + +desc_test() +{ + echo "Variable expansion." +} + +eval_cmd $1 diff --git a/tools/regression/usr.bin/make/variables/t1/expected.status b/tools/regression/usr.bin/make/variables/t1/expected.status new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tools/regression/usr.bin/make/variables/t1/expected.status @@ -0,0 +1 @@ +0 diff --git a/tools/regression/usr.bin/make/variables/t1/expected.stderr b/tools/regression/usr.bin/make/variables/t1/expected.stderr new file mode 100644 index 0000000..e69de29 diff --git a/tools/regression/usr.bin/make/variables/t1/expected.stdout b/tools/regression/usr.bin/make/variables/t1/expected.stdout new file mode 100644 index 0000000..e00d5a7 --- /dev/null +++ b/tools/regression/usr.bin/make/variables/t1/expected.stdout @@ -0,0 +1,7 @@ +all files: main.c globals.h util.c util.h map.c map.h parser.y lexer.l cmdman.1 format.5 +cfiles: main.c util.c map.c +hfiles: globals.h util.h map.h +grammer and lexer: parser.y lexer.l +man page: cmdman.1 format.5 +utility files: util.c util.h +m files: main.c map.c map.h diff --git a/tools/regression/usr.bin/make/variables/t1/test.t b/tools/regression/usr.bin/make/variables/t1/test.t new file mode 100644 index 0000000..05014d9 --- /dev/null +++ b/tools/regression/usr.bin/make/variables/t1/test.t @@ -0,0 +1,33 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +setup_test() +{ + cat > ${WORK_DIR}/Makefile << "_EOF_" +FILES = \ + main.c globals.h \ + util.c util.h \ + map.c map.h \ + parser.y lexer.l \ + cmdman.1 format.5 +all: + @echo "all files: ${FILES}" + @echo "cfiles: ${FILES:M*.c}" + @echo "hfiles: ${FILES:M*.h}" + @echo "grammer and lexer: ${FILES:M*.[ly]}" + @echo "man page: ${FILES:M*.[1-9]}" + @echo "utility files: ${FILES:Mutil.?}" + @echo "m files: ${FILES:Mm*}" +_EOF_ +} + +desc_test() +{ + echo "Variable expansion with M modifier" +} + +eval_cmd $1 -- cgit v1.1