Skip to content

Commit 8f483c6

Browse files
committed
tests/xbps/xbps-query: add tests for [--long] -f
1 parent 4bc0224 commit 8f483c6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/xbps/xbps-query/list_test.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,43 @@ list_repos_body() {
2626
atf_check_equal "$output" " -1 https://localhost/wtf (RSA maybe-signed)"
2727
}
2828

29+
list_files_head() {
30+
atf_set "descr" "xbps-query(1) [--long] -f"
31+
}
32+
33+
list_files_body() {
34+
mkdir -p some_repo pkg/bin
35+
cd pkg/bin
36+
touch suidfile
37+
chmod 4755 suidfile
38+
touch suidfile_no_x
39+
chmod 4644 suidfile_no_x
40+
touch sgidfile
41+
chmod 2755 sgidfile
42+
touch sgidfile_no_x
43+
chmod 2644 sgidfile_no_x
44+
touch some_exe
45+
chmod 0750 some_exe
46+
touch some_file
47+
chmod 0644 some_file
48+
touch owned_by_nobody
49+
touch owned_by_foo
50+
echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAA" > file_with_size
51+
ln -s foo symlink
52+
cd ../../some_repo
53+
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" \
54+
--chown "/bin/owned_by_nobody:nobody:root /bin/owned_by_foo:foo:foo" ../pkg
55+
atf_check_equal $? 0
56+
xbps-rindex -d -a $PWD/*.xbps
57+
atf_check_equal $? 0
58+
cd ..
59+
output="$(xbps-query -C empty.conf -i --repository=some_repo -f foo | tr -d '\n')"
60+
atf_check_equal "$output" "/bin/file_with_size/bin/owned_by_foo/bin/owned_by_nobody/bin/sgidfile/bin/sgidfile_no_x/bin/some_exe/bin/some_file/bin/suidfile/bin/suidfile_no_x/bin/symlink -> /bin/foo"
61+
output="$(xbps-query -C empty.conf -i --repository=some_repo --long -f foo | tr -d '\n')"
62+
atf_check_equal "$output" "-rw-r--r-- root root 29 B /bin/file_with_size-rw-r--r-- foo foo 0 B /bin/owned_by_foo-rw-r--r-- nobody root 0 B /bin/owned_by_nobody-rwxr-sr-x root root 0 B /bin/sgidfile-rw-r--r-- root root 0 B /bin/sgidfile_no_x-rwxr-x--- root root 0 B /bin/some_exe-rw-r--r-- root root 0 B /bin/some_file-rwsr-xr-x root root 0 B /bin/suidfile-rwSr--r-- root root 0 B /bin/suidfile_no_xl--------- root root 0 B /bin/symlink -> /bin/foo"
63+
}
64+
2965
atf_init_test_cases() {
3066
atf_add_test_case list_repos
67+
atf_add_test_case list_files
3168
}

0 commit comments

Comments
 (0)