Add ioctl tests.
authorNikolaus Rath <Nikolaus@rath.org>
Fri, 13 May 2016 20:11:54 +0000 (13:11 -0700)
committerNikolaus Rath <Nikolaus@rath.org>
Fri, 13 May 2016 20:12:40 +0000 (13:12 -0700)
test/test_examples.py

index 02d3409ca13ff5011e313fb383a57a70b4b0b32f..31d2faee63c92046585211512e7af17023bbecb7 100755 (executable)
@@ -83,6 +83,30 @@ def test_fusexmp_fh(tmpdir, name):
     else:
         umount(mount_process, mnt_dir)
 
+def test_fioc(tmpdir):
+    mnt_dir = str(tmpdir)
+    testfile = os.path.join(mnt_dir, 'fioc')
+    cmdline = [os.path.join(basename, 'example', 'fioc'),
+               '-f', mnt_dir ]
+    mount_process = subprocess.Popen(cmdline)
+    try:
+        wait_for_mount(mount_process, mnt_dir)
+
+        base_cmd = [ os.path.join(basename, 'example', 'fioclient'),
+                     testfile ]
+        assert subprocess.check_output(base_cmd) == b'0\n'
+        with open(testfile, 'wb') as fh:
+            fh.write(b'foobar')
+        assert subprocess.check_output(base_cmd) == b'6\n'
+        subprocess.check_call(base_cmd + [ '3' ])
+        with open(testfile, 'rb') as fh:
+            assert fh.read()== b'foo'
+    except:
+        cleanup(mnt_dir)
+        raise
+    else:
+        umount(mount_process, mnt_dir)
+
 def test_fsel(tmpdir):
     mnt_dir = str(tmpdir)
     cmdline = [os.path.join(basename, 'example', 'fsel'),