Browse Source
Merge pull request #610 from trapexit/tests
create integration tests
pull/611/head
trapexit
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
95 additions and
0 deletions
-
tests/TEST_no_fuse_hidden
-
tests/TEST_use_fchmod_after_unlink
-
tests/TEST_use_fchown_after_unlink
-
tests/TEST_use_fstat_after_unlink
-
tests/run-tests
|
@ -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) |
|
@ -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) |
|
@ -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) |
|
@ -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) |
|
@ -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)) |