Compare commits

..

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

36 changed files with 325 additions and 1911 deletions

View File

@ -1 +1 @@
1f0a6b45d9eb6173b9526ea6b5184a3f6a8612ed SOURCES/beakerlib-1.17.tar.gz ef52fe7593350d81edb2cd1c80741291660ce460 beakerlib-1.29.2.tar.gz

6
.gitignore vendored
View File

@ -1 +1,5 @@
SOURCES/beakerlib-1.17.tar.gz *.tar.gz
*.rpm
.project
*.orig
*.rej

View File

@ -1,18 +0,0 @@
diff --git a/src/logging.sh b/src/logging.sh
index 95604c1..083d6d0 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -237,7 +238,12 @@ DEBUG=${DEBUG:-""}
rlLogDebug() {
if [ "$DEBUG" == 'true' -o "$DEBUG" == '1' -o "$LOG_LEVEL" == "DEBUG" ]; then
- rlLog "$1" "$2" "DEBUG" && rljAddMessage "$1" "DEBUG"
+ if [[ -n "$DEBUG_TO_CONSOLE_ONLY" ]]; then
+ local __INTERNAL_LogText_no_file=1
+ __INTERNAL_LogText "$1" "DEBUG"
+ else
+ rlLog "$1" "$2" "DEBUG"
+ fi
fi
}
rlLogInfo() { rlLog "$1" "$2" "INFO"; }

View File

@ -1,35 +0,0 @@
From 7381fd558e64559029980def31faf6661909eeb8 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Tue, 12 Dec 2017 16:04:01 +0100
Subject: [PATCH 16/18] nested phases enabled by default
this prevents some yet undocumented and officily unsupported behavoiur regression
---
src/journal.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index 374ddfc..516f292 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -539,7 +539,7 @@ rljAddPhase(){
# Printing
__INTERNAL_PrintHeadLog "$MSG"
- if [[ -z "$BEAKERLIB_NESTED_PHASES" ]]; then
+ if [[ "$BEAKERLIB_NESTED_PHASES" == "0" ]]; then
__INTERNAL_METAFILE_INDENT_LEVEL=2
__INTERNAL_PHASE_TYPE=( "$1" )
__INTERNAL_PHASE_NAME=( "$MSG" )
@@ -612,7 +612,7 @@ rljClosePhase(){
rm -f $logfile
# Reset of state variables
- if [[ -z "$BEAKERLIB_NESTED_PHASES" ]]; then
+ if [[ "$BEAKERLIB_NESTED_PHASES" == "0" ]]; then
__INTERNAL_METAFILE_INDENT_LEVEL=1
__INTERNAL_PHASE_TYPE=()
__INTERNAL_PHASE_NAME=()
--
2.14.3

View File

@ -1,106 +0,0 @@
From 44221b0c9970f11451016f4566602932861458e6 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Fri, 2 Feb 2018 15:06:58 +0100
Subject: [PATCH 4/5] extended coloring capabilities
this change allow to color result from other placed
---
src/logging.sh | 72 ++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 48 insertions(+), 24 deletions(-)
diff --git a/src/logging.sh b/src/logging.sh
index 38a0466..59709df 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -57,41 +57,65 @@ __INTERNAL_PrintText() {
__INTERNAL_LogText "$@"
}
+# $1 - text to color
+# $2 - variable to put the color sequence to
+# $3 - variable to put the uncolor sequence to
+__INTERNAL_get_prio_colors() {
+ local prio="$1" var_color="$2" var_uncolor="$3"
+ local ____COLOR='' ____UNCOLOR=''
+ if [[ -t 2 ]]; then
+ ____UNCOLOR="$__INTERNAL_color_reset"
+ case ${prio^^} in
+ DEBUG*)
+ ____COLOR="$__INTERNAL_color_purple"
+ ;;
+ PASS)
+ ____COLOR="$__INTERNAL_color_green"
+ ;;
+ FAIL|FATAL)
+ ____COLOR="$__INTERNAL_color_light_red"
+ ;;
+ LOG)
+ ____COLOR="$__INTERNAL_color_cyan"
+ ;;
+ LOG|INFO|BEGIN)
+ ____COLOR="$__INTERNAL_color_blue"
+ ;;
+ WARN*|SKIP*)
+ ____COLOR="$__INTERNAL_color_yellow"
+ ;;
+ esac
+ fi
+ eval "$var_color=\"${____COLOR}\""
+ eval "$var_uncolor=\"${____UNCOLOR}\""
+}
+
+# $1 - text to color
+# $2 - variable to put the result to
+__INTERNAL_colorize_prio() {
+ local prio="$1" var="$2"
+ local COLOR='' UNCOLOR=''
+ __INTERNAL_get_prio_colors "$prio" COLOR UNCOLOR
+ eval "$var=\"$COLOR$prio$UNCOLOR\""
+}
+
+# $1 - MESSAGE
+# $2 - prio
+# $3 - LOGFILE
+# $4 - MESSAGE_COLORED, if empty MESSAGE is used
__INTERNAL_LogText() {
local MESSAGE="$1"
- local MESSAGE_COLORED="${MESSAGE}"
+ local MESSAGE_COLORED="${4:-"$MESSAGE"}"
local prio="$2"
local LOGFILE=${3:-$OUTPUTFILE}
local res=0
local COLOR='' UNCOLOR=''
- if [[ -t 2 ]]; then
- UNCOLOR="$__INTERNAL_color_reset"
- case ${prio^^} in
- DEBUG*)
- COLOR="$__INTERNAL_color_purple"
- ;;
- PASS)
- COLOR="$__INTERNAL_color_green"
- ;;
- FAIL|FATAL)
- COLOR="$__INTERNAL_color_light_red"
- ;;
- LOG)
- COLOR="$__INTERNAL_color_cyan"
- ;;
- LOG|INFO|BEGIN)
- COLOR="$__INTERNAL_color_blue"
- ;;
- WARN*|SKIP*)
- COLOR="$__INTERNAL_color_yellow"
- ;;
- esac
- fi
[[ -n "$prio" ]] && {
local left=$(( (10+${#prio})/2 ))
local prefix prefix_colored timestamp
__INTERNAL_SET_TIMESTAMP
printf -v timestamp "%($__INTERNAL_TIMEFORMAT_SHORT)T" "$__INTERNAL_TIMESTAMP"
+ __INTERNAL_get_prio_colors "$prio" COLOR UNCOLOR
printf -v prefix_colored ":: [ %s ] :: [%s%*s%*s%s] ::" "$timestamp" "$COLOR" "$left" "${prio}" "$(( 10-$left ))" '' "$UNCOLOR"
printf -v prefix ":: [ %s ] :: [%*s%*s] ::" "$timestamp" "$left" "${prio}" "$(( 10-$left ))"
MESSAGE="$prefix $MESSAGE"
--
2.14.3

View File

@ -1,49 +0,0 @@
From 94c83310182228dcb959f390c6a513cbdebe4976 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Fri, 2 Feb 2018 15:13:46 +0100
Subject: [PATCH 3/5] move final summary printing to rlJournalEnd
also put the text to journal.txt
this will ensure the summary is always printed at the end and is also present in the text file
---
src/journal.sh | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index 04e4a10..867d08f 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -242,6 +242,8 @@ rlJournalEnd(){
__INTERNAL_ENDTIME=$__INTERNAL_TIMESTAMP
__INTERNAL_update_journal_txt
+ __INTERNAL_PrintHeadLog "${__INTERNAL_TEST_NAME}" 2>&1
+
if [ -n "$TESTID" ] ; then
__INTERNAL_JournalXMLCreate
$BEAKERLIB_COMMAND_SUBMIT_LOG -T $TESTID -l $__INTERNAL_BEAKERLIB_JOURNAL \
@@ -252,6 +254,10 @@ rlJournalEnd(){
fi
echo "#End of metafile" >> $__INTERNAL_BEAKERLIB_METAFILE
+
+ __INTERNAL_LogText "Phases: $__INTERNAL_PHASES_PASSED good, $__INTERNAL_PHASES_FAILED bad" LOG 2>&1
+ __INTERNAL_LogText "RESULT: $__INTERNAL_TEST_NAME" $__INTERNAL_PHASES_WORST_RESULT 2>&1
+
__INTERNAL_JournalXMLCreate
__INTERNAL_TestResultsSave
}
@@ -434,11 +440,6 @@ rlJournalPrintText(){
[[ -t 1 ]] && textfile="$__INTERNAL_BEAKERLIB_JOURNAL_COLORED" || textfile="$__INTERNAL_BEAKERLIB_JOURNAL_TXT"
cat "$textfile"
- local __INTERNAL_LogText_no_file=1
- __INTERNAL_PrintHeadLog "${__INTERNAL_TEST_NAME}" 2>&1
- __INTERNAL_LogText "Phases: $__INTERNAL_PHASES_PASSED good, $__INTERNAL_PHASES_FAILED bad" LOG 2>&1
- __INTERNAL_LogText "RESULT: $__INTERNAL_TEST_NAME" $__INTERNAL_PHASES_WORST_RESULT 2>&1
-
return 0
}
--
2.14.3

View File

@ -1,21 +0,0 @@
diff -u b/src/journal.sh b/src/journal.sh
--- b/src/journal.sh
+++ b/src/journal.sh
@@ -531,7 +531,7 @@
rljAddPhase(){
__INTERNAL_PersistentDataLoad
local MSG=${2:-"Phase of $1 type"}
- local TXTLOG_START=$(wc -l $__INTERNAL_BEAKERLIB_JOURNAL_TXT)
+ local TXTLOG_START=$(cat $__INTERNAL_BEAKERLIB_JOURNAL_TXT | wc -l)
rlLogDebug "rljAddPhase: Phase $MSG started"
__INTERNAL_WriteToMetafile phase --name "$MSG" --type "$1" >&2
# Printing
@@ -546,7 +546,7 @@
__INTERNAL_PHASE_FAILED=( 0 )
__INTERNAL_PHASE_PASSED=( 0 )
__INTERNAL_PHASE_STARTTIME=( $__INTERNAL_TIMESTAMP )
- __INTERNAL_PHASE_TXTLOG_START=( $(wc -l $__INTERNAL_BEAKERLIB_JOURNAL_TXT) )
+ __INTERNAL_PHASE_TXTLOG_START=( $TXTLOG_START )
__INTERNAL_PHASE_OPEN=${#__INTERNAL_PHASE_NAME[@]}
__INTERNAL_PHASE_METRICS=( "" )
else

View File

@ -1,52 +0,0 @@
diff -u b/src/journal.sh b/src/journal.sh
--- b/src/journal.sh
+++ b/src/journal.sh
@@ -283,8 +297,25 @@
#=cut
__INTERNAL_JournalXMLCreate() {
- [[ "$BEAKERLIB_JOURNAL" == "0" ]] || $__INTERNAL_JOURNALIST $__INTERNAL_XSLT --metafile \
- "$__INTERNAL_BEAKERLIB_METAFILE" --journal "$__INTERNAL_BEAKERLIB_JOURNAL"
+ local res=0
+ [[ "$BEAKERLIB_JOURNAL" == "0" ]] || {
+ if which python &> /dev/null; then
+ $__INTERNAL_JOURNALIST $__INTERNAL_XSLT --metafile \
+ "$__INTERNAL_BEAKERLIB_METAFILE" --journal "$__INTERNAL_BEAKERLIB_JOURNAL"
+ res=$?
+ if [[ $res -eq 2 ]]; then
+ rlLogError "cannot create journal.xml due to missing some python module"
+ elif [[ $res -eq 3 ]]; then
+ rlLogError "cannot create journal.xml due to missing python lxml module"
+ elif [[ $res -ne 0 ]]; then
+ rlLogError "journal.xml creation failed!"
+ fi
+ else
+ rlLogError "cannot create journal.xml due to missing python interpreter"
+ let res++
+ fi
+ }
+ return $res
}
diff -u b/src/python/journalling.py b/src/python/journalling.py
--- b/src/python/journalling.py
+++ b/src/python/journalling.py
@@ -30,11 +30,15 @@
import six
import time
import base64
- from lxml import etree
from optparse import OptionParser
except ImportError as e:
sys.stderr.write("Python ImportError: " + str(e) + "\nExiting unsuccessfully.\n")
- exit(1)
+ exit(2)
+try:
+ from lxml import etree
+except ImportError as e:
+ sys.stderr.write("Python ImportError: " + str(e) + "\nExiting unsuccessfully.\n")
+ exit(3)
xmlForbidden = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18, 19, 20,

View File

@ -1,128 +0,0 @@
diff -u b/src/journal.sh b/src/journal.sh
--- b/src/journal.sh
+++ b/src/journal.sh
@@ -431,12 +431,10 @@
[[ -t 1 ]] && textfile="$__INTERNAL_BEAKERLIB_JOURNAL_COLORED" || textfile="$__INTERNAL_BEAKERLIB_JOURNAL_TXT"
cat "$textfile"
- local tmp="$__INTERNAL_LogText_no_file"
- __INTERNAL_LogText_no_file=1
+ local __INTERNAL_LogText_no_file=1
__INTERNAL_PrintHeadLog "${TEST}" 2>&1
__INTERNAL_LogText "Phases: $__INTERNAL_PHASES_PASSED good, $__INTERNAL_PHASES_FAILED bad" LOG 2>&1
__INTERNAL_LogText "RESULT: $TEST" $__INTERNAL_PHASES_WORST_RESULT 2>&1
- __INTERNAL_LogText_no_file=$tmp
return 0
}
@@ -645,6 +643,7 @@
# $2 result
# $3 command
rljAddTest(){
+ local IFS
__INTERNAL_PersistentDataLoad
if [ $__INTERNAL_PHASE_OPEN -eq 0 ]; then
rlPhaseStart "FAIL" "Asserts collected outside of a phase"
@@ -723,6 +722,7 @@
# Creates header
__INTERNAL_CreateHeader(){
+ local IFS
__INTERNAL_PrintHeadLog "TEST PROTOCOL" 2> /dev/null
@@ -816,7 +816,7 @@
local count=0
local type="unknown"
local cpu_regex="^model\sname.*: (.*)$"
- while read line; do
+ while read -r line; do
if [[ "$line" =~ $cpu_regex ]]; then
type="${BASH_REMATCH[1]}"
let count++
@@ -830,7 +830,7 @@
if [[ -f "/proc/meminfo" ]]; then
size=0
local ram_regex="^MemTotal: *(.*) kB$"
- while read line; do
+ while read -r line; do
if [[ "$line" =~ $ram_regex ]]; then
size=`expr ${BASH_REMATCH[1]} / 1024`
break
diff -u b/src/logging.sh b/src/logging.sh
--- b/src/logging.sh
+++ b/src/logging.sh
@@ -53,10 +53,8 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__INTERNAL_PrintText() {
- local tmp="$__INTERNAL_LogText_no_file"
- __INTERNAL_LogText_no_file=1
+ local __INTERNAL_LogText_no_file=1
__INTERNAL_LogText "$@"
- __INTERNAL_LogText_no_file=$tmp
}
__INTERNAL_LogText() {
@@ -531,6 +529,7 @@
rlShowPackageVersion()
{
local score=0
+ local IFS
if [ $# -eq 0 ]; then
rlLogWarning "rlShowPackageVersion: Too few options"
return 1
only in patch2:
unchanged:
--- a/src/analyze.sh
+++ b/src/analyze.sh
@@ -76,6 +76,7 @@ Return 0 if... TODO
=cut
rlDejaSum(){
+ local IFS
rlLog "Summarizing files: $1 $2"
rlLogDebug "Calling beakerlib-deja-summarize routine"
beakerlib-deja-summarize $1 $2 | while read line
only in patch2:
unchanged:
--- a/src/libraries.sh
+++ b/src/libraries.sh
@@ -268,9 +268,10 @@ __INTERNAL_envdebugget() {
__INTERNAL_envdebugdiff() {
rlLogDebug "rlImport: library $1 changes following environment; changed functions are marked with asterisk (*)"
diff -U0 <(echo "$__INTERNAL_envdebugvariables") <(__INTERNAL_envdebugget 1) | tail -n +3 | grep -E -v '^@@'
- local line fn print='' print2 LF="
-"
- while IFS= read line; do
+ local line fn print='' print2 LF=$'\n'
+ local IFS
+
+ while read -r line; do
[[ "$line" =~ ^(.)([^[:space:]]+)[[:space:]]\(\) ]] && {
[[ -n "$print" ]] && {
echo "$fn"
only in patch2:
unchanged:
--- a/src/rpms.sh
+++ b/src/rpms.sh
@@ -56,6 +56,7 @@ __INTERNAL_RpmPresent() {
local version=$3
local release=$4
local arch=$5
+ local IFS
local package=$name-$version-$release.$arch
[ "$arch" == "" ] && package=$name-$version-$release
only in patch2:
unchanged:
--- a/src/testing.sh
+++ b/src/testing.sh
@@ -749,6 +749,7 @@ rlRun() {
local __INTERNAL_rlRun_TAG_OUT=''
local __INTERNAL_rlRun_TAG_ERR=''
local __INTERNAL_rlRun_LOG_FILE=''
+ local IFS
while true ; do
case "$1" in

View File

@ -1,64 +0,0 @@
diff -u b/src/python/journalling.py b/src/python/journalling.py
--- b/src/python/journalling.py
+++ b/src/python/journalling.py
@@ -27,7 +27,6 @@
import re
from optparse import OptionParser
from lxml import etree
-import shlex
import base64
# TODO fix xml pretty print
@@ -100,8 +99,8 @@
# Count number of leading spaces
indent = len(line) - len(line.lstrip())
- # using shlex to get rid of the quotes
- splitted = shlex.split(line)
+ # splitting the line into list
+ splitted = line.split()
# if the line is not empty
if splitted:
@@ -118,7 +117,9 @@
for part in splitted:
# if flag is set, string is an elements content
if CONTENT_FLAG == 1:
- content = base64.b64decode(part)
+ # First and last characters(quotes) stripped and
+ # string is decoded from base64
+ content = base64.b64decode(part[1:-1])
# end parsing after content is stored
break
# test if string is an elements content indicator
@@ -128,13 +129,15 @@
# test if string is an elements time attribute
if re.match(r'^--timestamp=', part):
attribute_name = "timestamp"
- attribute_value = part.split('=', 1)[1]
+ # Value is string after '=' sign and without first abd last char(quotes)
+ attribute_value = part.split('=', 1)[1][1:-1]
attributes[attribute_name] = time.strftime(TIME_FORMAT, time.localtime(int(attribute_value)))
continue
# test if string is an elements regular attribute
if re.match(r'^--[a-zA-Z0-9]+=', part):
attribute_name = part.split('=', 1)[0][2:]
- attribute_value = part.split('=', 1)[1]
+ # Value is string after '=' sign and without first abd last char(quotes)
+ attribute_value = part.split('=', 1)[1][1:-1]
attributes[attribute_name] = base64.b64decode(attribute_value)
continue
@@ -145,7 +148,11 @@
# information given as parameters
def createElement(element, attributes, content):
element = unicode(element, 'utf-8', errors='replace').translate(xmlTrans)
- new_el = etree.Element(element)
+ try:
+ new_el = etree.Element(element)
+ except ValueError, e:
+ sys.stderr.write('Failed to create element with name %s\nError: %s\nExiting unsuccessfully.\n' % (element, e))
+ exit(1)
content = unicode(content, 'utf-8', errors='replace').translate(xmlTrans)
new_el.text = content

View File

@ -1,44 +0,0 @@
From 59f7e0b123fc9789538f610a89d350d76c35106b Mon Sep 17 00:00:00 2001
From: Jakub Heger <jheger@redhat.com>
Date: Wed, 22 Aug 2018 12:37:49 +0200
Subject: [PATCH 2/4] journalling: try import
imports are now in try block, exceptions cause unsuccessful exit with
error message printed
---
src/python/journalling.py | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/python/journalling.py b/src/python/journalling.py
index 220d5d2..7a65d78 100755
--- a/src/python/journalling.py
+++ b/src/python/journalling.py
@@ -23,14 +23,18 @@
# TODO fix xml pretty print
-import os
-import re
-import sys
-import six
-import time
-import base64
-from lxml import etree
-from optparse import OptionParser
+try:
+ import os
+ import re
+ import sys
+ import six
+ import time
+ import base64
+ from lxml import etree
+ from optparse import OptionParser
+except ImportError as e:
+ sys.stderr.write("Python ImportError: " + str(e) + "\nExiting unsuccessfully.\n")
+ exit(1)
xmlForbidden = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18, 19, 20,
--
2.17.1

View File

@ -1,30 +0,0 @@
diff -u a/src/journal.sh b/src/journal.sh
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -918,13 +918,13 @@
while [[ $# -gt 0 ]]; do
case $1 in
--)
- line+=" -- \"$(echo -n "$2" | base64 -w 0)\""
+ line+=" -- $(echo -n "$2" | base64 -w 0)"
printf -v lineraw "%s -- %q" "$lineraw" "$2"
shift 2
break
;;
--*)
- line+=" $1=\"$(echo -n "$2" | base64 -w 0)\""
+ line+=" $1=$(echo -n "$2" | base64 -w 0)"
printf -v lineraw "%s %s=%q" "$lineraw" "$1" "$2"
shift
;;
@@ -944,8 +944,8 @@
printf -v indent '%*s' $__INTERNAL_METAFILE_INDENT_LEVEL
- line="$indent${element:+$element }--timestamp=\"${__INTERNAL_TIMESTAMP}\"$line"
- lineraw="$indent${element:+$element }--timestamp=\"${__INTERNAL_TIMESTAMP}\"$lineraw"
+ line="$indent${element:+$element }--timestamp=${__INTERNAL_TIMESTAMP}$line"
+ lineraw="$indent${element:+$element }--timestamp=${__INTERNAL_TIMESTAMP}$lineraw"
[[ -n "$DEBUG" ]] && echo "#${lineraw:1}" >> $__INTERNAL_BEAKERLIB_METAFILE
echo "$line" >> $__INTERNAL_BEAKERLIB_METAFILE
}

View File

@ -1,76 +0,0 @@
From e866044b7d2050c5558de8e8e2cc7f7d7f34e715 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Fri, 2 Feb 2018 11:41:00 +0100
Subject: [PATCH 2/5] fixed persistent data load for bash <= 4.1.2
there's no '-g' option to declare in bash <= 4.1.2
therefore declare cannot be used for this purpose
---
src/journal.sh | 51 +++++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index f35d03b..04e4a10 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -937,31 +937,34 @@ __INTERNAL_PrintHeadLog() {
# functions __INTERNAL_PersistentDataLoad and __INTERNAL_PersistentDataSave
# should be called before and after that respectively.
+__INTERNAL_PersistentDataSave_sed='s/^declare/\0 -g/'
+# ugly workaround for bash-4.1.2 and older, where -g does not exist
+# there might be an issue when there's a line break in the variables and there's
+# "")'" or "()'" at the end of the line. This should not never happen, the worst
+# case might happen in the phase name but is is not expected to contain line
+# breaks
+declare -g &> /dev/null || __INTERNAL_PersistentDataSave_sed="s/(^declare -a[^=]+=)'\(/\1(/;s/([\"(]\))'$/\1/;s/declare\s+\S+\s+([^=]+=)/\1/"
+
__INTERNAL_PersistentDataSave() {
- local var
- (
- for var in \
- __INTERNAL_STARTTIME \
- __INTERNAL_TEST_STATE \
- __INTERNAL_PHASES_PASSED \
- __INTERNAL_PHASES_FAILED \
- __INTERNAL_PHASES_SKIPPED \
- __INTERNAL_JOURNAL_OPEN \
- __INTERNAL_PHASE_OPEN \
- __INTERNAL_PHASES_WORST_RESULT \
- __INTERNAL_METAFILE_INDENT_LEVEL \
- __INTERNAL_PHASE_TYPE \
- __INTERNAL_PHASE_NAME \
- __INTERNAL_PHASE_FAILED \
- __INTERNAL_PHASE_PASSED \
- __INTERNAL_PHASE_STARTTIME \
- __INTERNAL_PHASE_TXTLOG_START \
- __INTERNAL_PHASE_METRICS \
- ;
- do
- declare -p $var
- done
- ) | sed -r 's/declare/\0 -g/' > "$__INTERNAL_PERSISTENT_DATA"
+ declare -p \
+ __INTERNAL_STARTTIME \
+ __INTERNAL_TEST_STATE \
+ __INTERNAL_PHASES_PASSED \
+ __INTERNAL_PHASES_FAILED \
+ __INTERNAL_PHASES_SKIPPED \
+ __INTERNAL_JOURNAL_OPEN \
+ __INTERNAL_PHASE_OPEN \
+ __INTERNAL_PHASES_WORST_RESULT \
+ __INTERNAL_METAFILE_INDENT_LEVEL \
+ __INTERNAL_PHASE_TYPE \
+ __INTERNAL_PHASE_NAME \
+ __INTERNAL_PHASE_FAILED \
+ __INTERNAL_PHASE_PASSED \
+ __INTERNAL_PHASE_STARTTIME \
+ __INTERNAL_PHASE_TXTLOG_START \
+ __INTERNAL_PHASE_METRICS \
+ __INTERNAL_TEST_NAME \
+ | sed -r "$__INTERNAL_PersistentDataSave_sed" > "$__INTERNAL_PERSISTENT_DATA"
}
__INTERNAL_PersistentDataLoad() {
--
2.14.3

View File

@ -1,13 +0,0 @@
diff --git a/src/journal.sh b/src/journal.sh
index 516f292..0ad9913 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -608,7 +625,7 @@ rljClosePhase(){
__INTERNAL_LogText ''
local logfile="$(mktemp)"
tail -n +$((__INTERNAL_PHASE_TXTLOG_START+1)) $__INTERNAL_BEAKERLIB_JOURNAL_TXT > $logfile
- rlReport "$(echo "$name" | sed 's/[^[:alnum:]]\+/-/g')" "$result" "$score" "$logfile"
+ rlReport "$(echo "${name//[^[:alnum:]]/-}" | tr -s '-')" "$result" "$score" "$logfile"
rm -f $logfile
# Reset of state variables

View File

@ -1,66 +0,0 @@
diff -u a/src/python/daemonize.py b/src/python/daemonize.py
--- a/src/python/daemonize.py
+++ b/src/python/daemonize.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/libexec/platform-python
# Authors: Jiri Jaburek <jjaburek@redhat.com>
#
diff -u a/src/python/journal-compare.py b/src/python/journal-compare.py
--- a/src/python/journal-compare.py
+++ b/src/python/journal-compare.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/libexec/platform-python
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
diff -u a/src/python/journalling.py b/src/python/journalling.py
--- a/src/python/journalling.py
+++ b/src/python/journalling.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/libexec/platform-python
# Authors: Jakub Heger <jheger@redhat.com>
# Dalibor Pospisil <dapospis@redhat.com>
diff -u a/src/python/rlMemAvg.py b/src/python/rlMemAvg.py
--- a/src/python/rlMemAvg.py
+++ b/src/python/rlMemAvg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/libexec/platform-python
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -u a/src/python/rlMemPeak.py b/src/python/rlMemPeak.py
--- a/src/python/rlMemPeak.py
+++ b/src/python/rlMemPeak.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/libexec/platform-python
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -u a/src/python/testwatcher.py b/src/python/testwatcher.py
--- a/src/python/testwatcher.py
+++ b/src/python/testwatcher.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/libexec/platform-python
#
# Authors: Jiri Jaburek <jjaburek@redhat.com>
#
diff -u a/src/journal.sh b/src/journal.sh
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -285,7 +285,7 @@
__INTERNAL_JournalXMLCreate() {
local res=0
[[ "$BEAKERLIB_JOURNAL" == "0" ]] || {
- if which python &> /dev/null; then
+ if which /usr/libexec/platform-python &> /dev/null; then
$__INTERNAL_JOURNALIST $__INTERNAL_XSLT --metafile \
"$__INTERNAL_BEAKERLIB_METAFILE" --journal "$__INTERNAL_BEAKERLIB_JOURNAL"
res=$?

View File

@ -1,45 +0,0 @@
diff -u a/src/python/journal-compare.py b/python/journal-compare.py
--- a/src/python/journal-compare.py 2018-05-15 16:16:15.198835559 +0200
+++ b/src/python/journal-compare.py 2017-10-17 23:11:48.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
diff -u a/src/python/journalling.py b/src/python/journalling.py
--- a/src/python/journalling.py 2018-05-15 16:16:21.517818632 +0200
+++ b/src/python/journalling.py 2017-10-17 23:11:48.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# Authors: Jakub Heger <jheger@redhat.com>
# Dalibor Pospisil <dapospis@redhat.com>
diff -u a/src/python/rlMemAvg.py b/src/python/rlMemAvg.py
--- a/src/python/rlMemAvg.py 2018-05-15 16:16:24.976809367 +0200
+++ b/src/python/rlMemAvg.py 2017-10-17 23:11:48.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -u a/src/python/rlMemPeak.py b/src/python/rlMemPeak.py
--- a/src/python/rlMemPeak.py 2018-05-15 16:16:29.153798179 +0200
+++ b/src/python/rlMemPeak.py 2017-10-17 23:11:48.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -u a/src/python/testwatcher.py b/beakerlib-1.17/src/python/testwatcher.py
--- a/src/python/testwatcher.py 2018-05-15 16:16:35.369781528 +0200
+++ b/src/python/testwatcher.py 2017-10-17 23:11:48.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python -u
+#!/usr/bin/python2 -u
#
# Authors: Jiri Jaburek <jjaburek@redhat.com>
#

View File

@ -1,510 +0,0 @@
diff -u a/src/python/daemonize.py b/src/python/new/daemonize.py
--- a/src/python/daemonize.py 2017-10-17 23:11:48.000000000 +0200
+++ b/src/python/new/daemonize.py 2018-06-25 21:06:09.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# Authors: Jiri Jaburek <jjaburek@redhat.com>
#
@@ -18,6 +18,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+from __future__ import print_function
import os, sys
from pwd import getpwnam
@@ -96,8 +97,8 @@
# with original stderr (in case of errors), but with new uid/gid
if ioredir:
os.open(ioredir[0], os.O_RDWR)
- os.open(ioredir[1], os.O_RDWR | os.O_CREAT | os.O_TRUNC, 0666)
- os.open(ioredir[2], os.O_RDWR | os.O_CREAT | os.O_TRUNC, 0666)
+ os.open(ioredir[1], os.O_RDWR | os.O_CREAT | os.O_TRUNC, 0o666)
+ os.open(ioredir[2], os.O_RDWR | os.O_CREAT | os.O_TRUNC, 0o666)
os.umask(0)
@@ -116,7 +117,7 @@
# argument parsing
def error(msg):
- print >> sys.stderr, "error: " + str(msg)
+ print("error: " + str(msg), file=sys.stderr)
sys.exit(1)
parser = OptionParser(usage='%prog [options] COMMAND')
diff -u a/src/python/journal-compare.py b/src/python/new/journal-compare.py
--- a/src/python/journal-compare.py 2018-06-25 21:01:54.490910141 +0200
+++ b/src/python/new/journal-compare.py 2018-06-25 21:06:13.000000000 +0200
@@ -1,6 +1,6 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
-# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# 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.
@@ -15,6 +15,7 @@
#
# Author: Petr Muller <pmuller@redhat.com>
+from __future__ import print_function
import xml.dom.minidom
import sys
@@ -125,9 +126,9 @@
self.results = {}
def addTestResult(self, name, result):
- if not self.results.has_key(name):
- self.results[name] = Test(name)
- self.results[name].addResult(result)
+ if name not in self.results:
+ self.results[name] = Test(name)
+ self.results[name].addResult(result)
def compare(self, other):
result_list = []
@@ -135,7 +136,7 @@
try:
result_list.append(self.results[key].compare(other.results[key]))
except KeyError:
- print "[WARN] Could not find corresponding test for: %s" % key
+ print("[WARN] Could not find corresponding test for: %s" % key)
return result_list
try:
@@ -161,7 +162,7 @@
new_type, new_name = new_phases[i].getAttribute("type"), new_phases[i].getAttribute("name")
if old_type == new_type and old_name == new_name:
- print "Types match, so we are comparing phase %s of type %s" % (old_type, new_type)
+ print( "Types match, so we are comparing phase %s of type %s" % (old_type, new_type))
old_tests = TestSet()
new_tests = TestSet()
old_metrics = {}
@@ -179,20 +180,20 @@
tolerance = float(metric.getAttribute("tolerance"))
metrics[key] = Metric(key, value, metric.getAttribute("type"), tolerance)
- print "==== Actual compare ===="
- print " * Metrics * "
+ print("==== Actual compare ====")
+ print(" * Metrics * ")
metric_results = []
for key in old_metrics.keys():
metric_results.append(old_metrics[key].compare(new_metrics[key]))
for metric in metric_results:
for message in metric.messages:
- print "[%s] %s (%s)" % (metric.result, metric.name, message)
- print " * Tests * "
+ print("[%s] %s (%s)" % (metric.result, metric.name, message))
+ print(" * Tests * ")
test_results = old_tests.compare(new_tests)
for test in test_results:
- print "[%s] %s" % (test.result, test.name)
+ print("[%s] %s" % (test.result, test.name))
for message in test.messages:
- print "\t - %s" % message
+ print("\t - %s" % message)
else:
- print "We are not doing any compare, types dont match"
+ print("We are not doing any compare, types dont match")
diff -u a/src/python/journalling.py b/src/python/new/journalling.py
--- a/src/python/journalling.py 2018-06-25 21:01:54.490910141 +0200
+++ b/src/python/new/journalling.py 2018-06-25 21:06:19.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Authors: Jakub Heger <jheger@redhat.com>
# Dalibor Pospisil <dapospis@redhat.com>
@@ -20,16 +20,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# TODO fix xml pretty print
+
-import sys
import os
-import time
import re
-from optparse import OptionParser
-from lxml import etree
+import sys
+import six
+import time
import base64
-
-# TODO fix xml pretty print
+from lxml import etree
+from optparse import OptionParser
xmlForbidden = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18, 19, 20,
@@ -51,18 +52,19 @@
return self.items[-1]
+# Saves the XML journal to a file.
def saveJournal(journal, journal_path):
try:
output = open(journal_path, 'wb')
output.write(etree.tostring(journal, xml_declaration=True, encoding='utf-8', pretty_print=True))
output.close()
return 0
- except IOError, e:
+ except IOError as e:
sys.stderr.write('Failed to save journal to %s: %s' % (journal_path, str(e)))
return 1
-# Adds attributes starttime and endtime to a element
+# Adds attributes starttime and endtime to a element.
def addStartEndTime(element, starttime, endtime):
element.set("starttime", starttime)
element.set("endtime", endtime)
@@ -72,7 +74,7 @@
return 0
-# Find first and last timestamp to fill in starttime and endtime elements of given element
+# Find first and last timestamp to fill in starttime and endtime attributes of given element.
def getStartEndTime(element):
starttime = ""
endtime = ""
@@ -87,7 +89,7 @@
# Parses and decodes lines given to it
# Returns number of spaces before element, name of the element,
-# its attributes in a dictionary, and content of the element
+# its attributes in a dictionary, and content of the element.
def parseLine(line):
TIME_FORMAT = "%Y-%m-%d %H:%M:%S %Z"
CONTENT_FLAG = 0
@@ -99,12 +101,12 @@
# Count number of leading spaces
indent = len(line) - len(line.lstrip())
- # splitting the line into list
+ # Splitting the line into a list
splitted = line.split()
- # if the line is not empty
+ # If the line is not empty
if splitted:
- # if first 2 characters are '-', it is not new element, but ending of pair element
+ # If first 2 characters are '-', it is not new element, but ending of pair element
if splitted[0][0] == '-' and splitted[0][1] == '-':
element = ""
else:
@@ -113,53 +115,82 @@
else:
return 0, "", {}, ""
- # parsing the rest of the line
+ # Parsing the rest of the line
for part in splitted:
- # if flag is set, string is an elements content
+ # If flag is set, string is an elements content
if CONTENT_FLAG == 1:
- # First and last characters(quotes) stripped and
- # string is decoded from base64
- content = base64.b64decode(part[1:-1])
- # end parsing after content is stored
+ # String is decoded from base64
+ try:
+ content = base64.b64decode(part)
+ except TypeError as e:
+ sys.stderr.write('Failed to decode string \'%s\' from base64.\
+ \nError: %s\nExiting unsuccessfully.\n' % (part[1:-1], e))
+ exit(1)
+ # End parsing after content is stored
break
- # test if string is an elements content indicator
+ # Test if string is an elements content indicator
if part == '--':
CONTENT_FLAG = 1
continue
- # test if string is an elements time attribute
+
+ # Test if string is the elements time attribute
if re.match(r'^--timestamp=', part):
attribute_name = "timestamp"
- # Value is string after '=' sign and without first abd last char(quotes)
- attribute_value = part.split('=', 1)[1][1:-1]
- attributes[attribute_name] = time.strftime(TIME_FORMAT, time.localtime(int(attribute_value)))
+ # Value is string after '=' sign
+ attribute_value = part.split('=', 1)[1]
+ try:
+ attributes[attribute_name] = time.strftime(TIME_FORMAT, time.localtime(int(attribute_value)))
+ except ValueError as e:
+ sys.stderr.write('Failed to convert timestamp attribute to int.\
+ \nError: %s\nExiting unsuccessfully.\n' % (e))
+ exit(1)
continue
- # test if string is an elements regular attribute
+
+ # Test if string is the elements regular attribute
if re.match(r'^--[a-zA-Z0-9]+=', part):
attribute_name = part.split('=', 1)[0][2:]
- # Value is string after '=' sign and without first abd last char(quotes)
- attribute_value = part.split('=', 1)[1][1:-1]
- attributes[attribute_name] = base64.b64decode(attribute_value)
+ # Value is string after '=' sign
+ attribute_value = part.split('=', 1)[1]
+ try:
+ attributes[attribute_name] = base64.b64decode(attribute_value)
+ except TypeError as e:
+ sys.stderr.write('Failed to decode string \'%s\' from base64.\
+ \nError: %s\nExiting unsuccessfully.\n' % (attribute_value, e))
+ exit(1)
continue
return indent, element, attributes, content
-# Returns xml element created with
+# Returns XML element created with
# information given as parameters
def createElement(element, attributes, content):
- element = unicode(element, 'utf-8', errors='replace').translate(xmlTrans)
+ # In python 3 decoding from base64 causes retyping into bytes.
+ if isinstance(element, bytes):
+ # First bytes are decoded from utf8.
+ element = element.decode('utf8', 'replace')
+ # And then retyped to string, using 'six' module which adds python 2/3 compatible methods.
+ # XML not compatible characters are then also stripped from the string.
+ element = six.text_type(element).translate(xmlTrans)
+
try:
new_el = etree.Element(element)
- except ValueError, e:
+ except ValueError as e:
sys.stderr.write('Failed to create element with name %s\nError: %s\nExiting unsuccessfully.\n' % (element, e))
exit(1)
- content = unicode(content, 'utf-8', errors='replace').translate(xmlTrans)
- new_el.text = content
-
- for key, value in attributes.iteritems():
- key = unicode(key, 'utf-8', errors='replace').translate(xmlTrans)
- value = unicode(value, 'utf-8', errors='replace').translate(xmlTrans)
+ if isinstance(content, bytes):
+ content = content.decode('utf8', 'replace')
+ new_el.text = six.text_type(content).translate(xmlTrans)
+
+ for key, value in attributes.items():
+ if isinstance(key, bytes):
+ key = key.decode('utf8', 'replace')
+ key = six.text_type(key).translate(xmlTrans)
+
+ if isinstance(value, bytes):
+ value = value.decode('utf8', 'replace')
+ value = six.text_type(value).translate(xmlTrans)
new_el.set(key, value)
return new_el
@@ -172,7 +203,7 @@
if options.metafile:
try:
fh = open(options.metafile, 'r+')
- except IOError, e:
+ except IOError as e:
sys.stderr.write('Failed to open queue file with' + str(e), 'FAIL')
return 1
@@ -205,8 +236,8 @@
previous_el = new_el
elif indent == old_indent:
- # Closing element with updates to it with no elements inside it
# TODO refactor
+ # Closing element with updates to it with no elements inside it
if element == "":
# Updating start and end time
starttime, endtime = getStartEndTime(previous_el)
@@ -214,9 +245,9 @@
if "timestamp" in attributes:
endtime = attributes["timestamp"]
# Updating attributes found on closing line
- for key, value in attributes.iteritems():
+ for key, value in attributes.items():
previous_el.set(key, value)
- # add start/end time and remove timestamp attribute
+ # Add start/end time and remove timestamp attribute
addStartEndTime(previous_el, starttime, endtime)
# New element is on the same level as previous one
else:
@@ -231,7 +262,7 @@
elif indent < old_indent:
# Difference between indent levels = how many paired elements will be closed
indent_diff = old_indent - indent
- for _ in xrange(indent_diff):
+ for _ in range(indent_diff):
el_stack.peek().append(previous_el)
previous_el = el_stack.pop()
@@ -243,9 +274,9 @@
if "timestamp" in attributes:
endtime = attributes["timestamp"]
# Updating attributes found on closing line
- for key, value in attributes.iteritems():
+ for key, value in attributes.items():
previous_el.set(key, value)
- # add start/end time and remove timestamp attribute
+ # Add start/end time and remove timestamp attribute
addStartEndTime(previous_el, starttime, endtime)
# Ending paired element and creating new one on the same level as the paired one that just ended
@@ -285,9 +316,9 @@
xslt = etree.parse(options.xslt)
transform = etree.XSLT(xslt)
journal = transform(journal)
- except etree.LxmlError:
- sys.stderr.write("\nTransformation template file " + options.xslt +
- " could not be parsed.\nAborting journal creation.")
+ except etree.LxmlError as e:
+ sys.stderr.write("\nTransformation template file \'" + options.xslt +
+ "\' could not be parsed.\nError: %s\nAborting journal creation.") % (e)
return 1
if options.journal:
diff -u a/src/python/rlMemAvg.py b/src/python/new/rlMemAvg.py
--- a/src/python/rlMemAvg.py 2018-06-25 21:01:54.490910141 +0200
+++ b/src/python/new/rlMemAvg.py 2018-06-25 21:06:24.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Authors: Petr Muller <pmuller@redhat.com>
#
@@ -18,6 +18,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+from __future__ import print_function
import sys, time, re
use_sub = False
@@ -31,7 +32,7 @@
use_popen = True
if len(sys.argv) < 2:
- print 'syntax: rlMemAvg <command>'
+ print('syntax: rlMemAvg <command>')
sys.exit(1)
proglist = sys.argv[1:]
@@ -59,4 +60,4 @@
if (use_sub and finish != None) or (use_popen and finish != -1):
break
-print "%d" % (memsum/tick)
+print("%d" % (memsum/tick))
diff -u a/src/python/rlMemPeak.py b/src/python/new/rlMemPeak.py
--- a/src/python/rlMemPeak.py 2018-06-25 21:01:54.491910137 +0200
+++ b/src/python/new/rlMemPeak.py 2018-06-25 21:06:28.000000000 +0200
@@ -1,6 +1,6 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
-# Authors: Petr Muller <pmuller@redhat.com>
+# Authors: Petr Muller <pmuller@redhat.com>
#
# Description: Prints a memory consumption peak of an executed program
#
@@ -18,6 +18,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+from __future__ import print_function
import sys, time, re
use_sub = False
@@ -31,7 +32,7 @@
use_popen = True
if len(sys.argv) < 2:
- print 'syntax: rlMemPeak <command>'
+ print('syntax: rlMemPeak <command>')
sys.exit(1)
proglist = sys.argv[1:]
@@ -57,4 +58,4 @@
if (use_sub and finish != None) or (use_popen and finish != -1):
break
-print "%d" % (maxmem)
+print("%d" % (maxmem))
diff -u a/src/python/testwatcher.py b/src/python/new/testwatcher.py
--- a/src/python/testwatcher.py 2018-06-25 21:01:54.491910137 +0200
+++ b/src/python/new/testwatcher.py 2018-06-25 21:06:32.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python2 -u
+#!/usr/bin/python3
#
# Authors: Jiri Jaburek <jjaburek@redhat.com>
#
@@ -54,6 +54,7 @@
# and the test sends the cleanup path to the watcher again
+from __future__ import print_function
import os
import sys
import signal
@@ -105,12 +106,12 @@
### HELPERS
#
def debug(msg):
- print 'TESTWATCHER: '+msg
+ print('TESTWATCHER: '+msg)
sys.stdout.flush()
def fatal(msg):
- print >> sys.stderr, 'TESTWATCHER fatal: '+msg
+ print('TESTWATCHER fatal: '+msg, file=sys.stderr)
sys.stderr.flush()
sys.exit(1)
@@ -153,13 +154,13 @@
debug('hooking beah LWD')
try:
os.makedirs(os.path.dirname(lwd_guard_file))
- except OSError, e:
+ except OSError as e:
if e.errno == errno.EEXIST:
pass
f = open(lwd_guard_file, 'w')
f.write(watchdog_guard_cont)
f.close()
- os.chmod(lwd_guard_file, 0755)
+ os.chmod(lwd_guard_file, 0o755)
# called when EWD (external watchdog) is about to expire
@@ -234,7 +235,7 @@
try:
os.waitpid(cleanuppid, 0)
cleanuppid = 0
- except OSError, e:
+ except OSError as e:
if e.errno == errno.EINTR:
pass
if e.errno == errno.ECHILD:
@@ -291,7 +292,7 @@
# wait for entire process group
os.waitpid(testpid, 0)
testpid = 0
- except OSError, e:
+ except OSError as e:
# no traceback if interrupted by a signal
if e.errno == errno.EINTR:
pass

View File

@ -1,82 +0,0 @@
diff --git a/src/journal.sh b/src/journal.sh
index 516f292..0ad9913 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -118,7 +131,6 @@ rlJournalStart(){
export __INTERNAL_PERSISTENT_DATA="$BEAKERLIB_DIR/PersistentData"
export __INTERNAL_TEST_RESULTS="$BEAKERLIB_DIR/TestResults"
export __INTERNAL_JOURNAL_OPEN=''
- __INTERNAL_PersistentDataLoad
export __INTERNAL_PHASES_FAILED=0
export __INTERNAL_PHASES_PASSED=0
export __INTERNAL_PHASES_SKIPPED=0
@@ -130,16 +142,20 @@ rlJournalStart(){
__INTERNAL_PHASE_STARTTIME=()
__INTERNAL_PHASE_METRICS=()
export __INTERNAL_PHASE_OPEN=0
+ __INTERNAL_PersistentDataLoad
if [[ -z "$__INTERNAL_JOURNAL_OPEN" ]]; then
# Create Header for XML journal
__INTERNAL_CreateHeader
# Create log element for XML journal
- __INTERNAL_WriteToMetafile log
+ __INTERNAL_WriteToMetafile log || {
+ __INTERNAL_LogText "could not write to metafile" FATAL
+ exit 1
+ }
+ __INTERNAL_JOURNAL_OPEN=1
+ # Increase level of indent
+ __INTERNAL_METAFILE_INDENT_LEVEL=1
fi
- __INTERNAL_JOURNAL_OPEN=1
- # Increase level of indent
- __INTERNAL_METAFILE_INDENT_LEVEL=1
# display a warning message if run in POSIX mode
if [ $POSIXFIXED == "YES" ] ; then
@@ -938,20 +957,30 @@ __INTERNAL_PrintHeadLog() {
# should be called before and after that respectively.
__INTERNAL_PersistentDataSave() {
- cat > "$__INTERNAL_PERSISTENT_DATA" <<EOF
-__INTERNAL_STARTTIME=$__INTERNAL_STARTTIME
-__INTERNAL_TEST_STATE=$__INTERNAL_TEST_STATE
-__INTERNAL_PHASES_PASSED=$__INTERNAL_PHASES_PASSED
-__INTERNAL_PHASES_FAILED=$__INTERNAL_PHASES_FAILED
-__INTERNAL_PHASES_SKIPPED=$__INTERNAL_PHASES_SKIPPED
-__INTERNAL_JOURNAL_OPEN=$__INTERNAL_JOURNAL_OPEN
-__INTERNAL_PHASES_WORST_RESULT=$__INTERNAL_PHASES_WORST_RESULT
-EOF
-declare -p __INTERNAL_PHASE_FAILED >> $__INTERNAL_PERSISTENT_DATA
-declare -p __INTERNAL_PHASE_PASSED >> $__INTERNAL_PERSISTENT_DATA
-declare -p __INTERNAL_PHASE_STARTTIME >> $__INTERNAL_PERSISTENT_DATA
-declare -p __INTERNAL_PHASE_TXTLOG_START >> $__INTERNAL_PERSISTENT_DATA
-declare -p __INTERNAL_PHASE_METRICS >> $__INTERNAL_PERSISTENT_DATA
+ local var
+ (
+ for var in \
+ __INTERNAL_STARTTIME \
+ __INTERNAL_TEST_STATE \
+ __INTERNAL_PHASES_PASSED \
+ __INTERNAL_PHASES_FAILED \
+ __INTERNAL_PHASES_SKIPPED \
+ __INTERNAL_JOURNAL_OPEN \
+ __INTERNAL_PHASE_OPEN \
+ __INTERNAL_PHASES_WORST_RESULT \
+ __INTERNAL_METAFILE_INDENT_LEVEL \
+ __INTERNAL_PHASE_TYPE \
+ __INTERNAL_PHASE_NAME \
+ __INTERNAL_PHASE_FAILED \
+ __INTERNAL_PHASE_PASSED \
+ __INTERNAL_PHASE_STARTTIME \
+ __INTERNAL_PHASE_TXTLOG_START \
+ __INTERNAL_PHASE_METRICS \
+ ;
+ do
+ declare -p $var
+ done
+ ) | sed -r 's/declare/\0 -g/' > "$__INTERNAL_PERSISTENT_DATA"
}
__INTERNAL_PersistentDataLoad() {

View File

@ -1,25 +0,0 @@
unchanged:
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -922,7 +922,7 @@ __INTERNAL_WriteToMetafile(){
line="$indent${element:+$element }--timestamp=\"${__INTERNAL_TIMESTAMP}\"$line"
lineraw="$indent${element:+$element }--timestamp=\"${__INTERNAL_TIMESTAMP}\"$lineraw"
- echo "#${lineraw:1}" >> $__INTERNAL_BEAKERLIB_METAFILE
+ [[ -n "$DEBUG" ]] && echo "#${lineraw:1}" >> $__INTERNAL_BEAKERLIB_METAFILE
echo "$line" >> $__INTERNAL_BEAKERLIB_METAFILE
}
only in patch2:
unchanged:
--- a/src/test/journalTest.sh
+++ b/src/test/journalTest.sh
@@ -26,7 +26,7 @@ test_rlJournalStart(){
assertTrue "journal is well-formed XML" "xmllint $__INTERNAL_BEAKERLIB_JOURNAL >/dev/null"
# existing journal is not overwritten
- silentIfNotDebug 'rlLog "I am"'
+ silentIfNotDebug 'DEBUG=1 rlLog "I am"'
rlJournalStart
assertTrue "existing meta not overwritten" \
"grep 'I\\\ am' $__INTERNAL_BEAKERLIB_METAFILE"

View File

@ -1,177 +0,0 @@
diff -u b/src/journal.sh b/src/journal.sh
--- b/src/journal.sh
+++ b/src/journal.sh
@@ -115,12 +115,13 @@
export __INTERNAL_METAFILE_INDENT_LEVEL=0
__INTERNAL_PHASE_TYPE=()
__INTERNAL_PHASE_NAME=()
- export __INTERNAL_PRESISTENT_DATA="$BEAKERLIB_DIR/PersistentData"
+ export __INTERNAL_PERSISTENT_DATA="$BEAKERLIB_DIR/PersistentData"
+ export __INTERNAL_TEST_RESULTS="$BEAKERLIB_DIR/TestResults"
export __INTERNAL_JOURNAL_OPEN=''
__INTERNAL_PersistentDataLoad
export __INTERNAL_PHASES_FAILED=0
export __INTERNAL_PHASES_PASSED=0
- export __INTERNAL_PHASES_SKIPED=0
+ export __INTERNAL_PHASES_SKIPPED=0
export __INTERNAL_PHASES_WORST_RESULT='PASS'
export __INTERNAL_TEST_STATE=0
__INTERNAL_PHASE_TXTLOG_START=()
@@ -249,6 +250,7 @@
echo "#End of metafile" >> $__INTERNAL_BEAKERLIB_METAFILE
__INTERNAL_JournalXMLCreate
+ __INTERNAL_TestResultsSave
}
@@ -346,11 +348,11 @@
__INTERNAL_update_journal_txt() {
local textfile
- local duration=$(($__INTERNAL_TIMESTAMP - $__INTERNAL_STARTTIME))
local endtime
+ __INTERNAL_DURATION=$(($__INTERNAL_TIMESTAMP - $__INTERNAL_STARTTIME))
printf -v endtime "%($__INTERNAL_TIMEFORMAT_LONG)T %s" $__INTERNAL_TIMESTAMP "(still running)"
[[ -n "$__INTERNAL_ENDTIME" ]] && printf -v endtime "%($__INTERNAL_TIMEFORMAT_LONG)T" $__INTERNAL_ENDTIME
- local sed_patterns="0,/ Test finished : /s/^( Test finished : ).*\$/\1$endtime/;0,/ Test duration : /s/^( Test duration : ).*\$/\1$duration seconds/"
+ local sed_patterns="0,/ Test finished : /s/^( Test finished : ).*\$/\1$endtime/;0,/ Test duration : /s/^( Test duration : ).*\$/\1$__INTERNAL_DURATION seconds/"
for textfile in "$__INTERNAL_BEAKERLIB_JOURNAL_COLORED" "$__INTERNAL_BEAKERLIB_JOURNAL_TXT"; do
sed -r -i "$sed_patterns" "$textfile"
done
@@ -439,6 +441,43 @@
return 0
}
+
+# Creation of TestResults file
+# Each line of the file contains TESTRESULT_VAR=$RESULT_VALUE
+# so the file can be sourced afterwards
+__INTERNAL_TestResultsSave(){
+ # Set exit code of the test according to worst phase result
+ case "$__INTERNAL_PHASES_WORST_RESULT" in
+ PASS)
+ __TESTRESULT_RESULT_ECODE="0"
+ ;;
+ WARN)
+ __TESTRESULT_RESULT_ECODE="10"
+ ;;
+ FAIL)
+ __TESTRESULT_RESULT_ECODE="20"
+ ;;
+ *)
+ __TESTRESULT_RESULT_ECODE="30"
+ ;;
+ esac
+
+ cat > "$__INTERNAL_TEST_RESULTS" <<EOF
+# This is a result file of the test in a 'sourceable' form.
+# Description of individual variables can be found in beakerlib man page.
+TESTRESULT_RESULT_STRING=$__INTERNAL_PHASES_WORST_RESULT
+TESTRESULT_RESULT_ECODE=$__TESTRESULT_RESULT_ECODE
+TESTRESULT_PHASES_PASSED=$__INTERNAL_PHASES_PASSED
+TESTRESULT_PHASES_FAILED=$__INTERNAL_PHASES_FAILED
+TESTRESULT_PHASES_SKIPPED=$__INTERNAL_PHASES_SKIPPED
+TESTRESULT_ASSERTS_FAILED=$__INTERNAL_TEST_STATE
+TESTRESULT_STARTTIME=$__INTERNAL_STARTTIME
+TESTRESULT_ENDTIME=$__INTERNAL_ENDTIME
+TESTRESULT_DURATION=$__INTERNAL_DURATION
+TESTRESULT_BEAKERLIB_DIR=$BEAKERLIB_DIR
+EOF
+}
+
# backward compatibility
rlCreateLogFromJournal(){
rlLogWarning "rlCreateLogFromJournal is obsoleted by rlJournalPrintText"
@@ -891,29 +930,29 @@
}
-# whenever any of the persistend variable is touched,
+# whenever any of the persistent variable is touched,
# functions __INTERNAL_PersistentDataLoad and __INTERNAL_PersistentDataSave
# should be called before and after that respectively.
__INTERNAL_PersistentDataSave() {
- cat > "$__INTERNAL_PRESISTENT_DATA" <<EOF
+ cat > "$__INTERNAL_PERSISTENT_DATA" <<EOF
__INTERNAL_STARTTIME=$__INTERNAL_STARTTIME
__INTERNAL_TEST_STATE=$__INTERNAL_TEST_STATE
__INTERNAL_PHASES_PASSED=$__INTERNAL_PHASES_PASSED
__INTERNAL_PHASES_FAILED=$__INTERNAL_PHASES_FAILED
-__INTERNAL_PHASES_SKIPED=$__INTERNAL_PHASES_SKIPED
+__INTERNAL_PHASES_SKIPPED=$__INTERNAL_PHASES_SKIPPED
__INTERNAL_JOURNAL_OPEN=$__INTERNAL_JOURNAL_OPEN
__INTERNAL_PHASES_WORST_RESULT=$__INTERNAL_PHASES_WORST_RESULT
EOF
-declare -p __INTERNAL_PHASE_FAILED >> $__INTERNAL_PRESISTENT_DATA
-declare -p __INTERNAL_PHASE_PASSED >> $__INTERNAL_PRESISTENT_DATA
-declare -p __INTERNAL_PHASE_STARTTIME >> $__INTERNAL_PRESISTENT_DATA
-declare -p __INTERNAL_PHASE_TXTLOG_START >> $__INTERNAL_PRESISTENT_DATA
-declare -p __INTERNAL_PHASE_METRICS >> $__INTERNAL_PRESISTENT_DATA
+declare -p __INTERNAL_PHASE_FAILED >> $__INTERNAL_PERSISTENT_DATA
+declare -p __INTERNAL_PHASE_PASSED >> $__INTERNAL_PERSISTENT_DATA
+declare -p __INTERNAL_PHASE_STARTTIME >> $__INTERNAL_PERSISTENT_DATA
+declare -p __INTERNAL_PHASE_TXTLOG_START >> $__INTERNAL_PERSISTENT_DATA
+declare -p __INTERNAL_PHASE_METRICS >> $__INTERNAL_PERSISTENT_DATA
}
__INTERNAL_PersistentDataLoad() {
- [[ -r "$__INTERNAL_PRESISTENT_DATA" ]] && . "$__INTERNAL_PRESISTENT_DATA"
+ [[ -r "$__INTERNAL_PERSISTENT_DATA" ]] && . "$__INTERNAL_PERSISTENT_DATA"
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
only in patch2:
unchanged:
--- a/src/beakerlib.sh
+++ b/src/beakerlib.sh
@@ -96,6 +96,48 @@ See the BKRDOC section for more information about Automated documentation genera
=for comment beakerlib-manual-footer
+=head1 OUTPUT FILES
+
+Location of test results related output files can be configured by setting BEAKERLIB_DIR variable before running the test. If it is not set, temporary directory is created.
+
+=head2 journal.txt
+
+Journal in human readable form.
+
+=head2 journal.xml
+
+Journal in XML format, requires python. This dependency can be avoided if the test is run with variable BEAKERLIB_JOURNAL set to 0 in which case journal.xml is not created.
+
+=head3 XSLT
+
+XML journal can be transformed through XSLT template. Which template is used is configurable by setting BEAKERLIB_JOURNAL variable. Value can be either filename in which case beakerlib will try to use $INSTALL_DIR/xslt-template/$filename (e.g.: /usr/share/beakerlib/xstl-templates/xunit.xsl) or it can be path to a template anywhere on the system.
+
+=head2 TestResults
+
+Overall results of the test in a 'sourceable' form. Each line contains a pair VAR=VALUE. All variable names have 'TESTRESULT_' prefix.
+
+=head3 List of variables:
+
+TESTRESULT_RESULT_STRING - Result of the test in a string, e.g.: PASS, FAIL, WARN.
+
+TESTRESULT_RESULT_ECODE - Result of the test as an integer, 0 equals to PASS.
+
+TESTRESULT_PHASES_PASSED - Number of phases that ended with PASS.
+
+TESTRESULT_PHASES_FAILED - Number of phases that ended with non-PASS result.
+
+TESTRESULT_PHASES_SKIPPED - Number of skipped phases.
+
+TESTRESULT_ASSERTS_FAILED - Number of asserts that ended with non-PASS result in the whole test.
+
+TESTRESULT_STARTTIME - Time when test started in seconds since epoch.
+
+TESTRESULT_ENDTIME - Time when test ended in seconds since epoch.
+
+TESTRESULT_DURATION - Duration of the test run in seconds.
+
+TESTRESULT_BEAKERLIB_DIR - Directory with test results files.
+
=head1 EXAMPLES
=head2 Simple

View File

@ -1,46 +0,0 @@
--- a/src/testing.sh 2018-02-24 14:44:24.213182846 +0100
+++ b/src/testing.sh 2018-02-24 14:44:58.046031444 +0100
@@ -731,6 +731,12 @@
Be aware that there are some variables which can collide with your code executed
within rlRun. You should avoid using __INTERNAL_rlRun_* variables.
+=item
+
+When any of C<-t> C<-l>, C<-c>, or C<-s> option is used, special file
+descriptors 111 and 112 are used to avoid the issue with incomplete log file,
+bz1361246.
+
=back
B<Warning:> using C<unbuffer> tool is now disabled because of bug 547686.
@@ -848,9 +854,28 @@
__INTERNAL_PrintText "$__INTERNAL_rlRun_comment_begin" "BEGIN"
if $__INTERNAL_rlRun_DO_LOG || $__INTERNAL_rlRun_DO_TAG || $__INTERNAL_rlRun_DO_KEEP; then
- eval "$__INTERNAL_rlRun_command" 2> >(sed -u -e "s/^/$__INTERNAL_rlRun_TAG_ERR/g" |
- tee -a $__INTERNAL_rlRun_LOG_FILE) 1> >(sed -u -e "s/^/$__INTERNAL_rlRun_TAG_OUT/g" | tee -a $__INTERNAL_rlRun_LOG_FILE)
+ # handle issue with incomplete logs (bz1361246), this could be improved using coproc
+ # in RHEL-6 and higher
+ # open file descriptors to parsing processes
+ exec 111> >(sed -u -e "s/^/$__INTERNAL_rlRun_TAG_OUT/g" | tee -a $__INTERNAL_rlRun_LOG_FILE)
+ local __INTERNAL_rlRun_OUTpid=$!
+ exec 112> >(sed -u -e "s/^/$__INTERNAL_rlRun_TAG_ERR/g" | tee -a $__INTERNAL_rlRun_LOG_FILE)
+ local __INTERNAL_rlRun_ERRpid=$!
+ eval "$__INTERNAL_rlRun_command" 2>&112 1>&111
local __INTERNAL_rlRun_exitcode=$?
+ # close parsing processes
+ exec 111>&-
+ exec 112>&-
+ # wait for parsing processes to finish their job
+ local __INTERNAL_rlRun_counter=0
+ while kill -0 $__INTERNAL_rlRun_OUTpid 2>/dev/null || kill -0 $__INTERNAL_rlRun_ERRpid 2>/dev/null; do
+ [[ $((__INTERNAL_rlRun_counter++)) -gt 12000 ]] && {
+ rlLogError "waiting for flushing the output timed out, there might be some data missing in the output file"
+ break
+ }
+ sleep 0.01;
+ done
+ rlLogDebug "waiting for parsing processes took $__INTERNAL_rlRun_counter cycles"
else
eval "$__INTERNAL_rlRun_command"
local __INTERNAL_rlRun_exitcode=$?

View File

@ -1,26 +0,0 @@
From e6a98ff289c0c085767c2e910e0a3fb983d8b273 Mon Sep 17 00:00:00 2001
From: Alois Mahdal <amahdal@redhat.com>
Date: Thu, 1 Feb 2018 15:12:12 +0100
Subject: [PATCH 1/5] Enable colors on rxvt terminals
rxvt-unicode sets TERM to 'rxvt-unicode'. plain old rxvt sets it to
`rxvt`.
---
src/logging.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/logging.sh b/src/logging.sh
index 2d3972a..38a0466 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -175,7 +175,7 @@ __INTERNAL_color_set() {
[[ -t 1 ]] || T=""
[[ -t 2 ]] || T=""
case $T in
- xterm*|screen|linux)
+ xterm*|screen|linux|rxvt*)
__INTERNAL_color_black="\e[0;30m"
__INTERNAL_color_dark_gray="\e[1;30m"
__INTERNAL_color_red="\e[0;31m"
--
2.14.3

View File

@ -1,29 +0,0 @@
From 24d774fb27375f0848d56603be873937d23209cc Mon Sep 17 00:00:00 2001
From: Zdenek Zambersky <zzambers@redhat.com>
Date: Thu, 2 Aug 2018 16:50:35 +0200
Subject: [PATCH 1/4] rpms.sh: fixed search url for src rpms
---
src/rpms.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/rpms.sh b/src/rpms.sh
index 66d9aa8..878abba 100644
--- a/src/rpms.sh
+++ b/src/rpms.sh
@@ -671,7 +671,12 @@ __INTERNAL_rpmGetNextUrl() {
;;
koji,nvra.rpm)
rlLogDebug "$FUNCNAME(): get rpm info"
- local rpm_info=$($__INTERNAL_WGET -O - "$base_url/search?match=exact&type=rpm&terms=$N-$V-$R.$A.rpm")
+ local rpm_info
+ if [[ -n "$source" ]]; then
+ rpm_info=$($__INTERNAL_WGET -O - "$base_url/search?match=exact&type=rpm&terms=$N-$V-$R.src.rpm")
+ else
+ rpm_info=$($__INTERNAL_WGET -O - "$base_url/search?match=exact&type=rpm&terms=$N-$V-$R.$A.rpm")
+ fi
[[ $? -ne 0 || -z "$rpm_info" ]] && {
rlLogError "could not download rpm information"
let res++
--
2.17.1

View File

@ -1,25 +0,0 @@
From 41cd84632aa1e5d4a5876a780f10864e87580e41 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Wed, 18 Oct 2017 10:52:23 +0200
Subject: [PATCH] fixed typo
---
src/journal.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/journal.sh b/src/journal.sh
index 03d4fad..e7d65f2 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -722,7 +722,7 @@ __INTERNAL_CreateHeader(){
package="${packagename:-$test_version}"
local test_built
[[ -n "$package" ]] && test_built=$(rpm -q --qf '%{BUILDTIME}\n' $package) && {
- test_built="$(ehco "$test_built" | head -n 1 )"
+ test_built="$(echo "$test_built" | head -n 1 )"
printf -v test_built "%($__INTERNAL_TIMEFORMAT_LONG)T" "$test_built"
__INTERNAL_WriteToMetafile testversion -- "$test_built"
__INTERNAL_LogText " Test built : $test_built" 2> /dev/null
--
2.13.6

View File

@ -1,85 +0,0 @@
From c8b0fdde74b7cb1717454992772ab63e6cffd234 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Fri, 2 Feb 2018 15:16:58 +0100
Subject: [PATCH 5/5] unify footer printing
make footer of the phase and also the footer of whole test formated the same
it also removes controversary strong splitter of footer
---
src/journal.sh | 47 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 40 insertions(+), 7 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index 867d08f..f3f2b78 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -255,8 +255,13 @@ rlJournalEnd(){
echo "#End of metafile" >> $__INTERNAL_BEAKERLIB_METAFILE
- __INTERNAL_LogText "Phases: $__INTERNAL_PHASES_PASSED good, $__INTERNAL_PHASES_FAILED bad" LOG 2>&1
- __INTERNAL_LogText "RESULT: $__INTERNAL_TEST_NAME" $__INTERNAL_PHASES_WORST_RESULT 2>&1
+ __INTERNAL_PrintFootLog $__INTERNAL_STARTTIME \
+ $__INTERNAL_ENDTIME \
+ Phases \
+ $__INTERNAL_PHASES_PASSED \
+ $__INTERNAL_PHASES_FAILED \
+ $__INTERNAL_PHASES_WORST_RESULT \
+ "OVERALL"
__INTERNAL_JournalXMLCreate
__INTERNAL_TestResultsSave
@@ -603,11 +608,12 @@ rljClosePhase(){
rlLogDebug "rljClosePhase: Phase $name closed"
__INTERNAL_SET_TIMESTAMP
local endtime="$__INTERNAL_TIMESTAMP"
- __INTERNAL_LogText "________________________________________________________________________________"
- __INTERNAL_LogText "Duration: $((endtime - __INTERNAL_PHASE_STARTTIME))s" LOG
- __INTERNAL_LogText "Assertions: $__INTERNAL_PHASE_PASSED good, $__INTERNAL_PHASE_FAILED bad" LOG
- __INTERNAL_LogText "RESULT: $name" $result
- __INTERNAL_LogText ''
+ __INTERNAL_PrintFootLog $__INTERNAL_PHASE_STARTTIME \
+ $endtime \
+ Assertions \
+ $__INTERNAL_PHASE_PASSED \
+ $__INTERNAL_PHASE_FAILED \
+ $result
local logfile="$(mktemp)"
tail -n +$((__INTERNAL_PHASE_TXTLOG_START+1)) $__INTERNAL_BEAKERLIB_JOURNAL_TXT > $logfile
rlReport "$(echo "${name//[^[:alnum:]]/-}" | tr -s '-')" "$result" "$score" "$logfile"
@@ -934,6 +940,33 @@ __INTERNAL_PrintHeadLog() {
}
+# $1 - start time
+# $2 - end time
+# $3 - stat name
+# $4 - stat good
+# $5 - stat bad
+# $6 - result
+# $7 - result prefix '<PREFIX> RESULT: <RESULT>'
+__INTERNAL_PrintFootLog(){
+ local result_colored
+ local starttime="$1"
+ local endtime="$2"
+ local stat_name="$3"
+ local stat_good="$4"
+ local stat_bad="$5"
+ local result="$6"
+ local result_pref="$7"
+ [[ -n "$result_pref" ]] && result_pref+=" "
+ __INTERNAL_colorize_prio "$result" result_colored
+ __INTERNAL_LogText "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
+ __INTERNAL_LogText ":: Duration: $((endtime - starttime))s"
+ __INTERNAL_LogText ":: $stat_name: $stat_good good, $stat_bad bad"
+ __INTERNAL_LogText ":: ${result_pref}RESULT: $result" '' '' \
+ ":: ${result_pref}RESULT: $result_colored"
+ __INTERNAL_LogText ''
+}
+
+
# whenever any of the persistent variable is touched,
# functions __INTERNAL_PersistentDataLoad and __INTERNAL_PersistentDataSave
# should be called before and after that respectively.
--
2.14.3

View File

@ -1,41 +0,0 @@
From 30c5a9b8982e6342cfff28871083f36efc80f52b Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Tue, 12 Dec 2017 14:34:35 +0100
Subject: [PATCH 14/18] leave variable TEST intact
---
src/journal.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index 092de14..8e68fb3 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -432,9 +432,9 @@ rlJournalPrintText(){
cat "$textfile"
local __INTERNAL_LogText_no_file=1
- __INTERNAL_PrintHeadLog "${TEST}" 2>&1
+ __INTERNAL_PrintHeadLog "${__INTERNAL_TEST_NAME}" 2>&1
__INTERNAL_LogText "Phases: $__INTERNAL_PHASES_PASSED good, $__INTERNAL_PHASES_FAILED bad" LOG 2>&1
- __INTERNAL_LogText "RESULT: $TEST" $__INTERNAL_PHASES_WORST_RESULT 2>&1
+ __INTERNAL_LogText "RESULT: $__INTERNAL_TEST_NAME" $__INTERNAL_PHASES_WORST_RESULT 2>&1
return 0
}
@@ -779,9 +779,9 @@ __INTERNAL_CreateHeader(){
__INTERNAL_LogText " Test duration : " 2> /dev/null
# Test name
- TEST="${TEST:-unknown}"
- __INTERNAL_WriteToMetafile testname -- "${TEST}"
- __INTERNAL_LogText " Test name : ${TEST}" 2> /dev/null
+ __INTERNAL_TEST_NAME="${TEST:-unknown}"
+ __INTERNAL_WriteToMetafile testname -- "${__INTERNAL_TEST_NAME}"
+ __INTERNAL_LogText " Test name : ${__INTERNAL_TEST_NAME}" 2> /dev/null
# OS release
local release=$(cat /etc/redhat-release)
--
2.14.3

View File

@ -1,77 +0,0 @@
From 10520de65d10d2ab34329e24144aa922a430b229 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Wed, 22 Aug 2018 13:09:47 +0200
Subject: [PATCH 4/4] use wget or curl for web download
Now there's a fallback to curl if wget is not available.
Wget has still a preference as it has got better progress printing while
the output is redirected to a file.
---
src/rpms.sh | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/rpms.sh b/src/rpms.sh
index 878abba..e51dd4f 100644
--- a/src/rpms.sh
+++ b/src/rpms.sh
@@ -630,7 +630,27 @@ __INTERNAL_rpmInitUrl() {
}
-__INTERNAL_WGET="wget -t 3 -T 180 -w 20 --waitretry=30 --no-check-certificate --progress=dot:giga"
+__INTERNAL_WGET() {
+ local QUIET
+ [[ "$1" == "--quiet" ]] && { QUIET=1; shift; }
+ local URL="$2"
+ local FILE="$1"
+ local res=0
+ if which wget &> /dev/null; then
+ rlLogDebug "$FUNCNAME(): using wget for download"
+ QUIET="${QUIET:+--quiet}"
+ wget $QUIET -t 3 -T 180 -w 20 --waitretry=30 --no-check-certificate --progress=dot:giga -O $FILE $URL || let res++
+ elif which curl &> /dev/null; then
+ rlLogDebug "$FUNCNAME(): using curl for download"
+ QUIET="${QUIET:+--silent}"
+ [[ -t 2 ]] || QUIET="${QUIET:---silent --show-error}"
+ curl $QUIET --location --retry-connrefused --retry-delay 3 --retry-max-time 3600 --retry 3 --connect-timeout 180 --max-time 1800 --insecure -o $FILE "$URL" || let res++
+ else
+ rlLogError "$FUNCNAME(): no tool for downloading web content is available"
+ let res++
+ fi
+ return $res
+}
# __INTERNAL_rpmGetNextUrl N V R A | --source N V R
__INTERNAL_rpmGetNextUrl() {
@@ -673,9 +695,9 @@ __INTERNAL_rpmGetNextUrl() {
rlLogDebug "$FUNCNAME(): get rpm info"
local rpm_info
if [[ -n "$source" ]]; then
- rpm_info=$($__INTERNAL_WGET -O - "$base_url/search?match=exact&type=rpm&terms=$N-$V-$R.src.rpm")
+ rpm_info=$(__INTERNAL_WGET - "$base_url/search?match=exact&type=rpm&terms=$N-$V-$R.src.rpm")
else
- rpm_info=$($__INTERNAL_WGET -O - "$base_url/search?match=exact&type=rpm&terms=$N-$V-$R.$A.rpm")
+ rpm_info=$(__INTERNAL_WGET - "$base_url/search?match=exact&type=rpm&terms=$N-$V-$R.$A.rpm")
fi
[[ $? -ne 0 || -z "$rpm_info" ]] && {
rlLogError "could not download rpm information"
@@ -692,7 +714,7 @@ __INTERNAL_rpmGetNextUrl() {
rlLogDebug "$FUNCNAME(): extracted buildurl='$buildurl'"
[[ "$buildurl" =~ http ]] || buildurl="$base_url/$buildurl"
rlLogDebug "$FUNCNAME(): using buildurl='$buildurl'"
- local buildinfo=$($__INTERNAL_WGET -O - "$buildurl")
+ local buildinfo=$(__INTERNAL_WGET - "$buildurl")
[[ $? -ne 0 || -z "$buildinfo" ]] && {
rlLogError "could not download build information"
let res++
@@ -752,7 +774,7 @@ __INTERNAL_rpmDirectDownload() {
url="$__INTERNAL_RETURN_VALUE"; unset __INTERNAL_RETURN_VALUE
local pkg=$(basename "$url")
rlLog "trying download from '$url'"
- if $__INTERNAL_WGET $quiet -O $pkg "$url"; then
+ if __INTERNAL_WGET $quiet $pkg "$url"; then
rlLogDebug "$FUNCNAME(): package '$pkg' was successfully downloaded"
echo "$pkg"
return 0
--
2.17.1

View File

@ -1,69 +1,90 @@
Name: beakerlib Name: beakerlib
Summary: A shell-level integration testing library Summary: A shell-level integration testing library
Version: 1.17 Version: 1.29.2
Release: 19%{?dist} Release: 2%{?dist}
License: GPLv2 License: GPLv2
Group: Development/Libraries
BuildArch: noarch BuildArch: noarch
URL: https://github.com/%{name} URL: https://github.com/%{name}
Autoreq: 0 Autoreq: 0
Requires: nfs-utils Requires: nfs-utils
Requires: /bin/bash Requires: /bin/bash
Requires: /bin/sh Requires: /bin/sh
%if 0%{?fedora}
Recommends: /usr/bin/python3
%endif
%if 0%{?rhel} > 7
Recommends: /usr/libexec/platform-python Recommends: /usr/libexec/platform-python
%else
# rhel <= 7
Requires: /usr/bin/python
%endif
%if 0%{?rhel} < 8
Requires: /usr/bin/perl
Requires: wget
Requires: python-lxml
Requires: /usr/bin/xmllint
%else
# rhel > 7 and fedora
Recommends: /usr/bin/perl Recommends: /usr/bin/perl
Requires: (wget or curl)
Suggests: wget
Recommends: python3-lxml
Recommends: /usr/bin/xmllint
%endif
Requires: grep Requires: grep
Requires: sed Requires: sed
Requires: net-tools Requires: iproute
Requires: coreutils Requires: coreutils
Requires: tar Requires: tar
Requires: gzip Requires: gzip
Requires: util-linux Requires: util-linux
Requires: which Requires: which
Requires: (wget or curl) %if 0%{?fedora}
Suggests: wget Requires: dnf-utils
Recommends: python3-lxml %else
Recommends: xmllint Requires: yum-utils
Obsoletes: rhtslib beaker-lib %endif
Provides: rhtslib beaker-lib Requires: /usr/bin/bc
Requires: /usr/bin/time
%if 0%{?rhel} < 8
%else
Recommends: beakerlib-redhat
%endif
Conflicts: beakerlib-redhat < 1-30 Conflicts: beakerlib-redhat < 1-30
BuildRequires: /usr/bin/pod2man BuildRequires: /usr/bin/pod2man
BuildRequires: perl-generators BuildRequires: perl-generators
BuildRequires: util-linux BuildRequires: util-linux
BuildRequires: make
Source0: https://github.com/beakerlib/beakerlib/archive/%{name}-%{version}.tar.gz Source0: https://github.com/beakerlib/beakerlib/archive/%{name}-%{version}.tar.gz
Source1: %{name}-tmpfiles.conf Source1: %{name}-tmpfiles.conf
Patch0: bugzilla-links.patch Patch0: bugzilla-links.patch
Patch1: test-built-time.patch Patch1: bugzilla-links-epel.patch
Patch2: result-file.patch Patch2: python3.patch
Patch3: ifs-issue.patch Patch3: python-platform.patch
Patch4: journaling-fixes.patch
Patch5: get-text-journal-size.patch
Patch6: var-TEST.patch
Patch7: reduce-meta.patch
Patch8: enable-nested-phases.patch
Patch9: debug-to-console.patch
Patch10: phase-names-sanitization.patch
Patch11: reboot-in-phase.patch
Patch12: rxvt-terminals-coloring.patch
Patch13: persistent-data-load.patch
Patch14: final-summary-in-rlJournalEnd.patch
Patch15: extended-coloring-capabilities.patch
Patch16: unified-footer.patch
Patch17: rlRun-output.patch
Patch18: python2.patch
Patch19: python3.patch
Patch20: srpm-fetch.patch
Patch21: journalling-import-check.patch
Patch22: handle-missing-python.patch
Patch23: wget2curl-fallback.patch
Patch24: platform-python.patch
Patch25: meta-format-fix.patch
%prep %prep
%autosetup -p1 %autosetup -N
%if 0%{?fedora}
# Patch0: bugzilla-links.patch
%patch0 -p1
%else
# rhel
# Patch1: bugzilla-links-epel.patch
%patch1 -p1
%endif
%if 0%{?fedora}
# Patch2: python3.patch
%patch2 -p1
%endif
%if 0%{?rhel} > 7
# Patch3: python-platform.patch
%patch3 -p1
%endif
%build %build
make build make build
@ -81,7 +102,6 @@ The BeakerLib project means to provide a library of various helpers, which
could be used when writing operating system level integration tests. could be used when writing operating system level integration tests.
%files %files
%defattr(-,root,root,-)
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/xslt-templates %dir %{_datadir}/%{name}/xslt-templates
%dir %{_pkgdocdir} %dir %{_pkgdocdir}
@ -97,9 +117,9 @@ could be used when writing operating system level integration tests.
%package vim-syntax %package vim-syntax
Summary: Files for syntax highlighting BeakerLib tests in VIM editor Summary: Files for syntax highlighting BeakerLib tests in VIM editor
Group: Development/Libraries
Requires: vim-common Requires: vim-common
BuildRequires: vim-common BuildRequires: vim-common
BuildRequires: make
%description vim-syntax %description vim-syntax
Files for syntax highlighting BeakerLib tests in VIM editor Files for syntax highlighting BeakerLib tests in VIM editor
@ -109,7 +129,111 @@ 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
* Thu Sep 7 2018 Dalibor Pospisil <dapospis@redhat.com> - 1.17-19 * Thu Aug 25 2022 Dalibor Pospisil <dapospis@redhat.com> - 1.29.2-2
- improved performance and memory consumption of the fingerprint feature
* Mon Aug 8 2022 Dalibor Pospisil <dapospis@redhat.com> - 1.29.1-2
- rlImport: upwards traversal start in the current directory
- rlImport: support '.' to import lib.sh from the current directory
- rlImport: can handle libraries required by the fmf_id in different forms than (url, name)
also name-only. Also the path attribute is considered
- fingerprint: an asserts fingerprint and phases fingerprint is computed
it is printed as a message and it is also available in the TestResults file
- fixed a check for os-release file existence
- fixed LOG_LEVEL usage
- removed dependency on selinuxenabled
- fixed a few typos, thanks to jwakely@fedoraproject.org
* Tue Nov 9 2021 Dalibor Pospisil <dapospis@redhat.com> - 1.28-1
- cleanup rlRun_LOG files at rlJournalEnd
- close journal in rlDie - generate journal.xml at that moment
- implemented functions rlIsOS, rlIsOSLike, rlIsOSVersion, and rlIsRHELLike
- rlAssertRequired can now handle versioned dependencies
- new functions rlCheckRerquired, rlCheckRecommended, and rlCheckDependencies
* Thu Mar 25 2021 Dalibor Pospisil <dapospis@redhat.com> - 1.27-1
- rlCheckRequirements is now able to check also versions requirements
* Tue Mar 9 2021 Dalibor Pospisil <dapospis@redhat.com> - 1.26-1
- fixed rlServiceDisable if called without rlServiceEnable beforehand
- few internal fixes
* Tue Feb 9 2021 Dalibor Pospisil <dapospis@redhat.com> - 1.25-1
- rebased yash to version 1.2, fixes the backtick iterpretation
- docs fixes, by Štěpán Němec <snemec@redhat.com>
* Sat Jan 30 2021 Dalibor Pospisil <dapospis@redhat.com> - 1.24-1
- rlImport --all imports only required libraries, not recommend
- implemented chkconfig fallback to systemctl
- fixed `make test` test suite execution
* Tue Jan 26 2021 Dalibor Pospisil <dapospis@redhat.com> - 1.23-1
- TestResults state indicator
- profiling code
- rebased yash to 1.1
- fixed rlAssertLesser
- fixed failed library load name logging
* Fri Jan 15 2021 Dalibor Pospisil <dapospis@redhat.com> - 1.22-1
- ability to parse fmf id references
- ability the use simpler library name - library(foo), {url: '../foo.git', name: '/'}, meaming the library is n the root folder
- ability put library even deeper in the tree - library(foo/path/to/the/library), {url: '../foo.git', name: '/path/to/the/library'}
- rebased yash to 1.0
- and few more minor fixes
* Tue Dec 8 2020 Dalibor Pospisil <dapospis@redhat.com> - 1.21-1
- Rebase to the laster upstream
- better and more consistent search for libraries
- ability to parse yaml files including main.fmf and metadata.yaml
* Thu Sep 10 2020 Dalibor Pospisil <dapospis@redhat.com> - 1.20-1
- Rebase to the latest upstream
- improvements to libraries search
- docs update
- some optimizations
- fixed pattern for mathing port or socket in rlWaitFor*
- log colorizing on all screen* terminals
- IFS fixes
- Use /etc/os-release in rlGetDistro*() (#35)
- support for curl 7.29.0
- prefer curl over wget
- silence status of service in rlService{Start,Stop,Restore} functions (#…
- TESTPACKAGE variable to force package name (#54)
* Tue Jun 9 2020 Dalibor Pospisil <dapospis@redhat.com> - 1.18-12
- optiomized CPU info gathering
- enhanced library search
* Mon Apr 6 2020 Dalibor Pospisil <dapospis@redhat.com> - 1.18-7
- added missing dependencies on /usr/bin/bc and /usr/bin/time
* Mon Jun 3 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-6
- 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
- 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
- support direct systemctl call
- netstat replaced by ss
- ability to run without python (no journal.xml)
- better handling of reboots
- better handling of persistent data
- final report polishing
- better compatibility with old bash
- <prefix>LibraryDir variable pointing to the library directory for all imported libraries
- fallback to curl if wget is not available
- updated documentation
* Fri Sep 7 2018 Dalibor Pospisil <dapospis@redhat.com> - 1.17-19
- fixed meta file generation - fixed meta file generation
- follow url redirection when using curl - follow url redirection when using curl
- fixed checking for python interpreter - fixed checking for python interpreter

19
bugzilla-links-epel.patch Normal file
View File

@ -0,0 +1,19 @@
diff --git a/src/beakerlib.sh b/src/beakerlib.sh
index 3355fa4..ceafc44 100644
--- a/src/beakerlib.sh
+++ b/src/beakerlib.sh
@@ -274,10 +274,14 @@ https://github.com/beakerlib/beakerlib/wiki/man
=item Issues list
+https://bugzilla.redhat.com/buglist.cgi?component=beakerlib&&order=bug_status%2Cassigned_to%2Cpriority
+
https://github.com/beakerlib/beakerlib/issues
=item Reporting issues
+https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora%20EPEL&component=beakerlib
+
https://github.com/beakerlib/beakerlib/issues/new
=back

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tedude.validation}

57
python-platform.patch Normal file
View File

@ -0,0 +1,57 @@
diff -ur beakerlib-1.18.old/src/python/journal-compare.py beakerlib-1.18.new/src/python/journal-compare.py
--- beakerlib-1.18.old/src/python/journal-compare.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/journal-compare.py 2019-04-04 11:20:23.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/libexec/platform-python
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
diff -ur beakerlib-1.18.old/src/python/journalling.py beakerlib-1.18.new/src/python/journalling.py
--- beakerlib-1.18.old/src/python/journalling.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/journalling.py 2019-04-04 11:20:27.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/libexec/platform-python
# Authors: Jakub Heger <jheger@redhat.com>
# Dalibor Pospisil <dapospis@redhat.com>
diff -ur beakerlib-1.18.old/src/python/rlMemAvg.py beakerlib-1.18.new/src/python/rlMemAvg.py
--- beakerlib-1.18.old/src/python/rlMemAvg.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/rlMemAvg.py 2019-04-04 11:20:30.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/libexec/platform-python
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -ur beakerlib-1.18.old/src/python/rlMemPeak.py beakerlib-1.18.new/src/python/rlMemPeak.py
--- beakerlib-1.18.old/src/python/rlMemPeak.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/rlMemPeak.py 2019-04-04 11:20:33.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/libexec/platform-python
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -ur beakerlib-1.18.old/src/python/testwatcher.py beakerlib-1.18.new/src/python/testwatcher.py
--- beakerlib-1.18.old/src/python/testwatcher.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/testwatcher.py 2019-04-04 11:20:36.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/libexec/platform-python
#
# 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 /usr/libexec/platform-python &> /dev/null; then
$__INTERNAL_JOURNALIST $__INTERNAL_XSLT --metafile \
"$__INTERNAL_BEAKERLIB_METAFILE" --journal "$__INTERNAL_BEAKERLIB_JOURNAL"
res=$?

57
python3.patch Normal file
View File

@ -0,0 +1,57 @@
diff -ur beakerlib-1.18.old/src/python/journal-compare.py beakerlib-1.18.new/src/python/journal-compare.py
--- beakerlib-1.18.old/src/python/journal-compare.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/journal-compare.py 2019-04-04 11:20:23.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
diff -ur beakerlib-1.18.old/src/python/journalling.py beakerlib-1.18.new/src/python/journalling.py
--- beakerlib-1.18.old/src/python/journalling.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/journalling.py 2019-04-04 11:20:27.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Authors: Jakub Heger <jheger@redhat.com>
# Dalibor Pospisil <dapospis@redhat.com>
diff -ur beakerlib-1.18.old/src/python/rlMemAvg.py beakerlib-1.18.new/src/python/rlMemAvg.py
--- beakerlib-1.18.old/src/python/rlMemAvg.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/rlMemAvg.py 2019-04-04 11:20:30.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -ur beakerlib-1.18.old/src/python/rlMemPeak.py beakerlib-1.18.new/src/python/rlMemPeak.py
--- beakerlib-1.18.old/src/python/rlMemPeak.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/rlMemPeak.py 2019-04-04 11:20:33.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -ur beakerlib-1.18.old/src/python/testwatcher.py beakerlib-1.18.new/src/python/testwatcher.py
--- beakerlib-1.18.old/src/python/testwatcher.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/testwatcher.py 2019-04-04 11:20:36.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# 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=$?

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (beakerlib-1.29.2.tar.gz) = 415935d439f02d0afc80c29a1e9771e7e04c51435d46c3caabca5593b020ee6c19f10c10f9e5b573418e1a787025ad9612c7997beb24f574c8b71d9c5874e265

16
tests/tests.yml Normal file
View File

@ -0,0 +1,16 @@
---
# Test to run in classic context
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
repositories:
- repo: "https://src.fedoraproject.org/rpms/udica.git"
dest: "udica"
tests:
- udica/tests/sanity
required_packages:
- udica
- podman