re-import sources as agreed with the maintainer

This commit is contained in:
Adam Samalik 2023-07-10 13:07:01 +02:00
parent 164c4a129f
commit c282b9db3b
5 changed files with 200 additions and 1 deletions

6
.gitignore vendored
View File

@ -1,2 +1,6 @@
SOURCES/lshw-B.02.19.2.tar.gz lshw-B.02.14.tar.gz
/lshw-B.02.15.tar.gz
/lshw-B.02.16.tar.gz
/lshw-B.02.17.tar.gz
/lshw-B.02.18.tar.gz
/lshw-B.02.19.2.tar.gz /lshw-B.02.19.2.tar.gz

52
tests/selftest/Makefile Normal file
View File

@ -0,0 +1,52 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/lshw/sanity/check-output
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Author, maintainer and description of the test
AUTHOR=Mike Gahagan <mgahagan@redhat.com>
DESCRIPTION=Install version of lshw that matches the installed distro.
PACKAGE=lshw
# The name of the test.
export TEST=/CoreOS/lshw/sanity/check-output
# Version of the test. Used with make tag.
export TESTVERSION=1.0
# data files, .c files, scripts anything needed to either compile the test and/or run it.
FILES=$(METADATA) runtest.sh PURPOSE Makefile
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES) $(FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ *.rpm
rm -f $(METADATA)
# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include
# Generate the testinfo.desc here:
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: $(AUTHOR)" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: $(DESCRIPTION)" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE)" >> $(METADATA)
# @echo "Releases: RHELServer5 RHEL6" >> $(METADATA)
@echo "Type: Functional" >> $(METADATA)
@echo "Requires: $(PACKAGE)" >> $(METADATA)
@echo "Requires: sqlite sqlite3 python3 libxml2" >> $(METADATA)
rhts-lint $(METADATA)
# The include package takes care of all the dependencies
# Add any other dependencies there (/kernel/filesystems/xfs/include)

26
tests/selftest/PURPOSE Normal file
View File

@ -0,0 +1,26 @@
Purpose of /CoreOS/lshw/sanity/check-output
Perform basic validation of text based output of the lshw tool
-version
-- log the output of 'lshw -version'
-help
-- log the output of 'lshw -help'
default options
-- log the output of 'lshw' with no options
-html
-- log the output of 'lshw -html' and validate using 'xmllint --html'
-xml
-- log the output of 'lshw -xml' and validate using 'xmllint --xml'
-dump
-- log the output of 'lshw -dump' and validate using sqlite
-sanitize
-- log the output of 'lshw -sanitize' and validate by searching for 'serial: [REMOVED]'

94
tests/selftest/runtest.sh Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/lshw/sanity/check-output
# Description: Install version of lshw that matches the installed distro.
# Author: Mike Gahagan <mgahagan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/share/beakerlib/beakerlib.sh
# Set constants
TESTNAME=$(basename $TEST)
OUTPUTDIR=/mnt/testarea/$TESTNAME
log_dir=$OUTPUTDIR/logs
PACKAGE="lshw"
rlJournalStart
rlPhaseStartSetup
rlGetDistroRelease
rlGetDistroVariant
rlShowRunningKernel
rlGetPrimaryArch
rlGetSecondaryArch
rlRun "mkdir -p $log_dir" 0 "Making output directories"
[ $? -eq 0 ] || rlDie "Cannot make output directories!... aborting.."
if [ -x /usr/bin/sqlite3 ]; then
my_sqlite=sqlite3
elif [ -x /usr/bin/sqlite ]; then
my_sqlite=sqlite
else
rlRun "which sqlite" 0 "output of which sqlite"
rlDie "sqlite does not appear to be installed properly"
fi
rlIsRHEL 8
if [[ $? -eq 0 ]] ; then
PYTHON_BIN="python3"
else
PYTHON_BIN="python"
fi
rlPhaseEnd
rlPhaseStartTest
rlCheckRpm $PACKAGE
RC=$?
if [ $RC -ne 0 ]; then
rlDie "Please make sure $PACKAGE is installed before running this test"
fi
rlRun -c "rpm -q lshw | grep -qv beaker" 0 "Check to see if beaker $PACKAGE is not installed"
rlRun "lshw -version" 0 "Getting lshw version information"
rlRun "lshw -help" 0 "Getting lshw command line help information"
rlRun "lshw > $log_dir/lshw.out" 0 "Running lshw with no options and logging output"
rlRun "lshw -sanitize > $log_dir/lshw.out.sanitized" 0 "Running lshw and logging sanitized output"
rlRun -c "grep -q \[REMOVED\] $log_dir/lshw.out.sanitized" 0 "Checking that sensitive information is removed from sanitized output"
rlRun "diff -uNr $log_dir/lshw.out $log_dir/lshw.out.sanitized > $log_dir/lshw.out.diff" 0,1 "Generating diff of unsanitized and sanitized output"
rlRun "lshw -html > $log_dir/lshw.out.html" 0 "Running lshw and logging html output"
rlRun -c "xmllint --html --noout $log_dir/lshw.out.html" 0 "Validating html output"
rlRun "lshw -xml > $log_dir/lshw.out.xml" 0 "running lshw and logging xml output"
rlRun -c "xmllint --noout $log_dir/lshw.out.xml" 0 "Validating xml output"
# rlRun "lshw -json > $log_dir/lshw.out.json" 0 "Running lshw and logging json output"
# rlRun -c "${PYTHON_BIN} -m json.tool < $log_dir/lshw.out.json > /dev/null" 0 "Validating json output"
rlRun "lshw -dump $log_dir/lshw.out.sql > /dev/null" 0 "Running lshw and logging sql output"
rlRun -c "${my_sqlite} $log_dir/lshw.out.sql \"PRAGMA integrity_check\"" 0 "Validating sql output"
rlPhaseEnd
rlPhaseStartCleanup
for f in $log_dir/*; do
if [ -f $f ] ; then
rlFileSubmit $f
fi
done
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

23
tests/tests.yml Normal file
View File

@ -0,0 +1,23 @@
---
# This first play always runs on the local staging system
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
tests:
- selftest
required_packages:
- cmake
- desktop-file-utils
- gcc
- gcc-c++
- gettext
- gtk2-devel
- libappstream-glib
- ninja-build
- python36-devel
- hwdata
- polkit
- sqlite
- sqlite-devel