blob: dc4612085bb0bd27e88c78db3bd774c5fa10fe4f (
plain)
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
69
|
#!/bin/bash
set -e
# Disable leak checking for now, there are some issues (or false positives)
# that we still need to fix
export ASAN_OPTIONS="detect_leaks=0"
export LSAN_OPTIONS="suppressions=$(pwd)/test/lsan_suppress.txt"
export CC
TEST_CMD="python3 -m pytest --maxfail=99 test/"
# Make sure binaries can be accessed when invoked by root.
umask 0022
# There are tests that run as root but without CAP_DAC_OVERRIDE. To allow these
# to launch built binaries, the directory tree must be accessible to the root
# user. Since the source directory isn't necessarily accessible to root, we
# build and run tests in a temporary directory that we can set up to be world
# readable/executable.
SOURCE_DIR="$(readlink -f .)"
TEST_DIR="$(mktemp -dt libfuse-build-XXXXXX)"
chmod 0755 "${TEST_DIR}"
cd "${TEST_DIR}"
# Standard build
for CC in gcc gcc-7 clang; do
mkdir build-${CC}; cd build-${CC}
if [ ${CC} == 'gcc-7' ]; then
build_opts='-D b_lundef=false'
else
build_opts=''
fi
meson -D werror=true ${build_opts} "${SOURCE_DIR}"
ninja
sudo chown root:root util/fusermount3
sudo chmod 4755 util/fusermount3
TEST_WITH_VALGRIND=true ${TEST_CMD}
cd ..
done
(cd build-$CC; sudo ninja install)
# Sanitized build
CC=clang
for san in undefined address; do
mkdir build-${san}; cd build-${san}
# b_lundef=false is required to work around clang
# bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
meson -D b_sanitize=${san} -D b_lundef=false -D werror=true "${SOURCE_DIR}"
ninja
# Test as root and regular user
sudo ${TEST_CMD}
sudo chown root:root util/fusermount3
sudo chmod 4755 util/fusermount3
# Cleanup temporary files (since they're now owned by root)
sudo rm -rf test/.pytest_cache/ test/__pycache__
${TEST_CMD}
cd ..
done
# Documentation.
(cd "${SOURCE_DIR}"; doxygen doc/Doxyfile)
# Clean up.
rm -rf "${TEST_DIR}"
|