mdbx-test: поддержка MinGW в скриптах тестирования для CI.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-11-08 20:12:05 +03:00
parent c270306580
commit 144cbbabb8
2 changed files with 94 additions and 11 deletions

View File

@ -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
;;

View File

@ -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