aboutsummaryrefslogtreecommitdiff
path: root/test/test_fuse.py
blob: bbba6e060b9a0b5c1ea86e69da2412ec04abf25f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
import pytest
import sys

if __name__ == '__main__':
    sys.exit(pytest.main([__file__] + sys.argv[1:]))

import subprocess
import os
from util import wait_for_mount, umount, cleanup

basename = os.path.join(os.path.dirname(__file__), '..')

def test_fuse(tmpdir):
    mnt_dir = str(tmpdir.mkdir('mnt'))
    src_dir = str(tmpdir.mkdir('src'))

    cmdline = [ os.path.join(basename, 'example', 'fusexmp_fh'),
                '-f', '-o' , 'use_ino,readdir_ino,kernel_cache',
                mnt_dir ]
    mount_process = subprocess.Popen(cmdline)
    try:
        wait_for_mount(mount_process, mnt_dir)
        cmdline = [ os.path.join(basename, 'test', 'test'),
                    os.path.join(mnt_dir, src_dir),
                    ':' + src_dir ]
        subprocess.check_call(cmdline)
    except:
        cleanup(mnt_dir)
        raise
    else:
        umount(mount_process, mnt_dir)