From 6b0d363b6a5461471c98611b63b7fb172a8e25e8 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Fri, 25 Aug 2017 09:46:50 +0200 Subject: examples/{ioctl,null}: don't build under FreeBSD instead of skipping tests. --- example/meson.build | 14 ++++++++------ test/test_examples.py | 35 +++++++++++++++-------------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/example/meson.build b/example/meson.build index de2de42..8440e00 100644 --- a/example/meson.build +++ b/example/meson.build @@ -1,13 +1,15 @@ -# Attention, emacs, please use -*- mode: python -*- -# (even though this isn't actually Python code) - examples = [ 'passthrough', 'passthrough_fh', - 'null', 'hello', 'hello_ll', 'printcap', - 'ioctl', 'ioctl_client', 'poll_client', + 'hello', 'hello_ll', 'printcap', + 'ioctl_client', 'poll_client', 'cuse', 'cuse_client' ] if not platform.endswith('bsd') - examples += 'passthrough_ll' + examples += 'passthrough_ll' + + # Is this really not supported? We should check with + # the FreeBSD guys, maybe we're just doing something + # wrong. + examples += [ 'null', 'ioctl' ] endif threaded_examples = [ 'notify_inval_inode', diff --git a/test/test_examples.py b/test/test_examples.py index 948f994..609cf24 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -66,13 +66,14 @@ def test_hello(tmpdir, name, options): umount(mount_process, mnt_dir) -@pytest.mark.skipif(not os.path.exists( - pjoin(basename, 'example', 'passthrough_ll')), - reason='not built') @pytest.mark.parametrize("writeback", (False, True)) @pytest.mark.parametrize("debug", (False, True)) def test_passthrough_ll(tmpdir, writeback, debug, capfd): + progname = pjoin(basename, 'example', 'passthrough_ll') + if not os.path.exists(progname): + pytest.skip('%s not built' % os.path.basename(progname)) + # Avoid false positives from libfuse debug messages if debug: capfd.register_output(r'^ unique: [0-9]+, error: -[0-9]+ .+$', @@ -81,9 +82,7 @@ def test_passthrough_ll(tmpdir, writeback, debug, capfd): mnt_dir = str(tmpdir.mkdir('mnt')) src_dir = str(tmpdir.mkdir('src')) - cmdline = base_cmdline + \ - [ pjoin(basename, 'example', 'passthrough_ll'), - '-f', mnt_dir ] + cmdline = base_cmdline + [ progname, '-f', mnt_dir ] if debug: cmdline.append('-d') @@ -167,16 +166,14 @@ def test_passthrough(tmpdir, name, debug, capfd): else: umount(mount_process, mnt_dir) -# Is this really not supported? We should check with -# the FreeBSD guys, maybe we're just doing something -# wrong. -@pytest.mark.skipif('freebsd' in sys.platform, - reason='not supported in FreeBSD') def test_ioctl(tmpdir): + progname = pjoin(basename, 'example', 'ioctl') + if not os.path.exists(progname): + pytest.skip('%s not built' % os.path.basename(progname)) + mnt_dir = str(tmpdir) testfile = pjoin(mnt_dir, 'fioc') - cmdline = base_cmdline + \ - [pjoin(basename, 'example', 'ioctl'), '-f', mnt_dir ] + cmdline = base_cmdline + [progname, '-f', mnt_dir ] mount_process = subprocess.Popen(cmdline) try: wait_for_mount(mount_process, mnt_dir) @@ -213,17 +210,15 @@ def test_poll(tmpdir): else: umount(mount_process, mnt_dir) -# Is this really not supported? We should check with -# the FreeBSD guys, maybe we're just doing something -# wrong. -@pytest.mark.skipif('freebsd' in sys.platform, - reason='not supported in FreeBSD') def test_null(tmpdir): + progname = pjoin(basename, 'example', 'null') + if not os.path.exists(progname): + pytest.skip('%s not built' % os.path.basename(progname)) + mnt_file = str(tmpdir) + '/file' with open(mnt_file, 'w') as fh: fh.write('dummy') - cmdline = base_cmdline + [pjoin(basename, 'example', 'null'), - '-f', mnt_file ] + cmdline = base_cmdline + [ progname, '-f', mnt_file ] mount_process = subprocess.Popen(cmdline) def test_fn(name): return os.stat(name).st_size > 4000 -- cgit v1.2.3