mdbx-test: добавление опции --taillog в стохастический скрипт.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2023-10-30 12:25:05 +03:00
parent ad4d00677b
commit 07fc7b9227
2 changed files with 35 additions and 3 deletions

View File

@ -418,15 +418,15 @@ smoke-fault: build-test
test: build-test
@echo ' RUNNING `test/long_stochastic.sh --loops 2`...'
$(QUIET)test/long_stochastic.sh --dont-check-ram-size --loops 2 --db-upto-mb 256 --skip-make >$(TEST_LOG) || (cat $(TEST_LOG) && false)
$(QUIET)test/long_stochastic.sh --dont-check-ram-size --loops 2 --db-upto-mb 256 --skip-make --taillog >$(TEST_LOG) || (cat $(TEST_LOG) && false)
long-test: build-test
@echo ' RUNNING `test/long_stochastic.sh --loops 42`...'
$(QUIET)test/long_stochastic.sh --loops 42 --db-upto-mb 1024 --skip-make
$(QUIET)test/long_stochastic.sh --loops 42 --db-upto-mb 1024 --skip-make --taillog
test-singleprocess: build-test
@echo ' RUNNING `test/long_stochastic.sh --single --loops 2`...'
$(QUIET)test/long_stochastic.sh --dont-check-ram-size --single --loops 2 --db-upto-mb 256 --skip-make >$(TEST_LOG) || (cat $(TEST_LOG) && false)
$(QUIET)test/long_stochastic.sh --dont-check-ram-size --single --loops 2 --db-upto-mb 256 --skip-make --taillog >$(TEST_LOG) || (cat $(TEST_LOG) && false)
test-valgrind: CFLAGS_EXTRA=-Ofast -DMDBX_USE_VALGRIND
test-valgrind: build-test

View File

@ -13,6 +13,7 @@ DB_UPTO_MB=17408
PAGESIZE=min
DONT_CHECK_RAM=no
EXTRA=no
TAILLOG=0
while [ -n "$1" ]
do
@ -35,9 +36,13 @@ do
echo "--pagesize NN Use specified page size (256 is minimal and used by default)"
echo "--dont-check-ram-size Don't check available RAM"
echo "--extra Iterate extra modes/flags"
echo "--taillog Dump tail of test log on failure"
echo "--help Print this usage help and exit"
exit -2
;;
--taillog)
TAILLOG=999
;;
--multi)
LIST=basic
;;
@ -345,14 +350,38 @@ if which lz4 >/dev/null; then
function logger {
lz4 > ${TESTDB_DIR}/long.log.lz4
}
function taillog {
if [ -s ${TESTDB_DIR}/long.log.lz4 ]; then
echo "=============================================== last ${TAILLOG} lines"
lz4 -d -c ${TESTDB_DIR}/long.log.lz4 | tail -n ${TAILLOG}
else
echo "=============================================== no test log"
fi
}
elif which gzip >/dev/null; then
function logger {
gzip > ${TESTDB_DIR}/long.log.gz
}
function taillog {
if [ -s ${TESTDB_DIR}/long.log.gz ]; then
echo "=============================================== last ${TAILLOG} lines"
gzip -d -c ${TESTDB_DIR}/long.log.gz | tail -n ${TAILLOG}
else
echo "=============================================== no test log"
fi
}
else
function logger {
cat > ${TESTDB_DIR}/long.log
}
function taillog {
if [ -s ${TESTDB_DIR}/long.log ]; then
echo "=============================================== last ${TAILLOG} lines"
tail -n ${TAILLOG} ${TESTDB_DIR}/long.log
else
echo "=============================================== no test log"
fi
}
fi
if [ "$EXTRA" != "no" ]; then
@ -375,6 +404,9 @@ function bits2options {
function failed {
echo "FAILED" >&2
if [ ${TAILLOG} -gt 0 ]; then
taillog
fi
exit 1
}