diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/readdir_inode.c | 18 | ||||
-rwxr-xr-x | test/test_examples.py | 14 |
2 files changed, 25 insertions, 7 deletions
diff --git a/test/readdir_inode.c b/test/readdir_inode.c index 7f46c0a..99f95ff 100644 --- a/test/readdir_inode.c +++ b/test/readdir_inode.c @@ -1,7 +1,8 @@ /* - * Prints each directory entry and its inode as returned by 'readdir'. + * Prints each directory entry, its inode and d_type as returned by 'readdir'. * Skips '.' and '..' because readdir is not required to return them and - * some of our examples don't. + * some of our examples don't. However if they are returned, their d_type + * should be valid. */ #include <stdio.h> @@ -30,7 +31,18 @@ int main(int argc, char* argv[]) dent = readdir(dirp); while (dent != NULL) { if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0) { - printf("%llu %s\n", (unsigned long long)dent->d_ino, dent->d_name); + printf("%llu %d %s\n", (unsigned long long)dent->d_ino, + (int)dent->d_type, dent->d_name); + if ((long long)dent->d_ino < 0) + fprintf(stderr,"%s : bad d_ino %llu\n", + dent->d_name, (unsigned long long)dent->d_ino); + if ((dent->d_type < 1) || (dent->d_type > 15)) + fprintf(stderr,"%s : bad d_type %d\n", + dent->d_name, (int)dent->d_type); + } else { + if (dent->d_type != DT_DIR) + fprintf(stderr,"%s : bad d_type %d\n", + dent->d_name, (int)dent->d_type); } dent = readdir(dirp); } diff --git a/test/test_examples.py b/test/test_examples.py index aab970f..880fbad 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -109,7 +109,8 @@ def test_hello(tmpdir, name, options, cmdline_builder, output_checker): umount(mount_process, mnt_dir) @pytest.mark.parametrize("writeback", (False, True)) -@pytest.mark.parametrize("name", ('passthrough', 'passthrough_fh', 'passthrough_ll')) +@pytest.mark.parametrize("name", ('passthrough', 'passthrough_plus', + 'passthrough_fh', 'passthrough_ll')) @pytest.mark.parametrize("debug", (False, True)) def test_passthrough(short_tmpdir, name, debug, output_checker, writeback): # Avoid false positives from libfuse debug messages @@ -124,9 +125,14 @@ def test_passthrough(short_tmpdir, name, debug, output_checker, writeback): mnt_dir = str(short_tmpdir.mkdir('mnt')) src_dir = str(short_tmpdir.mkdir('src')) - cmdline = base_cmdline + \ - [ pjoin(basename, 'example', name), - '-f', mnt_dir ] + if name == 'passthrough_plus': + cmdline = base_cmdline + \ + [ pjoin(basename, 'example', 'passthrough'), + '--plus', '-f', mnt_dir ] + else: + cmdline = base_cmdline + \ + [ pjoin(basename, 'example', name), + '-f', mnt_dir ] if debug: cmdline.append('-d') |