-
Notifications
You must be signed in to change notification settings - Fork 249
/
test.sh
executable file
·68 lines (59 loc) · 1.82 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
PYTHON=python3
###############################################################################
set -e
CLEAN=0
VENV_DIR=.venv
while getopts ":ce:k:s" OPTION; do
case $OPTION in
c)
CLEAN=1
;;
e)
VENV_DIR=$OPTARG
;;
k)
PYTEST_ARGS="${PYTEST_ARGS} -k $OPTARG"
;;
s)
USE_SANITIZERS=1
;;
\?)
echo "Usage: $0 [-c] [-e VIRTUALENV] [-s]"
echo ""
echo "Options:"
echo " -c: clean igraph's already-built C core before running tests"
echo " -e VIRTUALENV: use the given virtualenv instead of .venv"
echo " -s: compile the C core and the Python module with sanitizers enabled"
exit 1
;;
esac
done
shift $((OPTIND -1))
if [ "x$USE_SANITIZERS" = x1 ]; then
if [ "`python3 -c 'import platform; print(platform.system())'`" != "Linux" ]; then
echo "Compiling igraph with sanitizers is currently supported on Linux only."
exit 1
fi
fi
if [ ! -d $VENV_DIR ]; then
$PYTHON -m venv $VENV_DIR
$VENV_DIR/bin/pip install -U pip wheel
fi
rm -rf build/
if [ x$CLEAN = x1 ]; then
rm -rf vendor/build vendor/install
fi
# pip install is called in verbose mode so we can see the compiler warnings
if [ "x$USE_SANITIZERS" = x1 ]; then
# Do not run plotting tests -- they tend to have lots of false positives in
# the sanitizer output
IGRAPH_USE_SANITIZERS=1 $VENV_DIR/bin/pip install -v .[test]
LD_PRELOAD=$(gcc -print-file-name=libasan.so) \
LSAN_OPTIONS=suppressions=etc/lsan-suppr.txt:print_suppressions=false \
ASAN_OPTIONS=detect_stack_use_after_return=1 \
$VENV_DIR/bin/pytest tests ${PYTEST_ARGS}
else
$VENV_DIR/bin/pip install -v .[plotting,test]
$VENV_DIR/bin/pytest tests ${PYTEST_ARGS}
fi