summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2019-05-05 13:11:03 -0400
committerNikolaus Rath <Nikolaus@rath.org>2019-05-09 14:16:37 -0500
commit055f272517306e6877a126e414aa60191b483eba (patch)
treea37dc1d38ad5fd2d76cb67dc32ba12ed445636a6 /test
parent625ed81b823b927ce7fdb1d34def624ceb2f3553 (diff)
downloadfuse-055f272517306e6877a126e414aa60191b483eba.tar.gz
Added new example filesystem
passthrough_hp puts emphasis and performance and correctness, rather than simplicity.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_examples.py54
-rw-r--r--test/test_syscalls.c11
-rwxr-xr-xtest/travis-build.sh9
3 files changed, 68 insertions, 6 deletions
diff --git a/test/test_examples.py b/test/test_examples.py
index 1b98a7c..3aabd19 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -153,6 +153,60 @@ def test_passthrough(tmpdir, name, debug, capfd, writeback):
else:
umount(mount_process, mnt_dir)
+@pytest.mark.parametrize("cache", (False, True))
+def test_passthrough_hp(tmpdir, cache):
+ mnt_dir = str(tmpdir.mkdir('mnt'))
+ src_dir = str(tmpdir.mkdir('src'))
+
+ cmdline = base_cmdline + \
+ [ pjoin(basename, 'example', 'passthrough_hp'),
+ src_dir, mnt_dir ]
+
+ if not cache:
+ cmdline.append('--nocache')
+
+ mount_process = subprocess.Popen(cmdline)
+ try:
+ wait_for_mount(mount_process, mnt_dir)
+
+ tst_statvfs(mnt_dir)
+ tst_readdir(src_dir, mnt_dir)
+ tst_readdir_big(src_dir, mnt_dir)
+ tst_open_read(src_dir, mnt_dir)
+ tst_open_write(src_dir, mnt_dir)
+ tst_create(mnt_dir)
+ tst_passthrough(src_dir, mnt_dir)
+ tst_append(src_dir, mnt_dir)
+ tst_seek(src_dir, mnt_dir)
+ tst_mkdir(mnt_dir)
+ tst_rmdir(src_dir, mnt_dir)
+ tst_unlink(src_dir, mnt_dir)
+ tst_symlink(mnt_dir)
+ if os.getuid() == 0:
+ tst_chown(mnt_dir)
+
+ # Underlying fs may not have full nanosecond resolution
+ tst_utimens(mnt_dir, ns_tol=1000)
+
+ tst_link(mnt_dir)
+ tst_truncate_path(mnt_dir)
+ tst_truncate_fd(mnt_dir)
+ tst_open_unlink(mnt_dir)
+
+ # test_syscalls assumes that changes in source directory
+ # will be reflected immediately in mountpoint, so we
+ # can't use it.
+ if not cache:
+ syscall_test_cmd = [ os.path.join(basename, 'test', 'test_syscalls'),
+ mnt_dir, ':' + src_dir ]
+ subprocess.check_call(syscall_test_cmd)
+ except:
+ cleanup(mount_process, mnt_dir)
+ raise
+ else:
+ umount(mount_process, mnt_dir)
+
+
@pytest.mark.skipif(fuse_proto < (7,11),
reason='not supported by running kernel')
def test_ioctl(tmpdir):
diff --git a/test/test_syscalls.c b/test/test_syscalls.c
index db4be56..a7e2bc7 100644
--- a/test/test_syscalls.c
+++ b/test/test_syscalls.c
@@ -67,6 +67,11 @@ static void test_error(const char *func, const char *msg, ...)
fprintf(stderr, "\n");
}
+static int is_dot_or_dotdot(const char *name) {
+ return name[0] == '.' &&
+ (name[1] == '\0' || (name[1] == '.' && name[2] == '\0'));
+}
+
static void success(void)
{
fprintf(stderr, "%s OK\n", testname);
@@ -381,10 +386,6 @@ static int check_dir_contents(const char *path, const char **contents)
found[i] = 0;
cont[i] = contents[i];
}
- found[i] = 0;
- cont[i++] = ".";
- found[i] = 0;
- cont[i++] = "..";
cont[i] = NULL;
dp = opendir(path);
@@ -405,6 +406,8 @@ static int check_dir_contents(const char *path, const char **contents)
}
break;
}
+ if (is_dot_or_dotdot(de->d_name))
+ continue;
for (i = 0; cont[i] != NULL; i++) {
assert(i < MAX_ENTRIES);
if (strcmp(cont[i], de->d_name) == 0) {
diff --git a/test/travis-build.sh b/test/travis-build.sh
index dc46120..b2f3610 100755
--- a/test/travis-build.sh
+++ b/test/travis-build.sh
@@ -27,12 +27,15 @@ cd "${TEST_DIR}"
# Standard build
for CC in gcc gcc-7 clang; do
mkdir build-${CC}; cd build-${CC}
+ if [ "${CC}" == "clang" ]; then
+ export CXX="clang++"
+ fi
if [ ${CC} == 'gcc-7' ]; then
build_opts='-D b_lundef=false'
else
build_opts=''
fi
- meson -D werror=true ${build_opts} "${SOURCE_DIR}"
+ meson -D werror=true ${build_opts} "${SOURCE_DIR}" || (cat meson-logs/meson-log.txt; false)
ninja
sudo chown root:root util/fusermount3
@@ -44,11 +47,13 @@ done
# Sanitized build
CC=clang
+CXX=clang++
for san in undefined address; do
mkdir build-${san}; cd build-${san}
# b_lundef=false is required to work around clang
# bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
- meson -D b_sanitize=${san} -D b_lundef=false -D werror=true "${SOURCE_DIR}"
+ meson -D b_sanitize=${san} -D b_lundef=false -D werror=true "${SOURCE_DIR}" \
+ || (cat meson-logs/meson-log.txt; false)
ninja
# Test as root and regular user