diff --git a/beakerlib.spec b/beakerlib.spec index bdc9ef7..78a443a 100644 --- a/beakerlib.spec +++ b/beakerlib.spec @@ -1,7 +1,7 @@ Name: beakerlib Summary: A shell-level integration testing library Version: 1.17 -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv2 Group: Development/Libraries BuildArch: noarch @@ -43,6 +43,7 @@ Patch12: persistent-data-load.patch Patch13: final-summary-in-rlJournalEnd.patch Patch14: extended-coloring-capabilities.patch Patch15: unified-footer.patch +Patch16: rlRun-output.patch %prep %autosetup -p1 @@ -91,6 +92,9 @@ Files for syntax highlighting BeakerLib tests in VIM editor %{_datadir}/vim/vimfiles/after/syntax/beakerlib.vim %changelog +* Sat Feb 24 2018 Dalibor Pospisil - 1.17-13 +- rlRun -s now waits for output logs to be flushed, bz1361246 + bz1416796 + * Wed Feb 14 2018 Iryna Shcherbina - 1.17-12 - Update Python 2 dependency declarations to new packaging standards (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) diff --git a/rlRun-output.patch b/rlRun-output.patch new file mode 100644 index 0000000..71d8e31 --- /dev/null +++ b/rlRun-output.patch @@ -0,0 +1,46 @@ +--- 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 using C 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=$?