release 1.18-4

This commit is contained in:
Dalibor Pospisil 2019-05-09 17:08:57 +02:00
parent c5e35e8383
commit e69bab920c
3 changed files with 221 additions and 1 deletions

View File

@ -1,7 +1,7 @@
Name: beakerlib
Summary: A shell-level integration testing library
Version: 1.18
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2
Group: Development/Libraries
BuildArch: noarch
@ -36,6 +36,8 @@ Source1: %{name}-tmpfiles.conf
Patch0: bugzilla-links.patch
Patch1: python3.patch
Patch2: getopt-errors.patch
Patch3: log-command-T-option.patch
%prep
%autosetup -p1
@ -84,6 +86,10 @@ Files for syntax highlighting BeakerLib tests in VIM editor
%{_datadir}/vim/vimfiles/after/syntax/beakerlib.vim
%changelog
* Thu May 9 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-4
- show getopt parsing error (good for debugging)
- do not use -T option to submit command
* Fri Apr 5 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-3
- rebase to beakerlib-1.18
- support for dnf/dnf download

173
getopt-errors.patch Normal file
View File

@ -0,0 +1,173 @@
From dbaa50c025dbfc3d8574e57ddbfa8e4cbf1b89d5 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Sun, 28 Apr 2019 21:02:59 +0200
Subject: [PATCH 2/2] do not suppress getopt error
getopt was often used with -q option
now the stderr output is processed and logged as an error message
---
src/infrastructure.sh | 12 ++++++------
src/logging.sh | 2 +-
src/storage.sh | 2 +-
src/synchronisation.sh | 8 ++++----
src/testing.sh | 6 +++---
5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/infrastructure.sh b/src/infrastructure.sh
index 4c76736..1c97205 100644
--- a/src/infrastructure.sh
+++ b/src/infrastructure.sh
@@ -219,7 +219,7 @@ Returns 0 if mounting the share was successful.
rlMount() {
local OPTIONS=''
- local GETOPT=$(getopt -q -o o: -- "$@"); eval set -- "$GETOPT"
+ local GETOPT=$(getopt -o o: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)); eval set -- "$GETOPT"
while true; do
case $1 in
--) shift; break; ;;
@@ -288,7 +288,7 @@ options, 2 otherwise.
rlCheckMount() {
local MNTOPTS=''
- local GETOPT=$(getopt -q -o o: -- "$@"); eval set -- "$GETOPT"
+ local GETOPT=$(getopt -o o: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)); eval set -- "$GETOPT"
while true; do
case $1 in
--) shift; break; ;;
@@ -383,7 +383,7 @@ the mountpoint uses all the given options.
rlAssertMount() {
local MNTOPTS=''
- local GETOPT=$(getopt -q -o o: -- "$@"); eval set -- "$GETOPT"
+ local GETOPT=$(getopt -o o: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)); eval set -- "$GETOPT"
while true; do
case $1 in
--) shift; break; ;;
@@ -461,7 +461,7 @@ Returns 0 if success.
=cut
rlHash() {
- local GETOPT=$(getopt -q -o a: -l decode,algorithm:,stdin -- "$@"); eval set -- "$GETOPT"
+ local GETOPT=$(getopt -o a: -l decode,algorithm:,stdin -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)); eval set -- "$GETOPT"
local decode=0 alg="$rlHashAlgorithm" stdin=0
while true; do
case $1 in
@@ -637,7 +637,7 @@ rlFileBackup() {
local IFS
# getopt will cut off first long opt when no short are defined
- OPTS=$(getopt -o "." -l "clean,namespace:,no-missing-ok,missing-ok" -- "$@")
+ OPTS=$(getopt -o "." -l "clean,namespace:,no-missing-ok,missing-ok" -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
[ $? -ne 0 ] && return 1
eval set -- "$OPTS"
@@ -813,7 +813,7 @@ rlFileRestore() {
local IFS
# getopt will cut off first long opt when no short are defined
- OPTS=$(getopt -o "n:" -l "namespace:" -- "$@")
+ OPTS=$(getopt -o "n:" -l "namespace:" -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
[ $? -ne 0 ] && return 1
eval set -- "$OPTS"
diff --git a/src/logging.sh b/src/logging.sh
index e49dcb4..79df02b 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -487,7 +487,7 @@ rlFileSubmit -s '_' /etc/passwd -> etc_passwd
=cut
rlFileSubmit() {
- GETOPT=$(getopt -q -o s: -- "$@")
+ GETOPT=$(getopt -o s: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
eval set -- "$GETOPT"
SEPARATOR='-'
diff --git a/src/storage.sh b/src/storage.sh
index b3f7636..a1b4ae3 100644
--- a/src/storage.sh
+++ b/src/storage.sh
@@ -46,7 +46,7 @@ __INTERNAL_STORAGE_DEFAULT_NAMESPACE="GENERIC"
__INTERNAL_ST_OPTION_PARSER='
local namespace="$__INTERNAL_STORAGE_DEFAULT_NAMESPACE"
local section="$__INTERNAL_STORAGE_DEFAULT_SECTION"
- local GETOPT=$(getopt -o : -l namespace:,section: -- "$@") || return 126
+ local GETOPT=$(getopt -o : -l namespace:,section: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)) || return 126
eval set -- "$GETOPT"
while true; do
case $1 in
diff --git a/src/synchronisation.sh b/src/synchronisation.sh
index 3c7c275..dcff59d 100644
--- a/src/synchronisation.sh
+++ b/src/synchronisation.sh
@@ -118,7 +118,7 @@ __INTERNAL_wait_for_cmd() {
shift 1
# that is the GNU extended getopt syntax!
- local TEMP=$(getopt -o t:p:m:d:r: -n '$routine_name' -- "$@")
+ local TEMP=$(getopt -o t:p:m:d:r: -n '$routine_name' -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
if [[ $? != 0 ]] ; then
rlLogError "$routine_name: Can't parse command options, terminating..."
return 127
@@ -345,7 +345,7 @@ rlWaitForFile() {
local file=""
# that is the GNU extended getopt syntax!
- local TEMP=$(getopt -o t:p:d: -n 'rlWaitForFile' -- "$@")
+ local TEMP=$(getopt -o t:p:d: -n 'rlWaitForFile' -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
if [[ $? != 0 ]] ; then
rlLogError "rlWaitForSocket: Can't parse command options, terminating..."
return 127
@@ -436,7 +436,7 @@ rlWaitForSocket(){
local field="5"
# that is the GNU extended getopt syntax!
- local TEMP=$(getopt -o t:p:d: --longoptions close,remote -n 'rlWaitForSocket' -- "$@")
+ local TEMP=$(getopt -o t:p:d: --longoptions close,remote -n 'rlWaitForSocket' -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
if [[ $? != 0 ]] ; then
rlLogError "rlWaitForSocket: Can't parse command options, terminating..."
return 127
@@ -530,7 +530,7 @@ Signal used to kill the process, optional SIGTERM by default.
rlWait() {
# that is the GNU extended getopt syntax!
- local TEMP=$(getopt -o t:s: -n 'rlWait' -- "$@")
+ local TEMP=$(getopt -o t:s: -n 'rlWait' -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
if [[ $? != 0 ]]; then
rlLogError "rlWait: Can't parse command options, terminating..."
return 128
diff --git a/src/testing.sh b/src/testing.sh
index e97bd01..eceb402 100644
--- a/src/testing.sh
+++ b/src/testing.sh
@@ -717,7 +717,7 @@ explain what are you doing here).
Returns the exit code of the command run. Asserts PASS when
command\'s exit status is in the list of expected exit codes.
-Note:
+Note:
=over
@@ -754,7 +754,7 @@ B<Warning:> using C<unbuffer> tool is now disabled because of bug 547686.
#'
rlRun() {
- local __INTERNAL_rlRun_GETOPT=$(getopt -q -o lcts -- "$@")
+ local __INTERNAL_rlRun_GETOPT=$(getopt -o lcts -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
eval set -- "$__INTERNAL_rlRun_GETOPT"
local __INTERNAL_rlRun_DO_LOG=false
@@ -1194,7 +1194,7 @@ __INTERNAL_rlIsDistro(){
local whole="$(beakerlib-lsb_release -rs)"
local major="$(beakerlib-lsb_release -rs | cut -d '.' -f 1)"
local IFS
-
+
rlLogDebug "distro='$distro'"
rlLogDebug "major='$major'"
rlLogDebug "whole='$whole'"
--
2.17.2

View File

@ -0,0 +1,41 @@
From 01d3445a1798b20b4fd452c2fb7691b8dd35245c Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Sun, 28 Apr 2019 20:29:57 +0200
Subject: [PATCH 1/2] do not call submit_log command with -T option
the option -T was deprecated and the information is now gatheres via
RECIPETESTID environment variable
---
src/journal.sh | 2 +-
src/logging.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index 8a91276..f556ba9 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -259,7 +259,7 @@ rlJournalEnd(){
if [ -n "$TESTID" ] ; then
__INTERNAL_JournalXMLCreate
- $BEAKERLIB_COMMAND_SUBMIT_LOG -T $TESTID -l $__INTERNAL_BEAKERLIB_JOURNAL \
+ $BEAKERLIB_COMMAND_SUBMIT_LOG -l $__INTERNAL_BEAKERLIB_JOURNAL \
|| rlLogError "rlJournalEnd: Submit wasn't successful"
else
[[ "$BEAKERLIB_JOURNAL" == "0" ]] || rlLog "JOURNAL XML: $__INTERNAL_BEAKERLIB_JOURNAL"
diff --git a/src/logging.sh b/src/logging.sh
index 70c4c92..e49dcb4 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -528,7 +528,7 @@ rlFileSubmit() {
BEAKERLIB_COMMAND_SUBMIT_LOG="$__INTERNAL_DEFAULT_SUBMIT_LOG"
fi
- $BEAKERLIB_COMMAND_SUBMIT_LOG -T "$TESTID" -l "$TMPDIR/$ALIAS"
+ $BEAKERLIB_COMMAND_SUBMIT_LOG -l "$TMPDIR/$ALIAS"
RETVAL=$?
fi
rm -rf $TMPDIR
--
2.17.2