Add CI tests using the standard test interface

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

[0] https://fedoraproject.org/wiki/Changes/InvokingTests
[1] https://fedoraproject.org/wiki/CI/Tests#Testing_an_Atomic_Host
This commit is contained in:
Serhii Turivny 2017-09-30 17:08:05 +03:00
commit f2b08d72da
22 changed files with 1143 additions and 0 deletions

View file

@ -0,0 +1,67 @@
# Copyright (c) 2006 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 v.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.
#
# Author: Radek Biba <rbiba@redhat.com>
# The toplevel namespace within which the test lives.
TOPLEVEL_NAMESPACE=/CoreOS
# The name of the package under test:
PACKAGE_NAME=zip
# The path of the test below the package:
RELATIVE_PATH=4GBsegfault
# Version of the Test. Used with make tag.
export TESTVERSION=1.0
# The compiled namespace of the test.
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
.PHONY: all install download clean
BUILT_FILES= # executables to be built should be added here, they will be generated on the system under test.
FILES=$(METADATA) runtest.sh Makefile PURPOSE
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include
# Generate the testinfo.desc here:
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: psklenar <psklenar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: Check if zip segfaults on 4GB files">> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Releases: -RHEL2.1 -RHELServer5 -RHELClient5" >> $(METADATA)
@echo "TestTime: 40m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME) " >> $(METADATA) # add any other packages for which your test ought to run here
@echo "Requires: $(PACKAGE_NAME) " >> $(METADATA) # add any other requirements for the script to run here
@echo "Priority: Normal" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,6 @@
zip mustn't segfault when packing files larger than 4 GB.
Note: this test can't run on RHEL 2.1 since the utilities used here
in the test don't work there as expected. This test can't run on
RHEL 5 either, but in this case, the reason is reworked zip which
can't work with files larger than 4 GB at all.

View file

@ -0,0 +1,39 @@
#!/bin/sh
# Copyright (c) 2006 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 v.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.
#
# Author: Radek Biba <rbiba@redhat.com>
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
rlJournalStart
rlPhaseStartSetup
rlAssertRpm zip
rlRun "TmpDir=/$RANDOM" 0 "Creating tmp directory"
mkdir $TmpDir
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "dd if=/dev/zero of=testfile bs=1M count=4097"
rlRun "zip testfile.zip testfile"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalEnd

View file

@ -0,0 +1,63 @@
# Makefile - Big file in archive
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/big-file-in-archive/Makefile
# Description: zip - tests handling large files (2GB,3GB,4GB)
# Copyright (c) 2008 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 v.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.
TOPLEVEL_NAMESPACE=/CoreOS
PACKAGE_NAME=zip
RELATIVE_PATH=Functionality/stress-tests/big-file-in-archive
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
export TESTVERSION=1.5
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
@touch $(METADATA)
@echo "Owner: Josef Zila <jzila@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: Stress testing: tests handling large files (2GB,3GB,4GB)" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 2h" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Architectures: i386 x86_64 ppc64 ppc" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,21 @@
Test Name: Big file in archive
Author: Josef Zila <jzila@redhat.com>
Location: CoreOS/zip/Functionality/stress-tests/big-file-in-archive/PURPOSE
Short Description:
Tests handling large files (2GB,3GB,4GB)
Long Description:
Test creates three files (2GB, 3GB and 4GB large) and attempts to archive each of them using zip. Then original files are deleted
and archives are unpacked, to check size of unpacked files. Current version of zip on all archs and distros in time of
writing(2.31-1) passes test. Note: 4GB file is too large for zip to handle, so it is not supposed to be successfully archived
or unpacked, test just checks for correct return codes.
how to run it:
choose arch and distro
TEST UPDATED (mcermak)
------------------------
After rebase to zip-3.0-1 there is no 4GB limit. Patching the test accordingly.

View file

@ -0,0 +1,70 @@
#!/bin/bash
# runtest.sh - zip
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/big-file-in-archive/runtest.sh
# Description: zip - tests handling large files (2GB,3MB,4GB)
# Copyright (c) 2008 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 v.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 and rhtslib environment
#rpm -q --quiet rhtslib || rpm -Uvh http://nest.test.redhat.com/mnt/qa/scratch/pmuller/rhtslib/rhtslib.rpm
. /usr/bin/rhts-environment.sh
. /usr/share/rhts-library/rhtslib.sh
PACKAGE=zip
file2gb=`mktemp /var/tmp/tmp.XXXXXXXX`
file3gb=`mktemp /var/tmp/tmp.XXXXXXXX`
file4gb=`mktemp /var/tmp/tmp.XXXXXXXX`
archive2gb=`mktemp /var/tmp/tmp.XXXXXXXX`
archive3gb=`mktemp /var/tmp/tmp.XXXXXXXX`
archive4gb=`mktemp /var/tmp/tmp.XXXXXXXX`
rlJournalStart
rlPhaseStartSetup "Creating test files"
rlAssertRpm $PACKAGE
rlRun "dd if=/dev/zero of=$file2gb bs=1M count=2048" 0 "Creating 2GB file"
rlRun "dd if=/dev/zero of=$file3gb bs=1M count=3056" 0 "Creating 3GB file"
rlRun "dd if=/dev/zero of=$file4gb bs=1M count=4096" 0 "Creating 4GB file"
rlPhaseEnd
rlPhaseStartTest "Starting test"
rm $archive2gb $archive3gb $archive4gb >/dev/null 2>&1 #remove archive temp files, we just need unused temp names
rlRun "zip $archive2gb $file2gb" 0 "Archiving 2GB file"
rlRun "zip $archive3gb $file3gb" 0 "Archiving 3GB file"
if rlIsRHEL 4 5; then
rlRun "zip $archive4gb $file4gb" 6 "Archiving 4GB file"
else
rlRun "zip $archive4gb $file4gb" 0 "Archiving 4GB file"
fi
rlRun "rm -f $file2gb $file3gb $file4gb" 0 "Removing original files"
rlRun "unzip $archive2gb -d /" 0 "Unpacking 2GB file"
rlRun "unzip $archive3gb -d /" 0 "Unpacking 3GB file"
if rlIsRHEL 4 5; then
rlRun "unzip $archive4gb -d /" 9 "Unpacking 4GB file"
else
rlRun "unzip $archive4gb -d /" 0 "Unpacking 4GB file"
fi
rlAssertEquals "Checking new 2GB file size" `stat -c %s $file2gb` 2147483648
rlPhaseEnd
rlPhaseStartCleanup "Cleaning up"
rlRun "rm -f $file2gb $file3gb $file4gb $archive2gb $archive3gb $archive4gb" 0 "Removing test files"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# Makefile - zip umask
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/long-path-in-archive/Makefile
# Description: zip - tests handling very long paths within archive (15*256 characters long path)
# Copyright (c) 2008 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 v.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.
TOPLEVEL_NAMESPACE=/CoreOS
PACKAGE_NAME=zip
RELATIVE_PATH=Functionality/stress-tests/long-path-in-archive/
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
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
@touch $(METADATA)
@echo "Owner: Josef Zila <jzila@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: Stress testing: tests handling very long paths within archive" >> $(METADATA)
@echo "Type: Stress" >> $(METADATA)
@echo "TestTime: 1m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,14 @@
Test Name:
Author: Josef Zila <jzila@redhat.com>
Location: CoreOS/zip/Functionality/stress-tests/long-path-in-archive/PURPOSE
Short Description:
Tests handling very long paths within archive (15*256 characters long path)
Long Description:
This test creates file with very long path of 15 directories, each 255 characters. This whole directory structure is then zipped and unzipped
to determine if zip program handles paths this long correctly. Current version of zip on all archs and distros in time of writing(2.31-1) passes test.
how to run it:
choose arch and distro

View file

@ -0,0 +1,131 @@
#!/bin/bash
# runtest.sh - zip
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/long-path-in-archive/runtest.sh
# Description: zip - tests handling very long paths within archive (15*256 characters long path)
# Copyright (c) 2008 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 v.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.
PACKAGE=zip
RESULT=FAIL
SCORE=0
if rpm -q $PACKAGE &>/dev/null; then
PKG_VERS=$( rpm -q ${PACKAGE} --queryformat %{version} )
PKG_RELEASE=$( rpm -q ${PACKAGE} --queryformat %{release} )
fi
# Include rhts environment
. /usr/bin/rhts-environment.sh
function Log {
echo -e ":: [`date +%H:%M:%S`] :: $1"
}
function HeaderLog {
echo -e "\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo -e ":: [`date +%H:%M:%S`] :: $1"
echo -e "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n"
}
# Start output redirection
{
HeaderLog "Starting $PACKAGE RHTS Test"
if rpm -q $PACKAGE &>/dev/null; then
Log "Running $PACKAGE-$PKG_VERS-$PKG_RELEASE"
else
Log "WARNING: Unable to locate $PACKAGE"
fi
####################
# Begin Test-Case
# Find result should be PASS or FAIL
####################
HeaderLog "Starting Test-Case"
# Test-case logic goes here
for a in `seq 51`; do echo -n "aaaaa"; done > fname
USED_FILE="/proc/version"
DIR="`pwd`"
_PATH="$DIR"
for a in `seq 15`; do
_PATH=$_PATH"/`cat $DIR/fname`"
mkdir `cat $DIR/fname`
cd `cat $DIR/fname`;
done
cat $USED_FILE >> testfile
_PATH=$_PATH"/testfile"
cd $DIR
zip -r tst `cat fname` -q
rm -r -f `cat fname`
unzip -qq tst.zip
if [[ `cat $_PATH` = `cat $USED_FILE` ]]; then
let SCORE+=1
Log 'PASS: Unpacked content matches original.'
else
Log 'FAIL: Unpacked content does not match original!'
echo 'Original:'
cat $USED_FILE
echo
echo 'Unpacked:'
cat $_PATH
fi
rm -r -f `cat fname`
rm -f tst.zip fname testfile
Log 'All done.'
######
#### END
######
if [[ $SCORE -eq 1 ]]; then
RESULT=PASS
fi
####################
# Check Results
####################
HeaderLog "Checking Results"
# Results analysis goes here
if [[ $RESULT == PASS ]]; then
echo "PASS"
RESULT=PASS
else
echo "FAIL"
RESULT=FAIL
fi
####################
# Report Results
####################
HeaderLog "Reporting Results"
Log "TEST: $TEST | RESULT: $RESULT | SCORE: $SCORE\n"
report_result $TEST $RESULT $SCORE
HeaderLog "End of $PACKAGE RHTS Test"
} 2>&1 | tee ${OUTPUTFILE}

View file

@ -0,0 +1,62 @@
# Makefile - zip umask
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/many-files-in-archive/Makefile
# Description: zip - tests behaviour with many files in archive (1048577 files)
# Copyright (c) 2008 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 v.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.
TOPLEVEL_NAMESPACE=/CoreOS
PACKAGE_NAME=zip
RELATIVE_PATH=Functionality/stress-tests/many-files-in-archive/
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
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
@touch $(METADATA)
@echo "Owner: Josef Zila <jzila@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: Stress testing: Tests behaviour with many files in archive (1048577 files)" >> $(METADATA)
@echo "Type: Stress" >> $(METADATA)
@echo "TestTime: 2h" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,15 @@
Test Name:
Author: Josef Zila <jzila@redhat.com>
Location: CoreOS/zip/Functionality/stress-tests/many-files-in-archive/PURPOSE
Short Description:
Tests behaviour with many files in archive (1048577 files)
Long Description:
This test creates 1048576 empty files and one non-empty file. Then zips and unzips directory containing all those files and tests content of
non-empty file and count of unzipped files. This test is very time-consuming. Current version of zip on all archs and distros in time of writing
(2.31-1) passes test.
how to run it:
choose arch and distro

View file

@ -0,0 +1,131 @@
#!/bin/bash
# runtest.sh - zip
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/many-files-in-archive/runtest.sh
# Description: zip - Tests behaviour with many files in archive (1048578 files)
# Copyright (c) 2008 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 v.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.
PACKAGE=zip
RESULT=FAIL
SCORE=0
if rpm -q $PACKAGE &>/dev/null; then
PKG_VERS=$( rpm -q ${PACKAGE} --queryformat %{version} )
PKG_RELEASE=$( rpm -q ${PACKAGE} --queryformat %{release} )
fi
# Include rhts environment
. /usr/bin/rhts-environment.sh
function Log {
echo -e ":: [`date +%H:%M:%S`] :: $1"
}
function HeaderLog {
echo -e "\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo -e ":: [`date +%H:%M:%S`] :: $1"
echo -e "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n"
}
# Start output redirection
{
HeaderLog "Starting $PACKAGE RHTS Test"
if rpm -q $PACKAGE &>/dev/null; then
Log "Running $PACKAGE-$PKG_VERS-$PKG_RELEASE"
else
Log "WARNING: Unable to locate $PACKAGE"
fi
####################
# Begin Test-Case
# Find result should be PASS or FAIL
####################
HeaderLog "Starting Test-Case"
# Test-case logic goes here
mkdir archive
cd archive
Log 'Creating files....'
for a in `seq -f %e 1048576`; do
>$a;
done
echo '12345' > txt
cd ..
Log 'Zipping files....'
zip -r archive archive -q
Log 'Deleting original files....'
rm -rf archive
Log 'Unzipping files....'
unzip -qq archive.zip
if [[ `cat archive/txt` -eq 12345 ]]; then
let SCORE+=1
Log 'PASS: Unpacked content matches original.'
else
Log 'FAIL: Unpacked content does not match original!'
fi
FILES=`ls archive/ | wc -l`
if [[ $FILES -eq 1048577 ]]; then
let SCORE+=1
Log 'PASS: All 1048577 files present after unpacking.'
else
Log 'FAIL: File count changed after unpacking!'
echo 'Before zipping there was 1048577 files. After unzip there is '$FILES' files.'
fi
Log 'Cleaning up....'
rm -rf archive archive.zip
Log 'All done.'
######
#### END
######
if [[ $SCORE -eq 2 ]]; then
RESULT=PASS
fi
####################
# Check Results
####################
HeaderLog "Checking Results"
# Results analysis goes here
if [[ $RESULT == PASS ]]; then
echo "PASS"
RESULT=PASS
else
echo "FAIL"
RESULT=FAIL
fi
####################
# Report Results
####################
HeaderLog "Reporting Results"
Log "TEST: $TEST | RESULT: $RESULT | SCORE: $SCORE\n"
report_result $TEST $RESULT $SCORE
HeaderLog "End of $PACKAGE RHTS Test"
} 2>&1 | tee ${OUTPUTFILE}

20
tests/tests.yml Normal file
View file

@ -0,0 +1,20 @@
---
# This first play always runs on the local staging system
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- atomic
- classic
- container
tests:
- 4GBsegfault
- big-file-in-archive
- long-path-in-archive
- many-files-in-archive
- umask
- umask-when-creating
- zipnote-fails-to-update-the-archive
required_packages:
- coreutils
- zip

View file

@ -0,0 +1,62 @@
# Makefile - zip umask
# Author: Josef Zila <jzila@redhat.com>
# Location: ??
# Description: Zip did not honor umask setting when creating archives.
# Copyright (c) 2008 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 v.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.
TOPLEVEL_NAMESPACE=/CoreOS
PACKAGE_NAME=zip
RELATIVE_PATH=Regression/umask-when-creating
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
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
@touch $(METADATA)
@echo "Owner: Josef Zila <jzila@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: Regression testing: zip does not honour umask setting when creating archives" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,11 @@
Test Name: umask-when-creating
Author: Josef Zila <jzila@redhat.com>
Short Description:
zip does not honor umaks setting when creating archive
Long Description:
zip appears to have a built-in umask of 0022 regardless of the global umask.
With umask set to 0000, zip-2.3-27 creates zip files with permissions of
0644 instead of 0666. Previous versions created files with correct permissions.

View file

@ -0,0 +1,129 @@
#!/bin/bash
# runtest.sh - zip
# Author: Josef Zila <jzila@redhat.com>
# Description: Zip did not honor umask setting when creating archives.
# Copyright (c) 2008 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 v.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.
PACKAGE=zip
RESULT=FAIL
SCORE=0
if rpm -q $PACKAGE &>/dev/null; then
PKG_VERS=$( rpm -q ${PACKAGE} --queryformat %{version} )
PKG_RELEASE=$( rpm -q ${PACKAGE} --queryformat %{release} )
fi
# Include rhts environment
. /usr/bin/rhts-environment.sh
function Log {
echo -e ":: [`date +%H:%M:%S`] :: $1"
}
function HeaderLog {
echo -e "\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo -e ":: [`date +%H:%M:%S`] :: $1"
echo -e "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n"
}
# Start output redirection
{
HeaderLog "Starting $PACKAGE RHTS Test"
if rpm -q $PACKAGE &>/dev/null; then
Log "Running $PACKAGE-$PKG_VERS-$PKG_RELEASE"
else
Log "WARNING: Unable to locate $PACKAGE"
fi
####################
# Begin Test-Case
# Find result should be PASS or FAIL
####################
HeaderLog "Starting Test-Case"
# Test-case logic goes here
umask -S 777 >> /dev/null
zip test /etc/services >> /dev/null
if [ `ls -l test.zip | cut -b 1-10` = ---------- ]
then
let 'SCORE += 1'
else
Log 'FAIL umask 777'
fi
rm -f test.zip
umask -S 000 >> /dev/null
zip test /etc/services >> /dev/null
if [ `ls -l test.zip | cut -b 1-10` = -rw-rw-rw- ]
then
let 'SCORE += 1'
else
Log 'FAIL umask 000'
fi
rm -f test.zip
umask -S 027 >> /dev/null
zip test /etc/services >> /dev/null
if [ `ls -l test.zip | cut -b 1-10` = -rw-r----- ]
then
let 'SCORE += 1'
else
Log 'FAIL umask 027'
fi
rm -f test.zip
Log 'All done.'
######
#### END
######
if [[ $SCORE -eq 3 ]]; then
RESULT=PASS
fi
####################
# Check Results
####################
HeaderLog "Checking Results"
# Results analysis goes here
if [[ $RESULT == PASS ]]; then
echo "PASS"
RESULT=PASS
else
echo "FAIL"
RESULT=FAIL
fi
####################
# Report Results
####################
HeaderLog "Reporting Results"
Log "TEST: $TEST | RESULT: $RESULT | SCORE: $SCORE\n"
report_result $TEST $RESULT $SCORE
HeaderLog "End of $PACKAGE RHTS Test"
} 2>&1 | tee ${OUTPUTFILE}

67
tests/umask/Makefile Normal file
View file

@ -0,0 +1,67 @@
# Copyright (c) 2006 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 v.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.
#
# Author: Radek Biba <rbiba@redhat.com>
# The toplevel namespace within which the test lives.
TOPLEVEL_NAMESPACE=/CoreOS
# The name of the package under test:
PACKAGE_NAME=zip
# The path of the test below the package:
RELATIVE_PATH=umask
# Version of the Test. Used with make tag.
export TESTVERSION=1.0
# The compiled namespace of the test.
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
.PHONY: all install download clean
BUILT_FILES= # executables to be built should be added here, they will be generated on the system under test.
FILES=$(METADATA) runtest.sh Makefile
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include
# Generate the testinfo.desc here:
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Radek Biba <rbiba@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: zip does not honor umask setting when creating archives">> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
#@echo "Releases: -RHEL2.1 -RHELServer5 -RHELClient5" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME) " >> $(METADATA) # add any other packages for which your test ought to run here
@echo "Requires: $(PACKAGE_NAME) " >> $(METADATA) # add any other requirements for the script to run here
@echo "Priority: Normal" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
rhts-lint $(METADATA)

2
tests/umask/PURPOSE Normal file
View file

@ -0,0 +1,2 @@
zip is supposed to honor umask settings when creating archives.
This test case just checks if it really does

48
tests/umask/runtest.sh Normal file
View file

@ -0,0 +1,48 @@
#!/bin/sh
# Copyright (c) 2006 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 v.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.
#
# Author: Radek Biba <rbiba@redhat.com>
. /usr/bin/rhts-environment.sh
exec 5>&1 6>&2
exec >> ${OUTPUTFILE} 2>&1
# Trying to verify that zip honors umask. Trying with various combinations
# of 'w's and 'r's for User, Group, and Others.
result=PASS
masklist="0 2 20 22 200 202 220 222 6 60 600"
maskcount=`echo $masklist | wc -w`
failcnt=0
for m in $masklist; do
umask $m
touch $m
zip -q $m.zip $m
if [ `stat -c %a $m.zip` -ne `stat -c %a $m` ]; then
echo "Error: `stat -c %A $m.zip` $m.zip does not match `stat -c %A $m` $m."
((failcnt++))
fi
rm -f $m.zip $m
done
[ $failcnt -gt 0 ] && result=FAIL
echo "Overall result: $result, $(($failcnt*100/$maskcount))% failures."
exec 1>&5 2>&6
report_result $TEST $result $failcnt

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/zip/Regression/zipnote-fails-to-update-the-archive
# Description: zipnote fails to update the archive
# Author: Karel Volny <kvolny@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# 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/zip/Regression/zipnote-fails-to-update-the-archive
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: Karel Volny <kvolny@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: zipnote fails to update the archive" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: zip" >> $(METADATA)
@echo "Requires: zip" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of zipnote-fails-to-update-the-archive
Description: zipnote fails to update the archive
Author: Karel Volny <kvolny@redhat.com>

View file

@ -0,0 +1,57 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/zip/Regression/zipnote-fails-to-update-the-archive
# Description: zipnote fails to update the archive
# Author: Karel Volny <kvolny@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="zip"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "touch file" 0 "Creating the test file"
rlRun "zip archive.zip file" 0 "Creating the archive including the file"
rlRun "zipnote archive.zip > info.txt" 0 "Reading the archive comments"
## bad - e.g. zip-3.0-1.el6.i686:
# zipnote error: Interrupted (aborting)
# Segmentation fault
## good: no output
rlRun -s "zipnote -w archive.zip < info.txt" 0 "Writing comments to the archive"
rlAssertNotGrep "error" $rlRun_LOG
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText