Upstream the basic Sanity tests
This commit is contained in:
parent
c47678bec0
commit
b54cfb9d6b
8 changed files with 365 additions and 0 deletions
66
Sanity/Basic-sanity-test-for-libarchive/Makefile
Normal file
66
Sanity/Basic-sanity-test-for-libarchive/Makefile
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /CoreOS/libarchive/Sanity/Basic-sanity-test-for-libarchive
|
||||
# Description: Encapsulates existing sanity tests built into the libarchive source package.
|
||||
# Author: Martin Cermak <mcermak@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/libarchive/Sanity/Basic-sanity-test-for-libarchive
|
||||
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: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Encapsulates existing sanity tests built into the libarchive source package." >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 60m" >> $(METADATA)
|
||||
@echo "RunFor: libarchive" >> $(METADATA)
|
||||
@echo "Requires: libarchive nfs-utils rpm-build gcc make sharutils bzip2-devel xz-devel e2fsprogs-devel libacl-devel libattr-devel lzo-devel openssl-devel libxml2-devel" >> $(METADATA)
|
||||
@echo "Requires: automake bison libtool lz4-devel" >> $(METADATA)
|
||||
@echo "Requires: yum-utils" >> $(METADATA)
|
||||
@echo "Requires: dnf-utils libzstd-devel" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
||||
3
Sanity/Basic-sanity-test-for-libarchive/PURPOSE
Normal file
3
Sanity/Basic-sanity-test-for-libarchive/PURPOSE
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
PURPOSE of /CoreOS/libarchive/Sanity/Basic-sanity-test-for-libarchive
|
||||
Description: Encapsulates existing sanity tests built into the libarchive source package.
|
||||
Author: Martin Cermak <mcermak@redhat.com>
|
||||
39
Sanity/Basic-sanity-test-for-libarchive/main.fmf
Normal file
39
Sanity/Basic-sanity-test-for-libarchive/main.fmf
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
summary: Encapsulates existing sanity tests built into the libarchive source package.
|
||||
description: ''
|
||||
contact: Vaclav Danek <vdanek@redhat.com>
|
||||
component:
|
||||
- libarchive
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- libarchive
|
||||
- nfs-utils
|
||||
- rpm-build
|
||||
- gcc
|
||||
- make
|
||||
- sharutils
|
||||
- bzip2-devel
|
||||
- xz-devel
|
||||
- e2fsprogs-devel
|
||||
- libacl-devel
|
||||
- libattr-devel
|
||||
- lzo-devel
|
||||
- openssl-devel
|
||||
- libxml2-devel
|
||||
- automake
|
||||
- bison
|
||||
- libtool
|
||||
- lz4-devel
|
||||
- yum-utils
|
||||
- dnf-utils
|
||||
- libzstd-devel
|
||||
duration: 60m
|
||||
enabled: true
|
||||
tag:
|
||||
- rhel8-buildroot
|
||||
tier: '1'
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1941521
|
||||
extra-nitrate: TC#0068268
|
||||
extra-summary: /CoreOS/libarchive/Sanity/Basic-sanity-test-for-libarchive
|
||||
extra-task: /CoreOS/libarchive/Sanity/Basic-sanity-test-for-libarchive
|
||||
112
Sanity/Basic-sanity-test-for-libarchive/runtest.sh
Executable file
112
Sanity/Basic-sanity-test-for-libarchive/runtest.sh
Executable file
|
|
@ -0,0 +1,112 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/libarchive/Sanity/Basic-sanity-test-for-libarchive
|
||||
# Description: Encapsulates existing sanity tests built into the libarchive source package.
|
||||
# Author: Martin Cermak <mcermak@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/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="libarchive"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
||||
rm -rf ~/rpmbuild
|
||||
rlRun "pushd $TmpDir"
|
||||
if rlIsRHEL '>7'; then
|
||||
packages="sharutils"
|
||||
# TODO: remove once we have CRB available
|
||||
enable_repo="--enablerepo rhel-CRB"
|
||||
if grep -rq beaker-CRB /etc/yum.repos.d/; then
|
||||
enable_repo="--enablerepo beaker-CRB"
|
||||
fi
|
||||
yum $enable_repo -y install $packages
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
if rlIsRHEL; then
|
||||
rlFetchSrcForInstalled "libarchive" 0 "Download libarchive src rpm"
|
||||
elif rlIsFedora; then
|
||||
rlFetchSrcForInstalled "libarchive" 0 "Download libarchive src rpm"
|
||||
if [ ! -f ./libarchive-*.src.rpm ]; then
|
||||
rlRun "yumdownloader --source --enablerepo 'fedora-source' libarchive"
|
||||
fi
|
||||
fi
|
||||
|
||||
rlRun "rpm -Uvh libarchive*.rpm" 0 "Install libarchive src rpm"
|
||||
|
||||
rlRun "pushd ~/rpmbuild/SPECS" 0 "Go to the SPEC directory"
|
||||
if rlIsRHEL; then
|
||||
rlRun "yum-builddep libarchive -y" 0,1
|
||||
elif rlIsFedora; then
|
||||
rlRun "dnf builddep libarchive.spec"
|
||||
fi
|
||||
|
||||
rlRun "rpmbuild -bp libarchive.spec"
|
||||
rlRun "rpmbuild -bc libarchive.spec"
|
||||
rlRun "popd"
|
||||
|
||||
rlRun "pushd ~/rpmbuild/BUILD/libarchive-*"
|
||||
if [ -d ~/rpmbuild/BUILD/libarchive-* ]; then
|
||||
rlRun "make &> $TmpDir/make.log" 0-255 "Make."
|
||||
# CVE-2021-31566 https://bugzilla.redhat.com/show_bug.cgi?id=2026828#c5
|
||||
if [[ "$(rlGetArch)" == "s390x" ]]; then
|
||||
rlRun "make check &> $TmpDir/make_check.log" 0,2 "Make check"
|
||||
rlRun -s "./libarchive_test" 0,1
|
||||
rlAssertGrep "Tests failed:[[:blank:]]* 1" $rlRun_LOG
|
||||
rlAssertGrep "test_write_filter_gzip (1 failures)" $rlRun_LOG
|
||||
else
|
||||
rlRun "make check &> $TmpDir/make_check.log" 0 "Make check"
|
||||
rlRun -s "./libarchive_test"
|
||||
rlAssertGrep "Tests failed:[[:blank:]]* 0" $rlRun_LOG
|
||||
fi
|
||||
# CVE-2021-31566 https://bugzilla.redhat.com/show_bug.cgi?id=2026828#c5
|
||||
rlAssertGrep "test_write_disk_fixup" $rlRun_LOG
|
||||
else
|
||||
rlFail "Somethings went wrong when preparing BUILD files."
|
||||
fi
|
||||
|
||||
if rlIsRHEL ">=7"; then
|
||||
rlRun "cat test-suite.log"
|
||||
rlFileSubmit "test-suite.log"
|
||||
fi
|
||||
rlRun "popd"
|
||||
|
||||
rlRun "grep \"[0-9]:\ test_.*FAIL\" $TmpDir/make_check.log" 1 "Verify there was no error."
|
||||
rlRun "grep \"Segmentation fault\" $TmpDir/make_check.log" 1 "Verify there was no segfault."
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlBundleLogs testlogs "$TmpDir/make.log" "$TmpDir/make_check.log"
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rm -rf ~/rpmbuild
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
63
Sanity/Basic-test-for-libarchive/Makefile
Normal file
63
Sanity/Basic-test-for-libarchive/Makefile
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /CoreOS/libarchive/Sanity/Basic-test-for-libarchive
|
||||
# Description: Encapsulates basic compressing and extracting test with bsdtar which uses libarchive.
|
||||
# Author: Jakub Janco <jjanco@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2019 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/libarchive/Sanity/Basic-test-for-libarchive
|
||||
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: Jakub Janco <jjanco@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Encapsulates basic compressing and extracting test with bsdtar which uses libarchive." >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 60m" >> $(METADATA)
|
||||
@echo "RunFor: libarchive" >> $(METADATA)
|
||||
@echo "Requires: libarchive bsdtar" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
||||
3
Sanity/Basic-test-for-libarchive/PURPOSE
Normal file
3
Sanity/Basic-test-for-libarchive/PURPOSE
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
PURPOSE of /CoreOS/libarchive/Sanity/Basic-test-for-libarchive
|
||||
Description: Encapsulates basic compressing and extracting test with bsdtar which uses libarchive.
|
||||
Author: Jakub Janco <jjanco@redhat.com>
|
||||
21
Sanity/Basic-test-for-libarchive/main.fmf
Normal file
21
Sanity/Basic-test-for-libarchive/main.fmf
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
summary: Encapsulates basic compressing and extracting test with bsdtar which uses
|
||||
libarchive.
|
||||
description: ''
|
||||
contact: Vaclav Danek <vdanek@redhat.com>
|
||||
component:
|
||||
- libarchive
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- libarchive
|
||||
- bsdtar
|
||||
duration: 60m
|
||||
enabled: true
|
||||
tier: '1'
|
||||
adjust:
|
||||
- enabled: false
|
||||
when: distro == rhel-6
|
||||
continue: false
|
||||
extra-nitrate: TC#0598656
|
||||
extra-summary: /CoreOS/libarchive/Sanity/Basic-test-for-libarchive
|
||||
extra-task: /CoreOS/libarchive/Sanity/Basic-test-for-libarchive
|
||||
58
Sanity/Basic-test-for-libarchive/runtest.sh
Executable file
58
Sanity/Basic-test-for-libarchive/runtest.sh
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/libarchive/Sanity/Basic-test-for-libarchive
|
||||
# Description: Encapsulates basic compressing and extracting test with bsdtar which uses libarchive.
|
||||
# Author: Jakub Janco <jjanco@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2019 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/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="libarchive"
|
||||
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlRun "echo 'This file will be archived.' > test.txt"
|
||||
rlRun "mkdir extract"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "bsdtar -cf test.tar test.txt"
|
||||
rlRun "cp test.tar ./extract/"
|
||||
rlRun "pushd extract"
|
||||
rlRun "bsdtar -xf test.tar"
|
||||
rlRun "popd"
|
||||
rlAssertNotDiffer "test.txt" "extract/test.txt"
|
||||
rlRun "popd"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
Loading…
Add table
Add a link
Reference in a new issue