poco/runLibTests.sh
Aleksandar Fabijanic 1e90f64bbf
4307/8/9/10 data races (#4312)
* fix(NumericString): properly mark uIntToString deprecated #4304

* dev(runLibtests): allow to specify test to run

* fix(NotificationCenter): data race #4307

* fix(DirectoryWatcher): data race #4308

* fix(ArchiveStrategy): data race #4309

* fix(ActiveThread): data race #4310

* fix(Task): Cancelled Task shouldn't start running #4311 (WIP)

* fix(String): ignore clang loop unrolling warnings

* fix(TaskManager): task ownership #4311

* chore(FIFOEventTest): fix unused var warning; disable benchmark in test

* fix(Task): remove unnecessary mutex (and prevent cyclic locking reported by TSAN)

* fix(CryptoTest): disable testEncryptDecryptGCM

* fix(ci): typo

* fix(NotificationCenter): disable and clear observers in dtor (#4307)

---------

Co-authored-by: Matej Kenda <matejken@gmail.com>
2023-12-09 21:16:24 +01:00

93 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
#
# Script to rebuild libraries and dependencies
# (with or without a sanitizer) and run the tests.
#
# The use case of the script is mainly for development purposes -
# to clean and rebuild a single library, with all of its dependencies,
# and run the tests.
#
# Usage: ./runLibTests.sh library [address | undefined | thread] [<test> | -all | none]
#
# Example: ./runLibTests.sh Data/SQLite address
# (distcleans, rebuilds and runs tests for Data/SQLite with address sanitizer)
#
# Known shortcomings (TODO):
# - the script does not check if the library is a dependency of another library
# workaround: run the script for the dependent libraries first
#
# g++ does not like empty quoted arguments, but
# the shellcheck wants them quoted to remain quiet
# shellcheck disable=SC2086
path=$1
if [ -z "${path}" ]; then
echo "Library not specified"
echo "Usage: $0 path [address | undefined | thread] [<test> | -all | none]"
exit 1
fi
libraries=
IFS='/' read -r -a libraries <<< "$path"
self="${BASH_SOURCE[0]}"
if [ -d "$self" ] ; then
basedir="$(cd "$self" || exit; pwd -P)"
else
basedir="$(cd "$(dirname "$self")" || exit; pwd -P)"
fi
# shellcheck disable=SC1091
. "$basedir"/poco_env.bash
flag=$2
flags=
if [ -n "${flag}" ]; then
flags=SANITIZEFLAGS+=-fsanitize="$flag"
fi
path="$basedir"/"${libraries[0]}"
make distclean -C "$basedir"/Foundation
make distclean -C "$basedir"/CppUnit
make -s -j4 -C "$basedir"/Foundation $flags
make -s -j4 -C "$basedir"/CppUnit $flags
test=$3
if [ -z "${test}" ]; then
test="-all"
fi
# Foundation requested, build/run tests and exit
if [[ "$path" == "$basedir"/"Foundation" ]]; then
cd "$path/testsuite/" || exit
make -s -j4 -C ./ $flags
cd "bin/$OSNAME/$OSARCH/" || exit
if [[ "$test" != "none" ]]; then
./testrunner "${test}"
./testrunnerd "${test}"
fi
echo "$path $flags done."
exit 0
fi
for library in "${libraries[@]}"
do
cd "$library" || exit
make distclean
make -s -j4 -C ./ $flags
cd testsuite || exit
make distclean
make -s -j4 -C ./ $flags
cd bin/"$OSNAME"/"$OSARCH"/ || exit
if [[ "$test" != "none" ]]; then
./testrunner "${test}"
./testrunnerd "${test}"
fi
echo "$1 $flags done."
cd ../../../../ || exit
done