Skip tests that aren't supported under FreeBSD.
authorNikolaus Rath <Nikolaus@rath.org>
Fri, 11 Aug 2017 18:15:27 +0000 (20:15 +0200)
committerNikolaus Rath <Nikolaus@rath.org>
Fri, 11 Aug 2017 19:13:40 +0000 (21:13 +0200)
test/test_ctests.py
test/test_examples.py
test/test_syscalls.c

index ef643efd680a9e0fb5f698976150cd2548f06154..4ad03fb93d027c17b0021c6372e2e26b8b2d7170 100644 (file)
@@ -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)
index 30a9337717feae75f54ccca5477b640512d85cc3..760e56f28b435199240a2cb571ad4ed14bba8132 100755 (executable)
@@ -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'))
 
index e30cfc19d3f8afc15d940759570af21e5afdd992..392a21071a4bd66786e53436e3af3bc8324a8694 100644 (file)
@@ -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();