From 144cbbabb8096ef1e11ce3c32ca7d4f194ba3fd4 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, 8 Nov 2022 20:12:05 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-test:=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D0=B6=D0=BA=D0=B0=20MinGW=20=D0=B2=20=D1=81=D0=BA=D1=80?= =?UTF-8?q?=D0=B8=D0=BF=D1=82=D0=B0=D1=85=20=D1=82=D0=B5=D1=81=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20CI.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/long_stochastic.sh | 10 ++++- test/stochastic_small.sh | 95 +++++++++++++++++++++++++++++++++++----- 2 files changed, 94 insertions(+), 11 deletions(-) diff --git a/test/long_stochastic.sh b/test/long_stochastic.sh index d75607ec..9ee13e1c 100755 --- a/test/long_stochastic.sh +++ b/test/long_stochastic.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -LIST=basic +LIST=--hill FROM=1 UPTO=9999999 MONITOR= @@ -222,6 +222,14 @@ case ${UNAME} in ;; MSYS*|MINGW*) + if [ -z "${TESTDB_DIR:-}" ]; then + for old_test_dir in $(ls -d /tmp/mdbx-test.[0-9]* 2>/dev/null); do + rm -rf $old_test_dir + done + TESTDB_DIR="/tmp/mdbx-test.$$" + fi + mkdir -p $TESTDB_DIR && rm -f $TESTDB_DIR/* + echo "FIXME: Fake support for ${UNAME}" ram_avail_mb=32768 ;; diff --git a/test/stochastic_small.sh b/test/stochastic_small.sh index b0aa1cb7..1ae45ea7 100755 --- a/test/stochastic_small.sh +++ b/test/stochastic_small.sh @@ -1,18 +1,17 @@ #!/usr/bin/env bash -if ! which make cc c++ tee >/dev/null; then - echo "Please install the following prerequisites: make cc c++ tee banner" >&2 - exit 1 -fi -LIST=--hill +LIST=basic FROM=1 -UPTO=9999 +UPTO=9999999 MONITOR= LOOPS= SKIP_MAKE=no +GEOMETRY_JITTER=yes BANNER="$(which banner 2>/dev/null | echo echo)" UNAME="$(uname -s 2>/dev/null || echo Unknown)" DB_UPTO_MB=17408 +PAGESIZE=min + while [ -n "$1" ] do @@ -20,6 +19,10 @@ do --help) echo "--multi Engage multi-process test scenario (default)" echo "--single Execute series of single-process tests (for QEMU, etc)" + echo "--nested Execute only 'nested' testcase" + echo "--hill Execute only 'hill' testcase" + echo "--append Execute only 'append' testcase" + echo "--ttl Execute only 'ttl' testcase" echo "--with-valgrind Run tests under Valgrind's memcheck tool" echo "--skip-make Don't (re)build libmdbx and test's executable" echo "--from NN Start iterating from the NN ops per test case" @@ -27,6 +30,8 @@ do echo "--loops NN Stop after the NN loops" echo "--dir PATH Specifies directory for test DB and other files (it will be cleared)" echo "--db-upto-mb NN Limits upper size of test DB to the NN megabytes" + echo "--no-geometry-jitter Disable jitter for geometry upper-size" + echo "--pagesize NN Use specified page size (256 is minimal and used by default) " echo "--help Print this usage help and exit" exit -2 ;; @@ -36,6 +41,18 @@ do --single) LIST="--nested --hill --append --ttl --copy" ;; + --nested) + LIST="--nested" + ;; + --hill) + LIST="--hill" + ;; + --append) + LIST="--append" + ;; + --ttl) + LIST="--ttl" + ;; --with-valgrind) echo " NOTE: Valgrind could produce some false-positive warnings" echo " in multi-process environment with shared memory." @@ -88,6 +105,42 @@ do fi shift ;; + --no-geometry-jitter) + GEOMETRY_JITTER=no + ;; + --pagesize|--page-size) + case "$2" in + min|max|256|512|1024|2048|4096|8192|16386|32768|65536) + PAGESIZE=$2 + ;; + 1|1k|1K|k|K) + PAGESIZE=$((1024*1)) + ;; + 2|2k|2K) + PAGESIZE=$((1024*2)) + ;; + 4|4k|4K) + PAGESIZE=$((1024*4)) + ;; + 8|8k|8K) + PAGESIZE=$((1024*8)) + ;; + 16|16k|16K) + PAGESIZE=$((1024*16)) + ;; + 32|32k|32K) + PAGESIZE=$((1024*32)) + ;; + 64|64k|64K) + PAGESIZE=$((1024*64)) + ;; + *) + echo "Invalig page size '$2'" + exit -2 + ;; + esac + shift + ;; *) echo "Unknown option '$1'" exit -2 @@ -107,6 +160,11 @@ if [ -z "$MONITOR" ]; then export MALLOC_CHECK_=7 MALLOC_PERTURB_=42 fi +if ! which $([ "$SKIP_MAKE" == "no" ] && echo make cc c++) tee >/dev/null; then + echo "Please install the following prerequisites: make cc c++ tee banner" >&2 + exit 1 +fi + ############################################################################### # 1. clean data from prev runs and examine available RAM @@ -123,9 +181,9 @@ case ${UNAME} in mkdir -p $TESTDB_DIR && rm -f $TESTDB_DIR/* if LC_ALL=C free | grep -q -i available; then - ram_avail_mb=$(($(LC_ALL=C free | grep -i Mem: | tr -s [:blank:] ' ' | cut -d ' ' -f 7) / 1024)) + ram_avail_mb=$(($(LC_ALL=C free | grep -i Mem: | tr -s '[:blank:]' ' ' | cut -d ' ' -f 7) / 1024)) else - ram_avail_mb=$(($(LC_ALL=C free | grep -i Mem: | tr -s [:blank:] ' ' | cut -d ' ' -f 4) / 1024)) + ram_avail_mb=$(($(LC_ALL=C free | grep -i Mem: | tr -s '[:blank:]' ' ' | cut -d ' ' -f 4) / 1024)) fi ;; @@ -164,6 +222,19 @@ case ${UNAME} in echo "pagesize ${pagesize}K, freepages ${freepages}, ram_avail_mb ${ram_avail_mb}" ;; + MSYS*|MINGW*) + if [ -z "${TESTDB_DIR:-}" ]; then + for old_test_dir in $(ls -d /tmp/mdbx-test.[0-9]* 2>/dev/null); do + rm -rf $old_test_dir + done + TESTDB_DIR="/tmp/mdbx-test.$$" + fi + mkdir -p $TESTDB_DIR && rm -f $TESTDB_DIR/* + + echo "FIXME: Fake support for ${UNAME}" + ram_avail_mb=32768 + ;; + *) echo "FIXME: ${UNAME} not supported by this script" exit 2 @@ -236,6 +307,10 @@ case ${UNAME} in fi ;; + MSYS*|MINGW*) + echo "FIXME: Fake support for ${UNAME}" + ;; + *) echo "FIXME: ${UNAME} not supported by this script" exit 2 @@ -300,8 +375,8 @@ function probe { rm -f ${TESTDB_DIR}/* || failed for case in $LIST do - echo "Run ./mdbx_test ${speculum} --random-writemap=no --ignore-dbfull --repeat=1 --pathname=${TESTDB_DIR}/long.db --cleanup-after=no $@ $case" - ${MONITOR} ./mdbx_test ${speculum} --random-writemap=no --ignore-dbfull --repeat=1 --pathname=${TESTDB_DIR}/long.db --cleanup-before=yes --cleanup-after=no "$@" $case | check_deep \ + 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 \ && ${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