#1 Add CI tests using the standard test interface
Merged 6 years ago by pfrankli. Opened 6 years ago by sturivny.
git://fedorapeople.org/~sturivny/make new_tests  into  master

Add CI tests using the standard test interface
Serhii Turivny • 6 years ago  
tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/Makefile
file added
+63
@@ -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 <mkolar@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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 <mkolar@redhat.com>" > $(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)

tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/PURPOSE
file added
+3
@@ -0,0 +1,3 @@

+ PURPOSE of /tools/make/Regression/GNU-make-utility-v-3-82-shipped-with-el7-breaks

+ Author: Michal Kolar <mkolar@redhat.com>

+ Summary: GNU make utility v.3.82 shipped with el7 breaks environment vars

tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/golden.output
file added
+2
@@ -0,0 +1,2 @@

+ echo "TEST=false"

+ TEST=false

tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/runtest.sh
file added
+58
@@ -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 <mkolar@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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

+ 

tests/GNU-make-utility-v-3-82-shipped-with-el7-breaks/test.mk
file added
+5
@@ -0,0 +1,5 @@

+ # User makefile

+ 

+ test: TEST ?= true

+ test:

+ 	echo "TEST=$(TEST)"

tests/Use-after-free-when-eval-in-variable/Makefile
file added
+63
@@ -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 <polacek@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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 <polacek@redhat.com>" > $(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)

tests/Use-after-free-when-eval-in-variable/PURPOSE
file added
+3
@@ -0,0 +1,3 @@

+ PURPOSE of /tools/make/Regression/Use-after-free-when-eval-in-variable

+ Author: Marek Polacek <polacek@redhat.com>

+ Summary: Use-after-free() when eval in variable assignments reassigns the same variable

tests/Use-after-free-when-eval-in-variable/runtest.sh
file added
+56
@@ -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 <polacek@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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

tests/Use-after-free-when-eval-in-variable/test.mk
file added
+2
@@ -0,0 +1,2 @@

+ VARIABLE = $(eval VARIABLE := $(shell sleep 1; echo echo ahoj))$(VARIABLE)

+ wololo:; $(VARIABLE)

tests/make-3-79-has-a-parsing-bug/Makefile
file added
+63
@@ -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 <mkolar@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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 <mkolar@redhat.com>" > $(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)

tests/make-3-79-has-a-parsing-bug/PURPOSE
file added
+3
@@ -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 <mkolar@redhat.com>

tests/make-3-79-has-a-parsing-bug/runtest.sh
file added
+56
@@ -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 <mkolar@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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

tests/make-3-79-has-a-parsing-bug/test.mk
file added
+13
@@ -0,0 +1,13 @@

+ # Author: Petr Muller <pmuller@redhat.com>

+ 

+ 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 $@

+ 

tests/order-only/Makefile
file added
+63
@@ -0,0 +1,63 @@

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Makefile of /tools/make/Regression/order-only

+ #   Description: Test for make bug

+ #   Author: Petr Muller <pmuller@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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 <pmuller@redhat.com>" > $(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)

tests/order-only/PURPOSE
file added
+4
@@ -0,0 +1,4 @@

+ PURPOSE of /tools/make/Regression/order-only

+ Description: Regression Test for make bug

+ Author: Petr Muller <pmuller@redhat.com>

+ Summary: Test that make doesn't insert bogus values into order-only dependencies

tests/order-only/golden.output
file added
+9
@@ -0,0 +1,9 @@

+ mkdir -p dir/b/.

+ @ [a/b/c]

+ ^ []

+ ? []

+ mkdir -p a/b/.

+ @ [a]

+ ^ []

+ ? []

+ rm dir/b/.

tests/order-only/runtest.sh
file added
+56
@@ -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 <pmuller@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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

tests/order-only/test.mk
file added
+17
@@ -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 "? [$?]"

tests/smoke-check-make-runs/Makefile
file added
+63
@@ -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 <vkadlcik@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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 <vkadlcik@redhat.com>" > $(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)

tests/smoke-check-make-runs/PURPOSE
file added
+3
@@ -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 <vkadlcik@redhat.com>

tests/smoke-check-make-runs/hello_world.c
file added
+8
@@ -0,0 +1,8 @@

+ #include <stdio.h>

+ 

+ int main(int argc, char ** argv) {

+ 	if (printf("Hello world!\n") < 0) {

+ 		return -1;

+ 	}

+ 	return 0;

+ }

tests/smoke-check-make-runs/runtest.sh
file added
+62
@@ -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 <vkadlcik@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   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

tests/smoke-check-make-runs/smoke.mk
file added
+9
@@ -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

tests/tests.yml
file added
+33
@@ -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

no initial comment

Justification

Adds tests according to the CI wiki specifically the standard test interface in the spec.

The playbook includes Tier1 level test cases that have been tested in the following contexts and is passing reliably: Classic and Container. Test logs are stored in the artifacts directory.

The following steps are used to execute the tests using the standard test interface:

Test environment

Make sure you have installed packages from the spec

$ rpm -q ansible python2-dnf libselinux-python standard-test-roles
ansible-2.3.2.0-1.fc26.noarch
python2-dnf-2.6.3-11.fc26.noarch
libselinux-python-2.6-7.fc26.x86_64
standard-test-roles-2.4-1.fc26.noarch

Run tests for Classic

$ export TEST_SUBJECTS=
$ sudo ansible-playbook --tags classic tests.yml

Snip of the example test run for Classic tests:

TASK [standard-test-beakerlib : Check the results] ******************************************************************************************************************************************************************
changed: [localhost]

PLAY RECAP **********************************************************************************************************************************************************************************************************
localhost                  : ok=29   changed=18   unreachable=0    failed=0   

PASS GNU-make-utility-v-3-82-shipped-with-el7-breaks
PASS order-only
PASS Use-after-free-when-eval-in-variable
PASS make-3-79-has-a-parsing-bug
PASS smoke-check-make-runs
PASS GNU-make-utility-v-3-82-shipped-with-el7-breaks
PASS order-only
PASS Use-after-free-when-eval-in-variable
PASS make-3-79-has-a-parsing-bug

Run tests for Container

$ export TEST_SUBJECTS=docker:docker.io/library/fedora:26
$ sudo ansible-playbook --tags=container tests.yml

Snip of the example test run for Container tests:

TASK [Gathering Facts] **********************************************************************************************************************************************************************************************
ok: [04b6830374ad3843f62e302543dd2419a1634cd5e309d92480ee2f45b7e2b50d]

PLAY RECAP **********************************************************************************************************************************************************************************************************
04b6830374ad3843f62e302543dd2419a1634cd5e309d92480ee2f45b7e2b50d : ok=16   changed=11   unreachable=0    failed=0   

PASS GNU-make-utility-v-3-82-shipped-with-el7-breaks
PASS order-only
PASS Use-after-free-when-eval-in-variable
PASS make-3-79-has-a-parsing-bug
PASS smoke-check-make-runs

Notes

Tests will be enabled in CI, yet gating is currently disabled, so nothing will change. Tests will run on each dist-git commit, they are not triggered on koji builds and if you are using FMN, it should notify you of failures normally.

The RH QE maintainer contact in case you have questions: mkolar @redhat.com
The idea is that these tests become yours just as you're maintaining the package, there will of course be people around if you have questions or troubles.

Commit 993b78d fixes this pull-request

Pull-Request has been merged by pfrankli

6 years ago

Pull-Request has been merged by pfrankli

6 years ago