Import RHEL's regression test for #435078

This commit is contained in:
Václav Kadlčík 2021-05-04 12:54:49 +02:00 committed by mcermak
parent 2c6bc398b0
commit 3740b5fe3f
4 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,85 @@
# 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: Michal Nowak <mnowak@redhat.com>
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Example Makefile for RHTS #
# This example is geared towards a test for a specific package #
# It does most of the work for you, but may require further coding #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# The toplevel namespace within which the test lives.
TOPLEVEL_NAMESPACE=tools
# The name of the package under test:
PACKAGE_NAME=binutils
# The path of the test below the package:
RELATIVE_PATH=Sanity/435078-output-of-strings-0-n-is-incorrect
# Version of the Test. Used with make tag.
export TESTVERSION=1.1
# The combined namespace of the test.
export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
# A phony target is one that is not really the name of a file.
# It is just a name for some commands to be executed when you
# make an explicit request. There are two reasons to use a
# phony target: to avoid a conflict with a file of the same
# name, and to improve performance.
.PHONY: all install download clean
# executables to be built should be added here, they will be generated on the system under test.
BUILT_FILES=
# data files, .c files, scripts anything needed to either compile the test and/or run it.
FILES=$(METADATA) runtest.sh Makefile PURPOSE
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ *.rpm $(BUILT_FILES)
# You may need to add other targets e.g. to build executables from source code
# Add them here:
# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include
# Generate the testinfo.desc here:
$(METADATA): Makefile
@touch $(METADATA)
# Change to the test owner's name
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: The output of "strings -0 file" is in loop and "-n 0xA" cannot be correctly recognized">> $(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
# You may need other fields here; see the documentation
rhts-lint $(METADATA)

View File

@ -0,0 +1,2 @@
Use "strings -0 file", the output will be in loop.
And "strings -n 0xA file" will report error as "invalid number 0xA"

View File

@ -0,0 +1,14 @@
summary: The output of strings -0 file is in loop and -n 0xA cannot be correctly recognized
description: |
Use "strings -0 file", the output will be in loop.
And "strings -n 0xA file" will report error as "invalid number 0xA"
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
duration: 5m
extra-summary: /tools/binutils/Sanity/435078-output-of-strings-0-n-is-incorrect
extra-task: /tools/binutils/Sanity/435078-output-of-strings-0-n-is-incorrect

View File

@ -0,0 +1,56 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 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="binutils"
rlJournalStart
rlPhaseStartSetup Setup
rlAssertRpm $PACKAGE
rlShowPackageVersion $PACKAGE
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "echo -e \"asdjkhsd\nsdsdsdssd\n\nsdsd\n\" > tstfile" 0 "Generating test file tstfile"
rlPhaseEnd
rlPhaseStartTest TestingOne
rlRun "strings -0 tstfile > errorfile 2>&1 &"
rlRun "sleep 5"
rlRun "jobs"
rlRun "kill -9 %1" 1 "strings in the loop"
rlAssertGrep "minim" errorfile
rlPhaseEnd
rlPhaseStartTest TestingTwo
rlRun "strings -n 0xA tstfile" 0 "echo \"PASS: tstfile processed.\""
rlPhaseEnd
rlPhaseStartCleanup Cleanup
rlBundleLogs "binutils-outputs" errorfile tstfile
rlRun "popd"
rlRun "rm -r $TmpDir $rlRun_LOG" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd