mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-27 02:12:53 +00:00
Much more thorough xattr testing
It now tests a lot more combinations of xattrs on files, as well as xattrs and files and errors as the children of directories. The recent code changes have touched the part where directories’ xattrs and children are displayed at the same tree level, and there weren’t enough tests for this.
This commit is contained in:
parent
4c41141cb9
commit
882ac489ce
53
Vagrantfile
vendored
53
Vagrantfile
vendored
@ -324,43 +324,44 @@ Vagrant.configure(2) do |config|
|
||||
|
||||
|
||||
# Awkward extended attribute testcases.
|
||||
# We need to test combinations of various numbers of files *and*
|
||||
# extended attributes in directories. Turns out, the easiest way to
|
||||
# do this is to generate all combinations of files with “one-xattr”
|
||||
# or “two-xattrs” in their name and directories with “empty” or
|
||||
# “one-file” in their name, then just give the right number of
|
||||
# xattrs and children to those.
|
||||
config.vm.provision :shell, privileged: false, inline: <<-EOF
|
||||
set -xe
|
||||
mkdir "#{test_dir}/attributes"
|
||||
|
||||
touch "#{test_dir}/attributes/none"
|
||||
|
||||
touch "#{test_dir}/attributes/one"
|
||||
setfattr -n user.greeting -v hello "#{test_dir}/attributes/one"
|
||||
|
||||
touch "#{test_dir}/attributes/two"
|
||||
setfattr -n user.greeting -v hello "#{test_dir}/attributes/two"
|
||||
setfattr -n user.another_greeting -v hi "#{test_dir}/attributes/two"
|
||||
|
||||
#touch "#{test_dir}/attributes/forbidden"
|
||||
#setfattr -n user.greeting -v hello "#{test_dir}/attributes/forbidden"
|
||||
#chmod +a "$YOU deny readextattr" "#{test_dir}/attributes/forbidden"
|
||||
mkdir "#{test_dir}/attributes/files"
|
||||
touch "#{test_dir}/attributes/files/"{no-xattrs,one-xattr,two-xattrs}{,_forbidden}
|
||||
|
||||
mkdir "#{test_dir}/attributes/dirs"
|
||||
mkdir "#{test_dir}/attributes/dirs/"{no-xattrs,one-xattr,two-xattrs}_{empty,one-file,two-files}{,_forbidden}
|
||||
|
||||
mkdir "#{test_dir}/attributes/dirs/empty-with-attribute"
|
||||
setfattr -n user.greeting -v hello "#{test_dir}/attributes/dirs/empty-with-attribute"
|
||||
setfattr -n user.greeting -v hello "#{test_dir}/attributes"/**/*{one-xattr,two-xattrs}*
|
||||
setfattr -n user.another_greeting -v hi "#{test_dir}/attributes"/**/*two-xattrs*
|
||||
|
||||
mkdir "#{test_dir}/attributes/dirs/full-with-attribute"
|
||||
touch "#{test_dir}/attributes/dirs/full-with-attribute/file"
|
||||
setfattr -n user.greeting -v hello "#{test_dir}/attributes/dirs/full-with-attribute"
|
||||
for dir in "#{test_dir}/attributes/dirs/"*one-file*; do
|
||||
touch $dir/file-in-question
|
||||
done
|
||||
|
||||
mkdir "#{test_dir}/attributes/dirs/full-but-forbidden"
|
||||
touch "#{test_dir}/attributes/dirs/full-but-forbidden/file"
|
||||
#setfattr -n user.greeting -v hello "#{test_dir}/attributes/dirs/full-but-forbidden"
|
||||
#chmod 000 "#{test_dir}/attributes/dirs/full-but-forbidden"
|
||||
#chmod +a "$YOU deny readextattr" "#{test_dir}/attributes/dirs/full-but-forbidden"
|
||||
for dir in "#{test_dir}/attributes/dirs/"*two-files*; do
|
||||
touch $dir/this-file
|
||||
touch $dir/that-file
|
||||
done
|
||||
|
||||
touch -t #{some_date} "#{test_dir}/attributes"
|
||||
touch -t #{some_date} "#{test_dir}/attributes/"*
|
||||
touch -t #{some_date} "#{test_dir}/attributes/dirs/"*
|
||||
touch -t #{some_date} "#{test_dir}/attributes/dirs/"*/*
|
||||
touch -t #{some_date} "#{test_dir}/attributes" # there's probably
|
||||
touch -t #{some_date} "#{test_dir}/attributes"/* # a better
|
||||
touch -t #{some_date} "#{test_dir}/attributes"/*/* # way to
|
||||
touch -t #{some_date} "#{test_dir}/attributes"/*/*/* # do this
|
||||
|
||||
# I want to use the following to test,
|
||||
# but it only works on macos:
|
||||
#chmod +a "#{user} deny readextattr" "#{test_dir}/attributes"/**/*_forbidden
|
||||
|
||||
sudo chmod 000 "#{test_dir}/attributes"/**/*_forbidden
|
||||
sudo chown #{user}:#{user} -R "#{test_dir}/attributes"
|
||||
EOF
|
||||
|
||||
|
@ -1,15 +1,48 @@
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/[1;34mattributes[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m├──[0m [1;34mdirs[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m@ [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mempty-with-attribute[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mno-xattrs_empty[0m
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mno-xattrs_empty_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mno-xattrs_one-file[0m
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ └──[0m file-in-question
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mno-xattrs_one-file_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mno-xattrs_two-files[0m
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ ├──[0m that-file
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ └──[0m this-file
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mno-xattrs_two-files_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m@ [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mone-xattr_empty[0m
|
||||
[38;5;244m│ │ └──[0m user.greeting (len 5)
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mfull-but-forbidden[0m
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ └──[0m file
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m@ [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ └──[0m [1;34mfull-with-attribute[0m
|
||||
[38;5;244m│ ├──[0m user.greeting (len 5)
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ └──[0m file
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m├──[0m none
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m@ [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m├──[0m one
|
||||
[38;5;244m│ └──[0m user.greeting (len 5)
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m@ [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m└──[0m two
|
||||
[38;5;244m ├──[0m user.greeting (len 5)
|
||||
[38;5;244m └──[0m user.another_greeting (len 2)
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mone-xattr_empty_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m@ [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mone-xattr_one-file[0m
|
||||
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ └──[0m file-in-question
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mone-xattr_one-file_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m@ [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mone-xattr_two-files[0m
|
||||
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ ├──[0m that-file
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ └──[0m this-file
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mone-xattr_two-files_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m@ [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mtwo-xattrs_empty[0m
|
||||
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||
[38;5;244m│ │ └──[0m user.another_greeting (len 2)
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mtwo-xattrs_empty_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m@ [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mtwo-xattrs_one-file[0m
|
||||
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||
[38;5;244m│ │ ├──[0m user.another_greeting (len 2)
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ └──[0m file-in-question
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mtwo-xattrs_one-file_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m@ [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ ├──[0m [1;34mtwo-xattrs_two-files[0m
|
||||
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||
[38;5;244m│ │ ├──[0m user.another_greeting (len 2)
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ ├──[0m that-file
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ │ └──[0m this-file
|
||||
[1;34md[0m[38;5;244m---------[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m│ └──[0m [1;34mtwo-xattrs_two-files_forbidden[0m
|
||||
[1;34md[33mr[31mw[32mx[0m[33mr[31mw[32mx[33mr[38;5;244m-[32mx[0m [38;5;244m-[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m└──[0m [1;34mfiles[0m
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m ├──[0m no-xattrs
|
||||
.[38;5;244m---------[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m ├──[0m no-xattrs_forbidden
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m@ [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m ├──[0m one-xattr
|
||||
[38;5;244m │ └──[0m user.greeting (len 5)
|
||||
.[38;5;244m---------[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m ├──[0m one-xattr_forbidden
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[31mw[38;5;244m-[33mr[38;5;244m--[0m@ [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m ├──[0m two-xattrs
|
||||
[38;5;244m │ ├──[0m user.greeting (len 5)
|
||||
[38;5;244m │ └──[0m user.another_greeting (len 2)
|
||||
.[38;5;244m---------[0m [1;32m0[0m cassowary [34m 1 Jan 12:34[0m [38;5;244m └──[0m two-xattrs_forbidden
|
||||
|
@ -27,7 +27,7 @@ $exa $testcases/files -l | diff -q - $results/files_l || exit 1
|
||||
$exa $testcases/files -lh | diff -q - $results/files_lh || exit 1
|
||||
$exa $testcases/files -lhb | diff -q - $results/files_lhb || exit 1
|
||||
$exa $testcases/files -lhB | diff -q - $results/files_lhb2 || exit 1
|
||||
$exa $testcases/attributes/dirs/empty-with-attribute -lh | diff -q - $results/empty || exit 1
|
||||
$exa $testcases/attributes/dirs/no-xattrs_empty -lh | diff -q - $results/empty || exit 1
|
||||
|
||||
$exa --color-scale $testcases/files -l | diff -q - $results/files_l_scale || exit 1
|
||||
|
||||
@ -57,6 +57,7 @@ COLUMNS=200 $exa $testcases/files/* -lG | diff -q - $results/files_star_lG_200
|
||||
|
||||
|
||||
# Attributes
|
||||
# (there are many tests, but they're all done in one go)
|
||||
$exa $testcases/attributes -l@T | diff -q - $results/attributes || exit 1
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user