From 2c919c0efed65dd46f3fa6ae2b4d1f2c91a15545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Tue, 5 Nov 2024 15:19:58 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-testing:=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D1=82=D0=B2=D1=80=D0=B0=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=82=D0=B5=D1=80=D0=B8=20=D0=BB=D0=BE=D0=B3=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B8=D0=B7-=D0=B7=D0=B0=20=D0=BE=D1=82=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B5=D0=BB=D0=B0=20gzip/lz4=20=D0=B2=20=D1=81=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=B2=D0=B5=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D1=8B?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D1=81=D1=81=D0=BE=D0=B2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/long_stochastic.sh | 52 +++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/test/long_stochastic.sh b/test/long_stochastic.sh index 4d951e4a..eb7293e5 100755 --- a/test/long_stochastic.sh +++ b/test/long_stochastic.sh @@ -365,9 +365,15 @@ fi ############################################################################### # 5. run stochastic iterations +if which setsid >/dev/null 2>/dev/null; then + SETSID=$(which setsid) +else + SETSID="" +fi + if which lz4 >/dev/null; then function logger { - lz4 > ${TESTDB_DIR}/long.log.lz4 + ${SETSID} lz4 -z -c > ${TESTDB_DIR}/long.log.lz4 || echo "FAILED 'lz4 -z -c > ${TESTDB_DIR}/long.log.lz4'" >&2 } function taillog { if [ -s ${TESTDB_DIR}/long.log.lz4 ]; then @@ -379,7 +385,7 @@ if which lz4 >/dev/null; then } elif which gzip >/dev/null; then function logger { - gzip > ${TESTDB_DIR}/long.log.gz + ${SETSID} gzip -c -k > ${TESTDB_DIR}/long.log.gz || echo "FAILED 'gzip -c -k > ${TESTDB_DIR}/long.log.gz'" >&2 } function taillog { if [ -s ${TESTDB_DIR}/long.log.gz ]; then @@ -391,7 +397,7 @@ elif which gzip >/dev/null; then } else function logger { - cat > ${TESTDB_DIR}/long.log + cat > ${TESTDB_DIR}/long.log || echo "FAILED 'cat > ${TESTDB_DIR}/long.log'" >&2 } function taillog { if [ -s ${TESTDB_DIR}/long.log ]; then @@ -421,21 +427,37 @@ function bits2options { join , ${list[@]} } +LFD=0 +trap "echo 'SIGPIPE(ignored)'" SIGPIPE + function failed { + set +euo pipefail echo "FAILED" >&2 + if [ ${LFD} -ne 0 ]; then + sleep 0.05 + echo "@@@ END-OF-LOG/FAILED" >&${LFD} + sleep 0.05 + exec {LFD}>&- + LFD=0 + fi if [ ${TAILLOG} -gt 0 ]; then taillog fi exit 1 } -function check_deep { - if [ "$case" = "basic" -o "$case" = "--hill" ]; then - tee >(logger) | grep -e reach -e achieve - else - logger +function on_exit { + set +euo pipefail + if [ ${LFD} -ne 0 ]; then + sleep 0.05 + echo "@@@ END-OF-LOG/EXIT" >&${LFD} + sleep 0.05 + exec {LFD}>&- + LFD=0 fi + echo "--- EXIT" >&2 } +trap on_exit EXIT function probe { echo "----------------------------------------------- $(date)" @@ -444,11 +466,21 @@ function probe { for case in $LIST do echo "Run ./mdbx_test ${speculum} --random-writemap=no --ignore-dbfull --repeat=11 --pathname=${TESTDB_DIR}/long.db --cleanup-after=no --geometry-jitter=${GEOMETRY_JITTER} $@ $case" - ${MONITOR} ./mdbx_test ${speculum} --random-writemap=no --ignore-dbfull --repeat=11 --pathname=${TESTDB_DIR}/long.db --cleanup-after=no --geometry-jitter=${GEOMETRY_JITTER} "$@" $case | check_deep \ + if [ "$case" = "basic" -o "$case" = "--hill" ]; then + exec {LFD}> >(tee -p -i >(logger) | grep -e reach -e achieve) + else + exec {LFD}> >(logger) + fi + ${MONITOR} ./mdbx_test ${speculum} --random-writemap=no --ignore-dbfull --repeat=11 --pathname=${TESTDB_DIR}/long.db --cleanup-after=no --geometry-jitter=${GEOMETRY_JITTER} "$@" $case >&${LFD} \ && ${MONITOR} ./mdbx_chk ${TESTDB_DIR}/long.db | tee ${TESTDB_DIR}/long-chk.log \ && ([ ! -e ${TESTDB_DIR}/long.db-copy ] || ${MONITOR} ./mdbx_chk ${TESTDB_DIR}/long.db-copy | tee ${TESTDB_DIR}/long-chk-copy.log) \ || failed - done + if [ ${LFD} -ne 0 ]; then + echo "@@@ END-OF-LOG/ITERATION" >&${LFD} + exec {LFD}>&- + LFD=0 + fi + done } #------------------------------------------------------------------------------