aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/appveyor-build.sh1
-rwxr-xr-xtest/lint.sh4
-rw-r--r--test/meson.build2
-rwxr-xr-xtest/test_sshfs.py12
-rwxr-xr-xtest/travis-build.sh12
-rw-r--r--test/util.py2
6 files changed, 21 insertions, 12 deletions
diff --git a/test/appveyor-build.sh b/test/appveyor-build.sh
index dcf7800..da4e01e 100755
--- a/test/appveyor-build.sh
+++ b/test/appveyor-build.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
machine=$(uname -m)
mkdir "build-$machine"
diff --git a/test/lint.sh b/test/lint.sh
new file mode 100755
index 0000000..5418df5
--- /dev/null
+++ b/test/lint.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -e
+pip3 install --user pre-commit
+pre-commit run --all-files --show-diff-on-failure
diff --git a/test/meson.build b/test/meson.build
index 3229a6c..c0edde2 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -2,7 +2,7 @@ test_scripts = [ 'conftest.py', 'pytest.ini', 'test_sshfs.py',
'util.py' ]
custom_target('test_scripts', input: test_scripts,
output: test_scripts, build_by_default: true,
- command: ['cp', '-fPp',
+ command: ['cp', '-fPp',
'@INPUT@', meson.current_build_dir() ])
# Provide something helpful when running 'ninja test'
diff --git a/test/test_sshfs.py b/test/test_sshfs.py
index 71cbd7f..1724555 100755
--- a/test/test_sshfs.py
+++ b/test/test_sshfs.py
@@ -35,15 +35,15 @@ def name_generator(__ctr=[0]):
@pytest.mark.parametrize("sync_rd", (True, False))
@pytest.mark.parametrize("multiconn", (True,False))
def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, multiconn, capfd):
-
+
# Avoid false positives from debug messages
#if debug:
# capfd.register_output(r'^ unique: [0-9]+, error: -[0-9]+ .+$',
# count=0)
- # Avoid false positives from storing key for localhost
+ # Avoid false positives from storing key for localhost
capfd.register_output(r"^Warning: Permanently added 'localhost' .+", count=0)
-
+
# Test if we can ssh into localhost without password
try:
res = subprocess.call(['ssh', '-o', 'KbdInteractiveAuthentication=no',
@@ -80,12 +80,12 @@ def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, multiconn, capfd):
if multiconn:
cmdline += [ '-o', 'max_conns=3' ]
-
+
new_env = dict(os.environ) # copy, don't modify
# Abort on warnings from glib
new_env['G_DEBUG'] = 'fatal-warnings'
-
+
mount_process = subprocess.Popen(cmdline, env=new_env)
try:
wait_for_mount(mount_process, mnt_dir)
@@ -299,7 +299,7 @@ def tst_link(mnt_dir, cache_timeout):
# we need to wait until the cached value has expired.
if cache_timeout:
safe_sleep(cache_timeout)
-
+
fstat1 = os.lstat(name1)
fstat2 = os.lstat(name2)
for attr in ('st_mode', 'st_dev', 'st_uid', 'st_gid',
diff --git a/test/travis-build.sh b/test/travis-build.sh
index c33f7dc..aa72cb2 100755
--- a/test/travis-build.sh
+++ b/test/travis-build.sh
@@ -6,36 +6,40 @@ set -e
# that we still need to fix
export ASAN_OPTIONS="detect_leaks=0"
-export LSAN_OPTIONS="suppressions=$(pwd)/test/lsan_suppress.txt"
+export LSAN_OPTIONS="suppressions=${PWD}/test/lsan_suppress.txt"
export CC
TEST_CMD="python3 -m pytest --maxfail=99 test/"
# Standard build with Valgrind
for CC in gcc clang; do
+ (
mkdir "build-${CC}"; cd "build-${CC}"
if [ "${CC}" == 'gcc-6' ]; then
build_opts='-D b_lundef=false'
else
build_opts=''
fi
+ # shellcheck disable=SC2086
meson -D werror=true ${build_opts} ../
ninja
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}"
+ (
+ 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 ..
ninja
${TEST_CMD}
sudo ninja install
- cd ..
+ )
done
diff --git a/test/util.py b/test/util.py
index cde0255..261a1c6 100644
--- a/test/util.py
+++ b/test/util.py
@@ -29,7 +29,7 @@ def cleanup(mount_process, mnt_dir):
mount_process.wait(1)
except subprocess.TimeoutExpired:
mount_process.kill()
-
+
def umount(mount_process, mnt_dir):
subprocess.check_call(['fusermount3', '-z', '-u', mnt_dir ])