mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-22 04:02:59 +08:00
create integration tests
This commit is contained in:
parent
4293cb7253
commit
374580a85d
19
tests/TEST_no_fuse_hidden
Executable file
19
tests/TEST_no_fuse_hidden
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
(fd,filepath) = tempfile.mkstemp(dir=sys.argv[1])
|
||||
|
||||
ino = os.fstat(fd).st_ino
|
||||
|
||||
os.unlink(filepath)
|
||||
|
||||
for entry in os.scandir(sys.argv[1]):
|
||||
if entry.inode() == ino:
|
||||
print("found .fuse_hidden file {}".format(entry.name),end='')
|
||||
os.close(fd)
|
||||
sys.exit(1)
|
||||
|
||||
os.close(fd)
|
15
tests/TEST_use_fchmod_after_unlink
Executable file
15
tests/TEST_use_fchmod_after_unlink
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
(fd,filepath) = tempfile.mkstemp(dir=sys.argv[1])
|
||||
|
||||
os.fchmod(fd,0o777)
|
||||
|
||||
os.unlink(filepath)
|
||||
|
||||
os.fchmod(fd,0o777)
|
||||
|
||||
os.close(fd)
|
15
tests/TEST_use_fchown_after_unlink
Executable file
15
tests/TEST_use_fchown_after_unlink
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
(fd,filepath) = tempfile.mkstemp(dir=sys.argv[1])
|
||||
|
||||
os.fchown(fd,os.getuid(),os.getgid())
|
||||
|
||||
os.unlink(filepath)
|
||||
|
||||
os.fchown(fd,os.getuid(),os.getgid())
|
||||
|
||||
os.close(fd)
|
15
tests/TEST_use_fstat_after_unlink
Executable file
15
tests/TEST_use_fstat_after_unlink
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
(fd,filepath) = tempfile.mkstemp(dir=sys.argv[1])
|
||||
|
||||
os.fstat(fd)
|
||||
|
||||
os.unlink(filepath)
|
||||
|
||||
os.fstat(fd)
|
||||
|
||||
os.close(fd)
|
31
tests/run-tests
Executable file
31
tests/run-tests
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('usage: run-test <mergerfs-path>\n',file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
test_path = os.path.realpath(sys.argv[0])
|
||||
test_path = os.path.dirname(test_path)
|
||||
|
||||
for entry in os.scandir(test_path):
|
||||
if not entry.name.startswith('TEST_'):
|
||||
continue
|
||||
|
||||
try:
|
||||
print(entry.name + ': ',end='')
|
||||
fullpath = os.path.join(test_path,entry.name)
|
||||
args = [fullpath,sys.argv[1]]
|
||||
rv = subprocess.Popen(args,stdout=subprocess.PIPE)
|
||||
rv.wait(timeout=10000)
|
||||
if rv.returncode:
|
||||
output = rv.stdout.read().decode()
|
||||
print('FAIL - {}'.format(output))
|
||||
else:
|
||||
print('PASS')
|
||||
except Exception as e:
|
||||
print('FAIL - {}'.format(e))
|
Loading…
Reference in New Issue
Block a user