diff --git a/tests/golden/projects b/tests/golden/projects new file mode 100644 index 00000000..8876a42b --- /dev/null +++ b/tests/golden/projects @@ -0,0 +1,22 @@ +== default new files don't have project +0 +== set new project on files and dirs +/mnt/test.0/test/projects/file: 1 +/mnt/test.0/test/projects/dir: 1 +== can use interesting IDs +2147483647 +2147483648 +4294967295 +9223372036854775807 +9223372036854775808 +18446744073709551615 +== created files and dirs inherit project id +/mnt/test.0/test/projects/dir/file: 1 +/mnt/test.0/test/projects/dir/sub: 1 +== inheritance continues +1 +== clearing project id stops inheritance +/mnt/test.0/test/projects/dir/another-file: 0 +/mnt/test.0/test/projects/dir/another-sub: 0 +== o_tmpfile creations inherit dir +1 diff --git a/tests/sequence b/tests/sequence index fc656e2c..12709aec 100644 --- a/tests/sequence +++ b/tests/sequence @@ -12,6 +12,7 @@ data-prealloc.sh setattr_more.sh offline-extent-waiting.sh move-blocks.sh +projects.sh large-fragmented-free.sh enospc.sh srch-safe-merge-pos.sh diff --git a/tests/tests/projects.sh b/tests/tests/projects.sh new file mode 100644 index 00000000..c87e4933 --- /dev/null +++ b/tests/tests/projects.sh @@ -0,0 +1,40 @@ + +echo "== default new files don't have project" +touch "$T_D0/file" +scoutfs project-id -g "$T_D0/file" + +echo "== set new project on files and dirs" +mkdir "$T_D0/dir" +scoutfs project-id -s 1 "$T_D0/file" "$T_D0/dir" +scoutfs project-id -g "$T_D0/file" "$T_D0/dir" + +echo "== can use interesting IDs" +touch "$T_D0/ids" +for id in 0x7FFFFFFF 0x80000000 0xFFFFFFFF \ + 0x7FFFFFFFFFFFFFFF 0x8000000000000000 0xFFFFFFFFFFFFFFFF; do + scoutfs project-id -s $id "$T_D0/ids" + scoutfs project-id -g "$T_D0/ids" +done + +echo "== created files and dirs inherit project id" +touch "$T_D0/dir/file" +mkdir "$T_D0/dir/sub" +scoutfs project-id -g "$T_D0/dir/file" "$T_D0/dir/sub" + +echo "== inheritance continues" +mkdir "$T_D0/dir/sub/more" +scoutfs project-id -g "$T_D0/dir/sub/more" + +# .. just inherits 0 :) +echo "== clearing project id stops inheritance" +scoutfs project-id -s 0 "$T_D0/dir" +touch "$T_D0/dir/another-file" +mkdir "$T_D0/dir/another-sub" +scoutfs project-id -g "$T_D0/dir/another-file" "$T_D0/dir/another-sub" + +echo "== o_tmpfile creations inherit dir" +scoutfs project-id -s 1 "$T_D0/dir" +o_tmpfile_linkat "$T_D0/dir" "$T_D0/dir/tmpfile" +scoutfs project-id -g "$T_D0/dir/tmpfile" + +t_pass