#1 Add CI tests using the standard test interface
Merged 2 years ago by dkaspar. Opened 2 years ago by astepano.
git://fedorapeople.org/~astepano/gawk master  into  master

Add CI tests using the standard test interface
Andrei Stepanov • 2 years ago  
tests/awk-assign-syntax-support/Makefile
file added
+62

@@ -0,0 +1,62 @@

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

+ #

+ #   Makefile of /CoreOS/gawk/Regression/awk-assign-syntax-support

+ #   Description: tests awk assign syntax support

+ #   Author: Michal Nowak <mnowak@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2010 Red Hat, Inc. All rights reserved.

+ #

+ #   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=/CoreOS/gawk/Regression/awk-assign-syntax-support

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:        David Kutalek <dkutalek@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     tests awk assign syntax support" >> $(METADATA)

+ 	@echo "Type:            Regression" >> $(METADATA)

+ 	@echo "TestTime:        5m" >> $(METADATA)

+ 	@echo "RunFor:          gawk" >> $(METADATA)

+ 	@echo "Requires:        gawk" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv3" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/awk-assign-syntax-support/PURPOSE
file added
+3

@@ -0,0 +1,3 @@

+ PURPOSE of /CoreOS/gawk/Regression/awk-assign-syntax-support

+ Description: tests awk assign syntax support

+ Author: Michal Nowak <mnowak@redhat.com>

tests/awk-assign-syntax-support/runtest.sh
file added
+59

@@ -0,0 +1,59 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

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

+ #

+ #   runtest.sh of /CoreOS/gawk/Regression/awk-assign-syntax-support

+ #   Description: tests awk assign syntax support

+ #   Author: Michal Nowak <mnowak@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2010 Red Hat, Inc. All rights reserved.

+ #

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

+ . /usr/bin/rhts-environment.sh

+ . /usr/lib/beakerlib/beakerlib.sh

+ 

+ PACKAGE="gawk"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"

+         rlRun "pushd $TmpDir"

+ 	echo "0 1 2" > file

+ 	cat << "EOF" > prog

+ {

+   y = $1 !~ /Get/ ~ /1/

+   z = $2 ~ /a/ !~ /[0-9]/

+   print y z

+ }

+ EOF

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+ 	rlRun "awk -f prog file > awk.stdout" 0 "Process data with awk program"

+ 	rlAssertEquals "awk processed program according to POSIX" "10" "$(cat awk.stdout)"

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

tests/awk-matches-lowercase-when-searching-for-uppercase/Makefile
file added
+63

@@ -0,0 +1,63 @@

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

+ #

+ #   Makefile of /CoreOS/gawk/Regression/awk-matches-lowercase-when-searching-for-uppercase

+ #   Description: Test for awk matches lowercase when searching for uppercase

+ #   Author: Filip Holec <fholec@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=/CoreOS/gawk/Regression/awk-matches-lowercase-when-searching-for-uppercase

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE

+ 

+ .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:           Filip Holec <fholec@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     Test for awk matches lowercase when searching for uppercase" >> $(METADATA)

+ 	@echo "Type:            Regression" >> $(METADATA)

+ 	@echo "TestTime:        5m" >> $(METADATA)

+ 	@echo "RunFor:          gawk" >> $(METADATA)

+ 	@echo "Requires:        gawk" >> $(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/awk-matches-lowercase-when-searching-for-uppercase/PURPOSE
file added
+4

@@ -0,0 +1,4 @@

+ PURPOSE of awk-matches-lowercase-when-searching-for-uppercase

+ Description: awk matches lowercase when searching for uppercase

+ Author: Filip Holec <fholec@redhat.com>

+ Summary: awk matches lowercase when searching for uppercase range

tests/awk-matches-lowercase-when-searching-for-uppercase/runtest.sh
file added
+60

@@ -0,0 +1,60 @@

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

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

+ #

+ #   runtest.sh of /CoreOS/gawk/Regression/awk-matches-lowercase-when-searching-for-uppercase

+ #   Description: awk matches lowercase when searching for uppercase

+ #   Author: Filip Holec <fholec@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

+ 

+ PACKAGE="gawk"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"

+         OLDLANG=$LANG

+         rlRun "pushd $TmpDir"

+         rlRun "export LANG=en_US.UTF-8" 0 "Export needed LANG variable"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         rlRun "echo test | awk '/[A-Z]/' > output" 0 "Run the reproducer"

+         cat output

+         rlAssertNotGrep "test" output

+         rlRun '[ ! -s output ]' 0 "File output should be empty"

+         if [ $(echo test | awk --posix '/[A-Z]/' | grep test) ]; then

+             rlRun "man gawk | col -bx > gawk.txt" 0 "Get man page in plaintext"

+             rlAssertGrep "[A-Z].*will.*also.*match.*the.*lowercase.*characters.*in.*this.*case\!" gawk.txt

+         fi

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+         rlRun "export LANG=$OLDLANG" 0 "Restore LANG variable"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

tests/awk-syntax-support/Makefile
file added
+62

@@ -0,0 +1,62 @@

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

+ #

+ #   Makefile of /CoreOS/gawk/Regression/awk-syntax-support

+ #   Description: tests awk syntax support

+ #   Author: Michal Nowak <mnowak@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2010 Red Hat, Inc. All rights reserved.

+ #

+ #   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=/CoreOS/gawk/Regression/awk-syntax-support

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:        David Kutalek <dkutalek@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     tests awk syntax support" >> $(METADATA)

+ 	@echo "Type:            Regression" >> $(METADATA)

+ 	@echo "TestTime:        5m" >> $(METADATA)

+ 	@echo "RunFor:          gawk" >> $(METADATA)

+ 	@echo "Requires:        gawk" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv3" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/awk-syntax-support/PURPOSE
file added
+3

@@ -0,0 +1,3 @@

+ PURPOSE of /CoreOS/gawk/Regression/awk-syntax-support

+ Description: tests awk syntax support

+ Author: Michal Nowak <mnowak@redhat.com>

tests/awk-syntax-support/runtest.sh
file added
+59

@@ -0,0 +1,59 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

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

+ #

+ #   runtest.sh of /CoreOS/gawk/Regression/awk-syntax-support

+ #   Description: tests awk syntax support

+ #   Author: Michal Nowak <mnowak@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2010 Red Hat, Inc. All rights reserved.

+ #

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

+ . /usr/bin/rhts-environment.sh

+ . /usr/lib/beakerlib/beakerlib.sh

+ 

+ PACKAGE="gawk"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"

+         rlRun "pushd $TmpDir"

+ 	echo "Beth 4.00 0" > file

+ 	cat << "EOF" > prog

+ {

+ B["c","a"] = 2

+ A[1] = 4

+ print ("c","a") in B in A, C in B in A

+ }

+ EOF

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+ 	rlRun "awk -f prog file > awk.stdout"

+ 	rlAssertEquals "Correct output from awk" "1 0" "$(cat awk.stdout)"

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

tests/double-free-or-corruption/Makefile
file added
+63

@@ -0,0 +1,63 @@

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

+ #

+ #   Makefile of /CoreOS/gawk/Regression/double-free-or-corruption

+ #   Description: Test for double-free-or-corruption

+ #   Author: David Kutalek <dkutalek@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2011 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=/CoreOS/gawk/Regression/double-free-or-corruption

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.sh

+ 

+ .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:           David Kutalek <dkutalek@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     Test for double-free-or-corruption" >> $(METADATA)

+ 	@echo "Type:            Regression" >> $(METADATA)

+ 	@echo "TestTime:        5m" >> $(METADATA)

+ 	@echo "RunFor:          gawk" >> $(METADATA)

+ 	@echo "Requires:        gawk" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv2" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/double-free-or-corruption/PURPOSE
file added
+4

@@ -0,0 +1,4 @@

+ PURPOSE of double-free-or-corruption

+ Description: Test for double-free-or-corruption

+ Author: David Kutalek <dkutalek@redhat.com>

+ Summary: gawk regression from RHEL3/4

tests/double-free-or-corruption/reproducer.sh
file added
+8

@@ -0,0 +1,8 @@

+ #!/bin/bash

+ 

+ echo "

+ 

+ jpg: 364592 x

+ gif: 97148 x" | awk '{ if ('\!'length($3)) $3="-"; print

+ sprintf("%-10s%8s%10s%s", $1, $2, "", $3); }'

+ 

tests/double-free-or-corruption/runtest.sh
file added
+55

@@ -0,0 +1,55 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

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

+ #

+ #   runtest.sh of /CoreOS/gawk/Regression/double-free-or-corruption

+ #   Description: Test for double-free-or-corruption

+ #   Author: David Kutalek <dkutalek@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2011 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

+ . /usr/lib/beakerlib/beakerlib.sh

+ 

+ PACKAGE="gawk"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"

+ 	rlRun "cp ./reproducer.sh $TmpDir/"

+         rlRun "pushd $TmpDir"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+ 	set -o pipefail

+ 	export LIBC_FATAL_STDERR_=1

+ 	rlRun "./reproducer.sh 2>&1 | tee ./reproducer.out"

+ 	rlRun "grep 'double free or corruption' ./reproducer.out" 1

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

tests/gawk-3-1-7-modifies-command-line-arguments/Makefile
file added
+63

@@ -0,0 +1,63 @@

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

+ #

+ #   Makefile of /CoreOS/gawk/Regression/gawk-3-1-7-modifies-command-line-arguments

+ #   Description: Uses the "-v" option in gawk to assign a variable and then inspects the command line in ps.

+ #   Author: Bryan Mason <bmason@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2011 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=/CoreOS/gawk/Regression/gawk-3-1-7-modifies-command-line-arguments

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:        David Kutalek <dkutalek@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     Uses the "-v" option in gawk to assign a variable and then inspects the command line in ps." >> $(METADATA)

+ 	@echo "Type:            Regression" >> $(METADATA)

+ 	@echo "TestTime:        5m" >> $(METADATA)

+ 	@echo "RunFor:          gawk" >> $(METADATA)

+ 	@echo "Requires:        gawk" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv2" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/gawk-3-1-7-modifies-command-line-arguments/PURPOSE
file added
+3

@@ -0,0 +1,3 @@

+ PURPOSE of /CoreOS/gawk/Regression/gawk-3-1-7-modifies-command-line-arguments

+ Description: Uses the "-v" option in gawk to assign a variable and then inspects the command line in ps.

+ Author: Bryan Mason <bmason@redhat.com>

tests/gawk-3-1-7-modifies-command-line-arguments/runtest.sh
file added
+53

@@ -0,0 +1,53 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

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

+ #

+ #   runtest.sh of /CoreOS/gawk/Regression/gawk-3-1-7-modifies-command-line-arguments

+ #   Description: Uses the "-v" option in gawk to assign a variable and then inspects the command line in ps.

+ #   Author: Bryan Mason <bmason@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2011 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 rhts environment

+ . /usr/bin/rhts-environment.sh

+ . /usr/lib/beakerlib/beakerlib.sh

+ 

+ PACKAGE="gawk"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"

+         rlRun "pushd $TmpDir"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         rlRun "gawk -v myvar=foo 'BEGIN {print myvar; system(\"/bin/sleep 5\")}' &" 0 "Run gawk with \"-v\" option"

+ 	rlRun "ps -o pid,args | grep 'gawk' | grep -v grep | tee ps.out" 0 "Found gawk process in ps listing"

+ 	rlRun "grep myvar=foo ps.out" 0 "Should find \"myvar=foo\" (not \"myvar foo\") on command line"

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

tests/printf-format-s-in-gawk-not-working/Makefile
file added
+63

@@ -0,0 +1,63 @@

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

+ #

+ #   Makefile of /CoreOS/gawk/Regression/printf-format-s-in-gawk-not-working

+ #   Description: Test for printf format "%.*s" in gawk not working

+ #   Author: David Kutalek <dkutalek@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2010 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=/CoreOS/gawk/Regression/printf-format-s-in-gawk-not-working

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:           David Kutalek <dkutalek@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     Test for printf format "%.*s" in gawk not working" >> $(METADATA)

+ 	@echo "Type:            Regression" >> $(METADATA)

+ 	@echo "TestTime:        5m" >> $(METADATA)

+ 	@echo "RunFor:          gawk" >> $(METADATA)

+ 	@echo "Requires:        gawk" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv2" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/printf-format-s-in-gawk-not-working/PURPOSE
file added
+32

@@ -0,0 +1,32 @@

+ PURPOSE of /CoreOS/gawk/Regression/printf-format-s-in-gawk-not-working

+ Description: Test for printf format "%.*s" in gawk not working

+ Author: David Kutalek <dkutalek@redhat.com>

+ Summary: printf format "%.*s" in gawk not working

+ 

+ Description:

+ 

+ Description of problem:

+ The bug in gawk exists in the Redhat Ent6 gawk package. The patch to fix is checked in the fedora src rpm for gawk-3.1.7-3 and is gawk-3.1.7-prec-utf8.patch.

+ 

+ Here a repeat of the original bug report.

+ 

+ The "%.*s" format string in printf no longer works.

+ 

+ Version-Release number of selected component (if applicable):

+ gawk-3.1.6-5.fc11.i586

+ 

+ How reproducible:

+ Run example from bash command line.

+ The example should remove the last character from the string.

+ 

+ Steps to Reproduce:

+ # echo ab123dl|gawk '{printf("%.*s\n",length($0)-1,$0)}'

+ 

+ Actual results:

+ ab123dl

+ 

+ Expected results:

+ ab123d

+ 

+ Additional info:

+ works OK with gawk-3.1.5-14.el5 and previously on fc10

tests/printf-format-s-in-gawk-not-working/runtest.sh
file added
+49

@@ -0,0 +1,49 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

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

+ #

+ #   runtest.sh of /CoreOS/gawk/Regression/printf-format-s-in-gawk-not-working

+ #   Description: Test for printf format "%.*s" in gawk not working

+ #   Author: David Kutalek <dkutalek@redhat.com>

+ #

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

+ #

+ #   Copyright (c) 2010 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 rhts environment

+ . /usr/bin/rhts-environment.sh

+ . /usr/lib/beakerlib/beakerlib.sh

+ 

+ PACKAGE="gawk"

+ REPRODUCER="echo ab123dl|gawk '{printf(\"%.*s\\n\",length(\$0)-1,\$0)}'"

+ EXPECTED_RESULT="ab123d"

+ 

+ rlJournalStart

+ 

+     rlPhaseStartTest

+         rlAssertRpm $PACKAGE

+ 	rlLog "Bug reproducer: $REPRODUCER"

+ 	rlRun "$REPRODUCER | tee /tmp/$NAME-result.txt"  0 "Running reproducer"

+ 	RESULT="`cat /tmp/$NAME-result.txt`"

+ 	rlAssertEquals "Result should be $EXPECTED_RESULT" "_$RESULT" "_$EXPECTED_RESULT"

+ 	rm /tmp/$NAME-result.txt

+     rlPhaseEnd

+ 

+ rlJournalPrintText

+ rlJournalEnd

tests/tests.yml
file added
+19

@@ -0,0 +1,19 @@

+ ---

+ # This first play always runs on the local staging system

+ - hosts: localhost

+   roles:

+   - role: standard-test-beakerlib

+     tags:

+     - classic

+     - container

+     - atomic

+     tests:

+     - awk-matches-lowercase-when-searching-for-uppercase

+     - printf-format-s-in-gawk-not-working

+     - awk-assign-syntax-support

+     - awk-syntax-support

+     - double-free-or-corruption

+     - gawk-3-1-7-modifies-command-line-arguments

+     required_packages:

+     - gawk

+     - procps-ng

no initial comment

Justification

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

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,
Atomic, Container. Test logs are stored in the artifacts directory.

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

$ ansible-playbook --list-tags tests.yml

playbook: tests.yml

play #1 (localhost): localhost    TAGS: []
     TASK TAGS: [atomic, classic, container]

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

    $ sudo TEST_SUBJECTS='' ansible-playbook --inventory=/usr/share/ansible/inventory --tags=classic tests.yml
    
  • For atomic

    $ curl -Lo ~/atomic.qcow2 https://ftp-stud.hs-esslingen.de/pub/Mirrors/alt.fedoraproject.org/atomic/stable/Fedora-Atomic-26-20170707.1/CloudImages/x86_64/images/Fedora-Atomic-26-20170707.1.x86_64.qcow2
    $ sudo TEST_SUBJECTS=~/atomic.qcow2 ansible-playbook --inventory=/usr/share/ansible/inventory --tags=atomic tests.yml
    
  • For container

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

Snippet of test run

TASK [standard-test-beakerlib : Make the master test summary log artifact] **********************************************
changed: [/home/fedora/atomic.qcow2] => (item=awk-matches-lowercase-when-searching-for-uppercase)
changed: [/home/fedora/atomic.qcow2] => (item=printf-format-s-in-gawk-not-working)
changed: [/home/fedora/atomic.qcow2] => (item=awk-assign-syntax-support)
changed: [/home/fedora/atomic.qcow2] => (item=awk-syntax-support)
changed: [/home/fedora/atomic.qcow2] => (item=double-free-or-corruption)
changed: [/home/fedora/atomic.qcow2] => (item=gawk-3-1-7-modifies-command-line-arguments)

TASK [standard-test-beakerlib : Pull out the logs] **********************************************************************
changed: [/home/fedora/atomic.qcow2]

TASK [standard-test-beakerlib : Check the results] **********************************************************************
changed: [/home/fedora/atomic.qcow2]

PLAY RECAP **************************************************************************************************************
/home/fedora/atomic.qcow2  : ok=13   changed=9    unreachable=0    failed=0

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: mkluson @redhat.com The
idea is that these tests become yours just as you are maintaining the package,
there will of course be people around if you have questions or troubles.

Pull-Request has been merged by dkaspar

2 years ago