mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-29 09:58:48 +08:00
mdbx-testing: предотвращение потери логов из-за отстрела gzip/lz4 в составе группы процессов.
This commit is contained in:
parent
de36d94aca
commit
2c919c0efe
@ -365,9 +365,15 @@ fi
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# 5. run stochastic iterations
|
# 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
|
if which lz4 >/dev/null; then
|
||||||
function logger {
|
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 {
|
function taillog {
|
||||||
if [ -s ${TESTDB_DIR}/long.log.lz4 ]; then
|
if [ -s ${TESTDB_DIR}/long.log.lz4 ]; then
|
||||||
@ -379,7 +385,7 @@ if which lz4 >/dev/null; then
|
|||||||
}
|
}
|
||||||
elif which gzip >/dev/null; then
|
elif which gzip >/dev/null; then
|
||||||
function logger {
|
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 {
|
function taillog {
|
||||||
if [ -s ${TESTDB_DIR}/long.log.gz ]; then
|
if [ -s ${TESTDB_DIR}/long.log.gz ]; then
|
||||||
@ -391,7 +397,7 @@ elif which gzip >/dev/null; then
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
function logger {
|
function logger {
|
||||||
cat > ${TESTDB_DIR}/long.log
|
cat > ${TESTDB_DIR}/long.log || echo "FAILED 'cat > ${TESTDB_DIR}/long.log'" >&2
|
||||||
}
|
}
|
||||||
function taillog {
|
function taillog {
|
||||||
if [ -s ${TESTDB_DIR}/long.log ]; then
|
if [ -s ${TESTDB_DIR}/long.log ]; then
|
||||||
@ -421,21 +427,37 @@ function bits2options {
|
|||||||
join , ${list[@]}
|
join , ${list[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LFD=0
|
||||||
|
trap "echo 'SIGPIPE(ignored)'" SIGPIPE
|
||||||
|
|
||||||
function failed {
|
function failed {
|
||||||
|
set +euo pipefail
|
||||||
echo "FAILED" >&2
|
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
|
if [ ${TAILLOG} -gt 0 ]; then
|
||||||
taillog
|
taillog
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_deep {
|
function on_exit {
|
||||||
if [ "$case" = "basic" -o "$case" = "--hill" ]; then
|
set +euo pipefail
|
||||||
tee >(logger) | grep -e reach -e achieve
|
if [ ${LFD} -ne 0 ]; then
|
||||||
else
|
sleep 0.05
|
||||||
logger
|
echo "@@@ END-OF-LOG/EXIT" >&${LFD}
|
||||||
|
sleep 0.05
|
||||||
|
exec {LFD}>&-
|
||||||
|
LFD=0
|
||||||
fi
|
fi
|
||||||
|
echo "--- EXIT" >&2
|
||||||
}
|
}
|
||||||
|
trap on_exit EXIT
|
||||||
|
|
||||||
function probe {
|
function probe {
|
||||||
echo "----------------------------------------------- $(date)"
|
echo "----------------------------------------------- $(date)"
|
||||||
@ -444,11 +466,21 @@ function probe {
|
|||||||
for case in $LIST
|
for case in $LIST
|
||||||
do
|
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"
|
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 \
|
&& ${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) \
|
&& ([ ! -e ${TESTDB_DIR}/long.db-copy ] || ${MONITOR} ./mdbx_chk ${TESTDB_DIR}/long.db-copy | tee ${TESTDB_DIR}/long-chk-copy.log) \
|
||||||
|| failed
|
|| failed
|
||||||
done
|
if [ ${LFD} -ne 0 ]; then
|
||||||
|
echo "@@@ END-OF-LOG/ITERATION" >&${LFD}
|
||||||
|
exec {LFD}>&-
|
||||||
|
LFD=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user