diff --git a/tests/awk-assign-syntax-support/Makefile b/tests/awk-assign-syntax-support/Makefile new file mode 100644 index 0000000..9fc5b0f --- /dev/null +++ b/tests/awk-assign-syntax-support/Makefile @@ -0,0 +1,62 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/gawk/Regression/awk-assign-syntax-support +# Description: tests awk assign syntax support +# Author: Michal Nowak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/awk-assign-syntax-support/PURPOSE b/tests/awk-assign-syntax-support/PURPOSE new file mode 100644 index 0000000..da401b8 --- /dev/null +++ b/tests/awk-assign-syntax-support/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/gawk/Regression/awk-assign-syntax-support +Description: tests awk assign syntax support +Author: Michal Nowak diff --git a/tests/awk-assign-syntax-support/runtest.sh b/tests/awk-assign-syntax-support/runtest.sh new file mode 100755 index 0000000..04fdd60 --- /dev/null +++ b/tests/awk-assign-syntax-support/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/awk-matches-lowercase-when-searching-for-uppercase/Makefile b/tests/awk-matches-lowercase-when-searching-for-uppercase/Makefile new file mode 100644 index 0000000..61120e2 --- /dev/null +++ b/tests/awk-matches-lowercase-when-searching-for-uppercase/Makefile @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/awk-matches-lowercase-when-searching-for-uppercase/PURPOSE b/tests/awk-matches-lowercase-when-searching-for-uppercase/PURPOSE new file mode 100644 index 0000000..4d811cd --- /dev/null +++ b/tests/awk-matches-lowercase-when-searching-for-uppercase/PURPOSE @@ -0,0 +1,4 @@ +PURPOSE of awk-matches-lowercase-when-searching-for-uppercase +Description: awk matches lowercase when searching for uppercase +Author: Filip Holec +Summary: awk matches lowercase when searching for uppercase range diff --git a/tests/awk-matches-lowercase-when-searching-for-uppercase/runtest.sh b/tests/awk-matches-lowercase-when-searching-for-uppercase/runtest.sh new file mode 100755 index 0000000..0e38bf5 --- /dev/null +++ b/tests/awk-matches-lowercase-when-searching-for-uppercase/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/awk-syntax-support/Makefile b/tests/awk-syntax-support/Makefile new file mode 100644 index 0000000..a8a358e --- /dev/null +++ b/tests/awk-syntax-support/Makefile @@ -0,0 +1,62 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/gawk/Regression/awk-syntax-support +# Description: tests awk syntax support +# Author: Michal Nowak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/awk-syntax-support/PURPOSE b/tests/awk-syntax-support/PURPOSE new file mode 100644 index 0000000..412b2e3 --- /dev/null +++ b/tests/awk-syntax-support/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/gawk/Regression/awk-syntax-support +Description: tests awk syntax support +Author: Michal Nowak diff --git a/tests/awk-syntax-support/runtest.sh b/tests/awk-syntax-support/runtest.sh new file mode 100755 index 0000000..477500a --- /dev/null +++ b/tests/awk-syntax-support/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/double-free-or-corruption/Makefile b/tests/double-free-or-corruption/Makefile new file mode 100644 index 0000000..12d6a24 --- /dev/null +++ b/tests/double-free-or-corruption/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/gawk/Regression/double-free-or-corruption +# Description: Test for double-free-or-corruption +# Author: David Kutalek +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/double-free-or-corruption/PURPOSE b/tests/double-free-or-corruption/PURPOSE new file mode 100644 index 0000000..7b96538 --- /dev/null +++ b/tests/double-free-or-corruption/PURPOSE @@ -0,0 +1,4 @@ +PURPOSE of double-free-or-corruption +Description: Test for double-free-or-corruption +Author: David Kutalek +Summary: gawk regression from RHEL3/4 diff --git a/tests/double-free-or-corruption/reproducer.sh b/tests/double-free-or-corruption/reproducer.sh new file mode 100755 index 0000000..95a3cc6 --- /dev/null +++ b/tests/double-free-or-corruption/reproducer.sh @@ -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); }' + diff --git a/tests/double-free-or-corruption/runtest.sh b/tests/double-free-or-corruption/runtest.sh new file mode 100755 index 0000000..ea150b2 --- /dev/null +++ b/tests/double-free-or-corruption/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/gawk-3-1-7-modifies-command-line-arguments/Makefile b/tests/gawk-3-1-7-modifies-command-line-arguments/Makefile new file mode 100644 index 0000000..8d0bad7 --- /dev/null +++ b/tests/gawk-3-1-7-modifies-command-line-arguments/Makefile @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/gawk-3-1-7-modifies-command-line-arguments/PURPOSE b/tests/gawk-3-1-7-modifies-command-line-arguments/PURPOSE new file mode 100644 index 0000000..79c4303 --- /dev/null +++ b/tests/gawk-3-1-7-modifies-command-line-arguments/PURPOSE @@ -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 diff --git a/tests/gawk-3-1-7-modifies-command-line-arguments/runtest.sh b/tests/gawk-3-1-7-modifies-command-line-arguments/runtest.sh new file mode 100755 index 0000000..857c7e4 --- /dev/null +++ b/tests/gawk-3-1-7-modifies-command-line-arguments/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/printf-format-s-in-gawk-not-working/Makefile b/tests/printf-format-s-in-gawk-not-working/Makefile new file mode 100644 index 0000000..af1a986 --- /dev/null +++ b/tests/printf-format-s-in-gawk-not-working/Makefile @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/printf-format-s-in-gawk-not-working/PURPOSE b/tests/printf-format-s-in-gawk-not-working/PURPOSE new file mode 100644 index 0000000..5acf828 --- /dev/null +++ b/tests/printf-format-s-in-gawk-not-working/PURPOSE @@ -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 +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 diff --git a/tests/printf-format-s-in-gawk-not-working/runtest.sh b/tests/printf-format-s-in-gawk-not-working/runtest.sh new file mode 100755 index 0000000..4cd3cc8 --- /dev/null +++ b/tests/printf-format-s-in-gawk-not-working/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..050d9a6 --- /dev/null +++ b/tests/tests.yml @@ -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