diff --git a/beakerlib.spec b/beakerlib.spec index 32de623..7ff6383 100644 --- a/beakerlib.spec +++ b/beakerlib.spec @@ -1,7 +1,7 @@ Name: beakerlib Summary: A shell-level integration testing library Version: 1.17 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2 Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-root @@ -45,6 +45,9 @@ Patch4: get-text-journal-size.patch Patch5: var-TEST.patch Patch6: reduce-meta.patch Patch7: enable-nested-phases.patch +Patch8: debug-to-console.patch +Patch9: phase-names-sanitization.patch +Patch10: reboot-in-phase.patch %description vim-syntax Files for syntax highlighting BeakerLib tests in VIM editor @@ -59,6 +62,9 @@ Files for syntax highlighting BeakerLib tests in VIM editor %patch5 -p1 -b .var-TEST %patch6 -p1 -b .reduce-meta %patch7 -p1 -b .enable-nested-phases +%patch8 -p1 -b .debug-to-console +%patch9 -p1 -b .phase-names-sanitization +%patch10 -p1 -b .reboot-in-phase %build make build @@ -96,6 +102,12 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/vim/vimfiles/after/syntax/beakerlib.vim %changelog +* Fri Jan 26 2018 Dalibor Pospisil - 1.17-7 +- phase name sanitization (remove all weird characters) +- allow debug message to to only to console (speeds execution up in debug) +- allow to reboot inside of phase and continue there +- fixed persistent data loading + * Mon Dec 18 2017 Dalibor Pospisil - 1.17-6 - added missing dependecy diff --git a/debug-to-console.patch b/debug-to-console.patch new file mode 100644 index 0000000..fa863a1 --- /dev/null +++ b/debug-to-console.patch @@ -0,0 +1,18 @@ +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"; } diff --git a/phase-names-sanitization.patch b/phase-names-sanitization.patch new file mode 100644 index 0000000..b9af0d7 --- /dev/null +++ b/phase-names-sanitization.patch @@ -0,0 +1,13 @@ +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 diff --git a/reboot-in-phase.patch b/reboot-in-phase.patch new file mode 100644 index 0000000..d607cf0 --- /dev/null +++ b/reboot-in-phase.patch @@ -0,0 +1,109 @@ +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 +@@ -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 +@@ -938,20 +957,30 @@ __INTERNAL_PrintHeadLog() { + # should be called before and after that respectively. + + __INTERNAL_PersistentDataSave() { +- cat > "$__INTERNAL_PERSISTENT_DATA" <> $__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() { +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"; }