From 07636c619d3adee043e17ea8a713de8cbf148536 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Fri, 11 Aug 2017 20:15:27 +0200 Subject: Skip tests that aren't supported under FreeBSD. --- test/test_ctests.py | 10 +++++++--- test/test_examples.py | 15 +++++++++++---- test/test_syscalls.c | 8 +++++++- 3 files changed, 25 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_ctests.py b/test/test_ctests.py index ef643ef..4ad03fb 100644 --- a/test/test_ctests.py +++ b/test/test_ctests.py @@ -8,6 +8,7 @@ if __name__ == '__main__': import subprocess import pytest import platform +import sys from distutils.version import LooseVersion from util import (wait_for_mount, umount, cleanup, base_cmdline, safe_sleep, basename, fuse_test_marker) @@ -15,6 +16,8 @@ from os.path import join as pjoin pytestmark = fuse_test_marker() +@pytest.mark.skipif('bsd' in sys.platform, + reason='writeback requires Linux') @pytest.mark.parametrize("writeback", (False, True)) def test_write_cache(tmpdir, writeback): if writeback and LooseVersion(platform.release()) < '3.14': @@ -31,9 +34,10 @@ def test_write_cache(tmpdir, writeback): subprocess.check_call(cmdline) -@pytest.mark.parametrize("name", - ('notify_inval_inode', - 'notify_store_retrieve')) +names = [ 'notify_inval_inode' ] +if sys.platform == 'linux': + names.append('notify_store_retrieve') +@pytest.mark.parametrize("name", names) @pytest.mark.parametrize("notify", (True, False)) def test_notify1(tmpdir, name, notify): mnt_dir = str(tmpdir) diff --git a/test/test_examples.py b/test/test_examples.py index 30a9337..760e56f 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -14,6 +14,7 @@ import shutil import filecmp import time import errno +import sys from tempfile import NamedTemporaryFile from contextlib import contextmanager from util import (wait_for_mount, umount, cleanup, base_cmdline, @@ -31,8 +32,11 @@ def name_generator(__ctr=[0]): __ctr[0] += 1 return 'testfile_%d' % __ctr[0] +options = [ [] ] +if sys.platform == 'linux': + options.append(['-o', 'clone_fd']) +@pytest.mark.parametrize("options", options) @pytest.mark.parametrize("name", ('hello', 'hello_ll')) -@pytest.mark.parametrize("options", ([], ['-o', 'clone_fd'])) def test_hello(tmpdir, name, options): mnt_dir = str(tmpdir) cmdline = base_cmdline + \ @@ -60,9 +64,8 @@ def test_hello(tmpdir, name, options): else: umount(mount_process, mnt_dir) -@pytest.mark.skipif( - not os.path.exists(pjoin(basename, 'example', 'passthrough_ll')), - reason='example not compiled') +@pytest.mark.skipif('bsd' in sys.platform, + reason='not supported under BSD') @pytest.mark.parametrize("writeback", (False, True)) @pytest.mark.parametrize("debug", (False, True)) def test_passthrough_ll(tmpdir, writeback, debug, capfd): @@ -113,6 +116,10 @@ def test_passthrough(tmpdir, name, debug, capfd): capfd.register_output(r'^ unique: [0-9]+, error: -[0-9]+ .+$', count=0) + # test_syscalls prints "No error" under FreeBSD + capfd.register_output(r"^ \d\d \[[^\]]+ message: 'No error: 0'\]", + count=0) + mnt_dir = str(tmpdir.mkdir('mnt')) src_dir = str(tmpdir.mkdir('src')) diff --git a/test/test_syscalls.c b/test/test_syscalls.c index e30cfc1..392a210 100644 --- a/test/test_syscalls.c +++ b/test/test_syscalls.c @@ -792,6 +792,7 @@ static int test_create_unlink(void) return 0; } +#ifndef __FreeBSD__ static int test_mknod(void) { int err = 0; @@ -824,6 +825,7 @@ static int test_mknod(void) success(); return 0; } +#endif #define test_open(exist, flags, mode) do_test_open(exist, flags, #flags, mode) @@ -1280,6 +1282,7 @@ static int test_rename_dir(void) return 0; } +#ifndef __FreeBSD__ static int test_mkfifo(void) { int res; @@ -1311,6 +1314,7 @@ static int test_mkfifo(void) success(); return 0; } +#endif static int test_mkdir(void) { @@ -1447,11 +1451,13 @@ int main(int argc, char *argv[]) err += test_create(); err += test_create_unlink(); - err += test_mknod(); err += test_symlink(); err += test_link(); err += test_link2(); +#ifndef __FreeBSD__ + err += test_mknod(); err += test_mkfifo(); +#endif err += test_mkdir(); err += test_rename_file(); err += test_rename_dir(); -- cgit v1.2.3