release 1.18-5

- fixed correct python checking, bz1715479
- fix unbound variables, issues #43
- fixed path to services state store
- fixed file submit to local patch is called outside test harness
- restore shell options in rlWatchdog, bz1713291
- correctly skip test version if there's no rpm source of it, bz1712495
This commit is contained in:
Dalibor Pospisil 2019-06-03 18:09:11 +02:00
parent e69bab920c
commit 973febb6a0
7 changed files with 214 additions and 1 deletions

View File

@ -1,7 +1,7 @@
Name: beakerlib Name: beakerlib
Summary: A shell-level integration testing library Summary: A shell-level integration testing library
Version: 1.18 Version: 1.18
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv2 License: GPLv2
Group: Development/Libraries Group: Development/Libraries
BuildArch: noarch BuildArch: noarch
@ -38,6 +38,11 @@ Patch0: bugzilla-links.patch
Patch1: python3.patch Patch1: python3.patch
Patch2: getopt-errors.patch Patch2: getopt-errors.patch
Patch3: log-command-T-option.patch Patch3: log-command-T-option.patch
Patch4: fix-unbound-variables.patch
Patch5: services-state-store.patch
Patch6: local-FileSubmit-argument.patch
Patch7: cleanup-shell-options.patch
Patch8: correct-exit-code-gathering.patch
%prep %prep
%autosetup -p1 %autosetup -p1
@ -86,6 +91,14 @@ Files for syntax highlighting BeakerLib tests in VIM editor
%{_datadir}/vim/vimfiles/after/syntax/beakerlib.vim %{_datadir}/vim/vimfiles/after/syntax/beakerlib.vim
%changelog %changelog
* Mon Jun 3 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-5
- fixed correct python checking, bz1715479
- fix unbound variables, issues #43
- fixed path to services state store
- fixed file submit to local patch is called outside test harness
- restore shell options in rlWatchdog, bz1713291
- correctly skip test version if there's no rpm source of it, bz1712495
* Thu May 9 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-4 * Thu May 9 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-4
- show getopt parsing error (good for debugging) - show getopt parsing error (good for debugging)
- do not use -T option to submit command - do not use -T option to submit command

View File

@ -0,0 +1,50 @@
From b5d09cecf16d5473ac60ab2a47e0acc14e676781 Mon Sep 17 00:00:00 2001
From: Jakub Heger <jheger@redhat.com>
Date: Thu, 23 May 2019 12:48:15 +0200
Subject: [PATCH 2/8] testing.sh: improve shell option handling
rlWatchdog() sets -m option but didn't restore it. Can cause troubles in
rare conditions.
---
src/testing.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/testing.sh b/src/testing.sh
index eceb402..44b77ca 100644
--- a/src/testing.sh
+++ b/src/testing.sh
@@ -962,6 +962,9 @@ Returns 0 if the command ends normally, without need to be killed.
=cut
rlWatchdog() {
+ # Save current shell options
+ local shell_options=$(set +o)
+
set -m
local command=$1
local timeout=$2
@@ -980,6 +983,8 @@ rlWatchdog() {
/bin/kill -- -$pidsleep
sleep 1
rm -f __INTERNAL_FINISHED __INTERNAL_TIMEOUT
+ # Restore previous shell options
+ eval "$shell_options"
return 0
elif [ -e __INTERNAL_TIMEOUT ]; then
rlLog "Command is still running, I am killing it with $killer"
@@ -992,10 +997,12 @@ rlWatchdog() {
/bin/kill -$killer -- -$pidcmd
sleep 1
rm -f __INTERNAL_FINISHED __INTERNAL_TIMEOUT
+ eval "$shell_options"
return 1
fi
sleep 1
done
+ eval "$shell_options"
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
2.21.0

View File

@ -0,0 +1,30 @@
From 84b54cb2ea9c3744f327d617f2797efd1f6ac617 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Wed, 22 May 2019 11:10:38 +0200
Subject: [PATCH 1/8] do not masque exit code by 'local' directive
if a variable is set with an command output within local directive,
the exit code of that command gets lost and exit code of the 'local'
is used instead which is basically always 0.
---
src/journal.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/journal.sh b/src/journal.sh
index 128f9f2..2e8d616 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -810,8 +810,9 @@ __INTERNAL_CreateHeader(){
__INTERNAL_LogText " Test name : ${__INTERNAL_TEST_NAME}" 2> /dev/null
local test_version="${testversion:-$TESTVERSION}"
+ local test_rpm
# get number of itesm of BASH_SOURCE-1 to get last item of the array
- local test_rpm=$(rpm -qf ${BASH_SOURCE[$((${#BASH_SOURCE[@]}-1))]} 2> /dev/null) \
+ test_rpm=$(rpm -qf ${BASH_SOURCE[$((${#BASH_SOURCE[@]}-1))]} 2> /dev/null) \
&& test_version=$(rpm --qf "%{version}-%{release}" -q $test_rpm 2> /dev/null)
[[ -n "$test_version" ]] && {
--
2.21.0

View File

@ -0,0 +1,32 @@
From 1ee8383ff6108273a0bd726e8ccddbdaa43956b9 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Mon, 3 Jun 2019 16:39:42 +0200
Subject: [PATCH 7/8] fix unbound variables
---
src/beakerlib.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/beakerlib.sh b/src/beakerlib.sh
index c123e3d..2c27c10 100644
--- a/src/beakerlib.sh
+++ b/src/beakerlib.sh
@@ -31,6 +31,7 @@
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+__INTERNAL_SOURCED=${__INTERNAL_SOURCED:-""}
echo "${__INTERNAL_SOURCED}" | grep -qF -- " ${BASH_SOURCE} " && return || __INTERNAL_SOURCED+=" ${BASH_SOURCE} "
: <<'=cut'
@@ -410,6 +411,7 @@ export __INTERNAL_PERSISTENT_TMP=/var/tmp
test -f /etc/profile.d/cobbler.sh && . /etc/profile.d/cobbler.sh
set -e
+BEAKERLIB_DIR=${BEAKERLIB_DIR:=""}
export BEAKERLIB=${BEAKERLIB:-"/usr/share/beakerlib"}
. $BEAKERLIB/storage.sh
. $BEAKERLIB/infrastructure.sh
--
2.21.0

View File

@ -0,0 +1,27 @@
From a8080d22f4d8c2c47781620078dca6d47f5439e9 Mon Sep 17 00:00:00 2001
From: Jakub Heger <jheger@redhat.com>
Date: Fri, 31 May 2019 13:11:39 +0200
Subject: [PATCH 5/8] logging.sh: fix __INTERNAL_FileSubmit argument
recently arguments were removed when calling __INTERNAL_FileSubmit
however the function used positional arguments which were now shifted
---
src/logging.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/logging.sh b/src/logging.sh
index 79df02b..22c34b8 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -137,7 +137,7 @@ __INTERNAL_LogText() {
}
__INTERNAL_FileSubmit() {
- local FILENAME="$4"
+ local FILENAME="$2"
local STORENAME="$__INTERNAL_PERSISTENT_TMP/BEAKERLIB_${TESTID}_STORED_$(basename $FILENAME)"
if [ -z "$TESTID" ]
then
--
2.21.0

View File

@ -43,3 +43,15 @@ diff -ur beakerlib-1.18.old/src/python/testwatcher.py beakerlib-1.18.new/src/pyt
# #
# Authors: Jiri Jaburek <jjaburek@redhat.com> # Authors: Jiri Jaburek <jjaburek@redhat.com>
# #
diff -ur beakerlib-1.18.old/src/journal.sh beakerlib-1.18.new/src/journal.sh
--- beakerlib-1.18.old/src/journal.sh
+++ beakerlib-1.18.new/src/journal.sh
@@ -299,7 +299,7 @@ rlJournalEnd(){
__INTERNAL_JournalXMLCreate() {
local res=0
[[ "$BEAKERLIB_JOURNAL" == "0" ]] || {
- if which python &> /dev/null; then
+ if which python3 &> /dev/null; then
$__INTERNAL_JOURNALIST $__INTERNAL_XSLT --metafile \
"$__INTERNAL_BEAKERLIB_METAFILE" --journal "$__INTERNAL_BEAKERLIB_JOURNAL"
res=$?

View File

@ -0,0 +1,49 @@
From 96c657ea8ddc84203f624872c18765ccd1467743 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Mon, 3 Jun 2019 16:42:28 +0200
Subject: [PATCH 8/8] generate correct path to the services state store
---
src/infrastructure.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/infrastructure.sh b/src/infrastructure.sh
index 1c97205..1294b7c 100644
--- a/src/infrastructure.sh
+++ b/src/infrastructure.sh
@@ -984,8 +984,6 @@ __INTERNAL_SYSTEMCTL() {
systemctl --no-pager "$@"
}
-__INTERNAL_SERVICES_LIST="$BEAKERLIB_DIR/services_list"
-
rlServiceStart() {
# at least one service has to be supplied
if [ $# -lt 1 ]; then
@@ -997,6 +995,7 @@ rlServiceStart() {
local failed=0
# create file to store list of services, if it doesn't already exist
+ local __INTERNAL_SERVICES_LIST="$BEAKERLIB_DIR/services_list"
touch $__INTERNAL_SERVICES_LIST
local service
@@ -1092,6 +1091,7 @@ rlServiceStop() {
local failed=0
# create file to store list of services, if it doesn't already exist
+ local __INTERNAL_SERVICES_LIST="$BEAKERLIB_DIR/services_list"
touch $__INTERNAL_SERVICES_LIST
local service
@@ -1173,6 +1173,7 @@ original state; thus zero is returned when everything is OK.
rlServiceRestore() {
# create file to store list of services, if it doesn't already exist
+ local __INTERNAL_SERVICES_LIST="$BEAKERLIB_DIR/services_list"
touch $__INTERNAL_SERVICES_LIST
if [ $# -lt 1 ]; then
--
2.21.0