Skip to content

Commit

Permalink
Skip tests that aren't supported under FreeBSD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikratio committed Aug 11, 2017
1 parent c869f31 commit 07636c6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
10 changes: 7 additions & 3 deletions test/test_ctests.py
Expand Up @@ -8,13 +8,16 @@
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)
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':
Expand All @@ -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)
Expand Down
15 changes: 11 additions & 4 deletions test/test_examples.py
Expand Up @@ -14,6 +14,7 @@
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,
Expand All @@ -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 + \
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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'))

Expand Down
8 changes: 7 additions & 1 deletion test/test_syscalls.c
Expand Up @@ -792,6 +792,7 @@ static int test_create_unlink(void)
return 0;
}

#ifndef __FreeBSD__
static int test_mknod(void)
{
int err = 0;
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -1280,6 +1282,7 @@ static int test_rename_dir(void)
return 0;
}

#ifndef __FreeBSD__
static int test_mkfifo(void)
{
int res;
Expand Down Expand Up @@ -1311,6 +1314,7 @@ static int test_mkfifo(void)
success();
return 0;
}
#endif

static int test_mkdir(void)
{
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 07636c6

Please sign in to comment.