From 07fc7b9227b699397f8c838c36f2ab719bfddcd6 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: Mon, 30 Oct 2023 12:25:05 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-test:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=BF=D1=86=D0=B8=D0=B8?= =?UTF-8?q?=20`--taillog`=20=D0=B2=20=D1=81=D1=82=D0=BE=D1=85=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B8=D0=B9=20=D1=81=D0=BA?= =?UTF-8?q?=D1=80=D0=B8=D0=BF=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GNUmakefile | 6 +++--- test/long_stochastic.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index c8d79a95..104ae372 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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 diff --git a/test/long_stochastic.sh b/test/long_stochastic.sh index 491ec695..c03c83da 100755 --- a/test/long_stochastic.sh +++ b/test/long_stochastic.sh @@ -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 }