From f83aa1e94f89e411fb42faf2ae81d9cac45d0a44 Mon Sep 17 00:00:00 2001 From: Serhii Turivny Date: Tue, 10 Oct 2017 16:39:07 +0300 Subject: [PATCH] Add CI tests using the standard test interface --- .../Makefile | 63 +++++++++++++++++++ .../PURPOSE | 3 + .../golden.output | 2 + .../runtest.sh | 58 +++++++++++++++++ .../test.mk | 5 ++ .../Makefile | 63 +++++++++++++++++++ .../PURPOSE | 3 + .../runtest.sh | 56 +++++++++++++++++ .../test.mk | 2 + tests/make-3-79-has-a-parsing-bug/Makefile | 63 +++++++++++++++++++ tests/make-3-79-has-a-parsing-bug/PURPOSE | 3 + tests/make-3-79-has-a-parsing-bug/runtest.sh | 56 +++++++++++++++++ tests/make-3-79-has-a-parsing-bug/test.mk | 13 ++++ tests/order-only/Makefile | 63 +++++++++++++++++++ tests/order-only/PURPOSE | 4 ++ tests/order-only/golden.output | 9 +++ tests/order-only/runtest.sh | 56 +++++++++++++++++ tests/order-only/test.mk | 17 +++++ tests/smoke-check-make-runs/Makefile | 63 +++++++++++++++++++ tests/smoke-check-make-runs/PURPOSE | 3 + tests/smoke-check-make-runs/hello_world.c | 8 +++ tests/smoke-check-make-runs/runtest.sh | 62 ++++++++++++++++++ tests/smoke-check-make-runs/smoke.mk | 9 +++ tests/tests.yml | 33 ++++++++++ 24 files changed, 717 insertions(+) create mode 100644 tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/Makefile create mode 100644 tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/PURPOSE create mode 100644 tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/golden.output create mode 100644 tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/runtest.sh create mode 100644 tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/test.mk create mode 100644 tests/Use-after-free-when-eval-in-variable/Makefile create mode 100644 tests/Use-after-free-when-eval-in-variable/PURPOSE create mode 100755 tests/Use-after-free-when-eval-in-variable/runtest.sh create mode 100644 tests/Use-after-free-when-eval-in-variable/test.mk create mode 100644 tests/make-3-79-has-a-parsing-bug/Makefile create mode 100644 tests/make-3-79-has-a-parsing-bug/PURPOSE create mode 100755 tests/make-3-79-has-a-parsing-bug/runtest.sh create mode 100644 tests/make-3-79-has-a-parsing-bug/test.mk create mode 100644 tests/order-only/Makefile create mode 100644 tests/order-only/PURPOSE create mode 100644 tests/order-only/golden.output create mode 100755 tests/order-only/runtest.sh create mode 100644 tests/order-only/test.mk create mode 100644 tests/smoke-check-make-runs/Makefile create mode 100644 tests/smoke-check-make-runs/PURPOSE create mode 100644 tests/smoke-check-make-runs/hello_world.c create mode 100755 tests/smoke-check-make-runs/runtest.sh create mode 100644 tests/smoke-check-make-runs/smoke.mk create mode 100644 tests/tests.yml diff --git a/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/Makefile b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/Makefile new file mode 100644 index 0000000..6102b4e --- /dev/null +++ b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/make/Regression/GNU-make-utility-v-3-82-shipped-with-el7-breaks +# Description: Test for GNU make utility v.3.82 shipped with el7 breaks +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/make/Regression/GNU-make-utility-v-3-82-shipped-with-el7-breaks +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE test.mk golden.output + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Michal Kolar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: GNU make utility v.3.82 shipped with el7 breaks" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 2m" >> $(METADATA) + @echo "RunFor: make" >> $(METADATA) + @echo "Requires: make coreutils sed diffutils" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: yes" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/PURPOSE b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/PURPOSE new file mode 100644 index 0000000..a82b16c --- /dev/null +++ b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/make/Regression/GNU-make-utility-v-3-82-shipped-with-el7-breaks +Author: Michal Kolar +Summary: GNU make utility v.3.82 shipped with el7 breaks environment vars diff --git a/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/golden.output b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/golden.output new file mode 100644 index 0000000..9d26cbc --- /dev/null +++ b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/golden.output @@ -0,0 +1,2 @@ +echo "TEST=false" +TEST=false diff --git a/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/runtest.sh b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/runtest.sh new file mode 100644 index 0000000..2a204c9 --- /dev/null +++ b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/runtest.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/make/Regression/GNU-make-utility-v-3-82-shipped-with-el7-breaks +# Description: Test for BZ#1323206 (GNU make utility v.3.82 shipped with el7 breaks) +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +CMD="make" +PACKAGE="make" +BIN="$(which $CMD)" +export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}" + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" + rlRun "cp test.mk golden.output $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun "make -f test.mk test TEST=false >stdout" + rlRun "sed -i -e '/Entering directory/d' -e '/Leaving directory/d' stdout" + rlRun "diff golden.output stdout" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd + diff --git a/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/test.mk b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/test.mk new file mode 100644 index 0000000..c70fd08 --- /dev/null +++ b/tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/test.mk @@ -0,0 +1,5 @@ +# User makefile + +test: TEST ?= true +test: + echo "TEST=$(TEST)" diff --git a/tests/Use-after-free-when-eval-in-variable/Makefile b/tests/Use-after-free-when-eval-in-variable/Makefile new file mode 100644 index 0000000..7d290b3 --- /dev/null +++ b/tests/Use-after-free-when-eval-in-variable/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/make/Regression/Use-after-free-when-eval-in-variable +# Description: Test for Use-after-free() when eval in variable +# Author: Marek Polacek +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/make/Regression/Use-after-free-when-eval-in-variable +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE test.mk + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Marek Polacek " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for Use-after-free() when eval in variable)" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 2m" >> $(METADATA) + @echo "RunFor: make" >> $(METADATA) + @echo "Requires: make coreutils" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Use-after-free-when-eval-in-variable/PURPOSE b/tests/Use-after-free-when-eval-in-variable/PURPOSE new file mode 100644 index 0000000..3334eb4 --- /dev/null +++ b/tests/Use-after-free-when-eval-in-variable/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/make/Regression/Use-after-free-when-eval-in-variable +Author: Marek Polacek +Summary: Use-after-free() when eval in variable assignments reassigns the same variable diff --git a/tests/Use-after-free-when-eval-in-variable/runtest.sh b/tests/Use-after-free-when-eval-in-variable/runtest.sh new file mode 100755 index 0000000..bca1b39 --- /dev/null +++ b/tests/Use-after-free-when-eval-in-variable/runtest.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/make/Regression/Use-after-free-when-eval-in-variable +# Description: Test for Use-after-free() when eval in variable +# Author: Marek Polacek +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/lib/beakerlib/beakerlib.sh || exit 1 + +CMD="make" +BIN="$(which $CMD)" +PACKAGE="make" +export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}" + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" + rlRun "cp test.mk $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun "make -f test.mk" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Use-after-free-when-eval-in-variable/test.mk b/tests/Use-after-free-when-eval-in-variable/test.mk new file mode 100644 index 0000000..d845823 --- /dev/null +++ b/tests/Use-after-free-when-eval-in-variable/test.mk @@ -0,0 +1,2 @@ +VARIABLE = $(eval VARIABLE := $(shell sleep 1; echo echo ahoj))$(VARIABLE) +wololo:; $(VARIABLE) diff --git a/tests/make-3-79-has-a-parsing-bug/Makefile b/tests/make-3-79-has-a-parsing-bug/Makefile new file mode 100644 index 0000000..220bd7c --- /dev/null +++ b/tests/make-3-79-has-a-parsing-bug/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/make/Regression/make-3-79-has-a-parsing-bug +# Description: make 3.79 has a parsing bug +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/make/Regression/make-3-79-has-a-parsing-bug +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE test.mk + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Michal Kolar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: make 3.79 has a parsing bug" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 1m" >> $(METADATA) + @echo "RunFor: make" >> $(METADATA) + @echo "Requires: make coreutils" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/make-3-79-has-a-parsing-bug/PURPOSE b/tests/make-3-79-has-a-parsing-bug/PURPOSE new file mode 100644 index 0000000..58337b2 --- /dev/null +++ b/tests/make-3-79-has-a-parsing-bug/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/make/Regression/make-3-79-has-a-parsing-bug +Description: make 3.79 has a parsing bug +Author: Michal Kolar diff --git a/tests/make-3-79-has-a-parsing-bug/runtest.sh b/tests/make-3-79-has-a-parsing-bug/runtest.sh new file mode 100755 index 0000000..62668f3 --- /dev/null +++ b/tests/make-3-79-has-a-parsing-bug/runtest.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/make/Regression/make-3-79-has-a-parsing-bug +# Description: make 3.79 has a parsing bug +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +CMD="make" +BIN="$(which $CMD)" +PACKAGE="make" +export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}" + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" + rlRun "cp test.mk $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun "touch file.l" + rlRun "make -f test.mk" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/make-3-79-has-a-parsing-bug/test.mk b/tests/make-3-79-has-a-parsing-bug/test.mk new file mode 100644 index 0000000..3245364 --- /dev/null +++ b/tests/make-3-79-has-a-parsing-bug/test.mk @@ -0,0 +1,13 @@ +# Author: Petr Muller + +default: out/file.o +%/.exists: + -mkdir $(@D) + touch $@ +src/file.c: file.l src/.exists + @echo file.l to $@ + touch $@ +out/%.o: src/%.c out/.exists + @echo -c $< -o $@ + touch $@ + diff --git a/tests/order-only/Makefile b/tests/order-only/Makefile new file mode 100644 index 0000000..76828d1 --- /dev/null +++ b/tests/order-only/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/make/Regression/order-only +# Description: Test for make bug +# Author: Petr Muller +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/make/Regression/order-only +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE test.mk golden.output + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Petr Muller " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for make bug" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 1m" >> $(METADATA) + @echo "RunFor: make" >> $(METADATA) + @echo "Requires: make coreutils diffutils" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv3" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/order-only/PURPOSE b/tests/order-only/PURPOSE new file mode 100644 index 0000000..b2d9847 --- /dev/null +++ b/tests/order-only/PURPOSE @@ -0,0 +1,4 @@ +PURPOSE of /tools/make/Regression/order-only +Description: Regression Test for make bug +Author: Petr Muller +Summary: Test that make doesn't insert bogus values into order-only dependencies diff --git a/tests/order-only/golden.output b/tests/order-only/golden.output new file mode 100644 index 0000000..0382cfe --- /dev/null +++ b/tests/order-only/golden.output @@ -0,0 +1,9 @@ +mkdir -p dir/b/. +@ [a/b/c] +^ [] +? [] +mkdir -p a/b/. +@ [a] +^ [] +? [] +rm dir/b/. diff --git a/tests/order-only/runtest.sh b/tests/order-only/runtest.sh new file mode 100755 index 0000000..3ff87b3 --- /dev/null +++ b/tests/order-only/runtest.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/make/Regression/order-only +# Description: Test for make bug +# Author: Petr Muller +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +CMD="make" +BIN="$(which $CMD)" +PACKAGE="make" +export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}" + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" + rlRun "cp test.mk golden.output $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun "make -f test.mk | grep -v -e 'Entering' -e 'Leaving' >tested.output" + rlRun "diff golden.output tested.output" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/order-only/test.mk b/tests/order-only/test.mk new file mode 100644 index 0000000..71ca4b1 --- /dev/null +++ b/tests/order-only/test.mk @@ -0,0 +1,17 @@ +all: ./a/b/c a + +clean: + rm -rf a dir + +%/.: + mkdir -p $(@) + +a/%/c: | ./dir/%/. + @echo "@ [$@]" + @echo "^ [$^]" + @echo "? [$?]" + +a: | ./a/b/. + @echo "@ [$@]" + @echo "^ [$^]" + @echo "? [$?]" diff --git a/tests/smoke-check-make-runs/Makefile b/tests/smoke-check-make-runs/Makefile new file mode 100644 index 0000000..b9ddc15 --- /dev/null +++ b/tests/smoke-check-make-runs/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/make/Sanity/smoke-check-make-runs +# Description: Show your version. Build a one-file project. +# Author: Vaclav Kadlcik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/make/Sanity/smoke-check-make-runs +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE hello_world.c smoke.mk + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Vaclav Kadlcik " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Show your version. Build a one-file project." >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: make" >> $(METADATA) + @echo "Requires: make gcc" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/smoke-check-make-runs/PURPOSE b/tests/smoke-check-make-runs/PURPOSE new file mode 100644 index 0000000..65ec1a9 --- /dev/null +++ b/tests/smoke-check-make-runs/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/make/Sanity/smoke-check-make-runs +Description: Show your version. Build a one-file project. +Author: Vaclav Kadlcik diff --git a/tests/smoke-check-make-runs/hello_world.c b/tests/smoke-check-make-runs/hello_world.c new file mode 100644 index 0000000..190a52a --- /dev/null +++ b/tests/smoke-check-make-runs/hello_world.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char ** argv) { + if (printf("Hello world!\n") < 0) { + return -1; + } + return 0; +} diff --git a/tests/smoke-check-make-runs/runtest.sh b/tests/smoke-check-make-runs/runtest.sh new file mode 100755 index 0000000..bac4bf6 --- /dev/null +++ b/tests/smoke-check-make-runs/runtest.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/make/Sanity/smoke-check-make-runs +# Description: Show your version. Build a one-file project. +# Author: Vaclav Kadlcik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +MAKE="$(which --skip-alias make)" +PACKAGE="make" +export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $MAKE)}" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp hello_world.c $TmpDir" + rlRun "cp smoke.mk $TmpDir/Makefile" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun -t -s 'make -v' + rlAssertNotGrep '^STDERR:' $rlRun_LOG + rlAssertGrep '^STDOUT: GNU Make [0-9]' $rlRun_LOG + rlAssertNotExists 'hello_world' + rlRun 'make' + rlAssertExists 'hello_world' + rlRun './hello_world' + rlRun 'make clean' + rlAssertNotExists 'hello_world' + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/smoke-check-make-runs/smoke.mk b/tests/smoke-check-make-runs/smoke.mk new file mode 100644 index 0000000..a7a122a --- /dev/null +++ b/tests/smoke-check-make-runs/smoke.mk @@ -0,0 +1,9 @@ +all: hello_world + +hello_world: hello_world.o + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ + +clean: + rm -f hello_world hello_world.o + +.SUFFIXES: .c diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..40deb50 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,33 @@ +--- +# Tests to run against Docker and Classic mode +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + - container + tests: + - GNU-make-utility-v-3-82-shipped-with-el7-breaks + - order-only + - Use-after-free-when-eval-in-variable + - make-3-79-has-a-parsing-bug + - smoke-check-make-runs + required_packages: + - make + - coreutils + - diffutils + - sed + - gcc + - which + +# Tests to run against Atomic Host +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - atomic + tests: + - GNU-make-utility-v-3-82-shipped-with-el7-breaks + - order-only + - Use-after-free-when-eval-in-variable + - make-3-79-has-a-parsing-bug