183e2bfb6SAlan Somers# 283e2bfb6SAlan Somers# Copyright (c) 2016 Spectra Logic Corp 383e2bfb6SAlan Somers# All rights reserved. 483e2bfb6SAlan Somers# 583e2bfb6SAlan Somers# Redistribution and use in source and binary forms, with or without 683e2bfb6SAlan Somers# modification, are permitted provided that the following conditions 783e2bfb6SAlan Somers# are met: 883e2bfb6SAlan Somers# 1. Redistributions of source code must retain the above copyright 983e2bfb6SAlan Somers# notice, this list of conditions and the following disclaimer. 1083e2bfb6SAlan Somers# 2. Redistributions in binary form must reproduce the above copyright 1183e2bfb6SAlan Somers# notice, this list of conditions and the following disclaimer in the 1283e2bfb6SAlan Somers# documentation and/or other materials provided with the distribution. 1383e2bfb6SAlan Somers# 1483e2bfb6SAlan Somers# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1583e2bfb6SAlan Somers# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1683e2bfb6SAlan Somers# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1783e2bfb6SAlan Somers# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1883e2bfb6SAlan Somers# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1983e2bfb6SAlan Somers# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2083e2bfb6SAlan Somers# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2183e2bfb6SAlan Somers# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2283e2bfb6SAlan Somers# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2383e2bfb6SAlan Somers# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2483e2bfb6SAlan Somers# SUCH DAMAGE. 2583e2bfb6SAlan Somers# 2683e2bfb6SAlan Somers 2783e2bfb6SAlan Somersatf_test_case bad_namespace 2883e2bfb6SAlan Somersbad_namespace_head() { 2983e2bfb6SAlan Somers atf_set "descr" "Can't set attributes for nonexistent namespaces" 3083e2bfb6SAlan Somers} 3183e2bfb6SAlan Somersbad_namespace_body() { 329be960daSAlan Somers check_fs 3383e2bfb6SAlan Somers touch foo 3483e2bfb6SAlan Somers atf_check -s not-exit:0 -e match:"Invalid argument" \ 3583e2bfb6SAlan Somers setextattr badnamespace myattr X foo 3683e2bfb6SAlan Somers atf_check -s not-exit:0 -e match:"Invalid argument" \ 3783e2bfb6SAlan Somers lsextattr -q badnamespace foo 3883e2bfb6SAlan Somers} 3983e2bfb6SAlan Somers 4083e2bfb6SAlan Somersatf_test_case hex 4183e2bfb6SAlan Somershex_head() { 4283e2bfb6SAlan Somers atf_set "descr" "Set and get attribute values in hexadecimal" 4383e2bfb6SAlan Somers} 4483e2bfb6SAlan Somershex_body() { 459be960daSAlan Somers check_fs 4683e2bfb6SAlan Somers touch foo 4779e29f95SAlan Somers atf_check -s exit:0 -o empty setextattr user myattr XYZ foo 4883e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"58 59 5a\n" \ 4979e29f95SAlan Somers getextattr -qx user myattr foo 5079e29f95SAlan Somers} 5179e29f95SAlan Somers 5279e29f95SAlan Somersatf_test_case hex_nonascii 5379e29f95SAlan Somershex_nonascii_head() { 5479e29f95SAlan Somers atf_set "descr" "Get binary attribute values in hexadecimal" 5579e29f95SAlan Somers} 5679e29f95SAlan Somershex_nonascii_body() { 579be960daSAlan Somers check_fs 5879e29f95SAlan Somers touch foo 5979e29f95SAlan Somers BINSTUFF=`echo $'\x20\x30\x40\x55\x66\x70\x81\xa2\xb3\xee\xff'` 6079e29f95SAlan Somers atf_check -s exit:0 -o empty setextattr user myattr "$BINSTUFF" foo 6179e29f95SAlan Somers getextattr user myattr foo 6279e29f95SAlan Somers atf_check -s exit:0 -o inline:"20 30 40 55 66 70 81 a2 b3 ee ff\n" \ 6379e29f95SAlan Somers getextattr -qx user myattr foo 6483e2bfb6SAlan Somers} 6583e2bfb6SAlan Somers 6683e2bfb6SAlan Somersatf_test_case long_name 6783e2bfb6SAlan Somerslong_name_head() { 6883e2bfb6SAlan Somers atf_set "descr" "A maximum length attribute name" 6983e2bfb6SAlan Somers} 7083e2bfb6SAlan Somerslong_name_body() { 719be960daSAlan Somers check_fs 72*ba8c8a0cSEnji Cooper 73*ba8c8a0cSEnji Cooper if ! NAME_MAX=$(getconf NAME_MAX .); then 74*ba8c8a0cSEnji Cooper atf_skip "Filesystem not reporting NAME_MAX; skipping testcase" 75*ba8c8a0cSEnji Cooper fi 76*ba8c8a0cSEnji Cooper 77*ba8c8a0cSEnji Cooper ATTRNAME=`jot -b X -s "" $NAME_MAX 0` 7883e2bfb6SAlan Somers touch foo 7983e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user $ATTRNAME myvalue foo 8083e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"${ATTRNAME}\n" lsextattr -q user foo 8183e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue\n" \ 8283e2bfb6SAlan Somers getextattr -q user ${ATTRNAME} foo 8383e2bfb6SAlan Somers atf_check -s exit:0 -o empty rmextattr user ${ATTRNAME} foo 8483e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q user foo 8583e2bfb6SAlan Somers} 8683e2bfb6SAlan Somers 87c29930cfSAlan Somersatf_test_case loud 88c29930cfSAlan Somersloud_head() { 89c29930cfSAlan Somers atf_set "descr" "Loud (non -q) output for each command" 90c29930cfSAlan Somers} 91c29930cfSAlan Somersloud_body() { 929be960daSAlan Somers check_fs 93c29930cfSAlan Somers touch foo 94c29930cfSAlan Somers # setextattr(8) and friends print hard tabs. Use printf to convert 95c29930cfSAlan Somers # them to spaces before checking the output. 96c29930cfSAlan Somers atf_check -s exit:0 -o empty setextattr user myattr myvalue foo 97c29930cfSAlan Somers atf_check -s exit:0 -o inline:"foo myattr" \ 98c29930cfSAlan Somers printf "%s %s" $(lsextattr user foo) 99c29930cfSAlan Somers atf_check -s exit:0 -o inline:"foo myvalue" \ 100c29930cfSAlan Somers printf "%s %s" $(getextattr user myattr foo) 101c29930cfSAlan Somers atf_check -s exit:0 -o empty rmextattr user myattr foo 102c29930cfSAlan Somers atf_check -s exit:0 -o inline:"foo" printf %s $(lsextattr user foo) 103c29930cfSAlan Somers} 104c29930cfSAlan Somers 10583e2bfb6SAlan Somersatf_test_case noattrs 10683e2bfb6SAlan Somersnoattrs_head() { 10783e2bfb6SAlan Somers atf_set "descr" "A file with no extended attributes" 10883e2bfb6SAlan Somers} 10983e2bfb6SAlan Somersnoattrs_body() { 1109be960daSAlan Somers check_fs 11183e2bfb6SAlan Somers touch foo 11283e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q user foo 11383e2bfb6SAlan Somers} 11483e2bfb6SAlan Somers 11583e2bfb6SAlan Somersatf_test_case nonexistent_file 11683e2bfb6SAlan Somersnonexistent_file_head() { 11783e2bfb6SAlan Somers atf_set "descr" "A file that does not exist" 11883e2bfb6SAlan Somers} 11983e2bfb6SAlan Somersnonexistent_file_body() { 1209be960daSAlan Somers check_fs 12183e2bfb6SAlan Somers atf_check -s exit:1 -e match:"No such file or directory" \ 12283e2bfb6SAlan Somers lsextattr user foo 12383e2bfb6SAlan Somers atf_check -s exit:1 -e match:"No such file or directory" \ 12483e2bfb6SAlan Somers setextattr user myattr myvalue foo 12583e2bfb6SAlan Somers atf_check -s exit:1 -e match:"No such file or directory" \ 12683e2bfb6SAlan Somers getextattr user myattr foo 12783e2bfb6SAlan Somers atf_check -s exit:1 -e match:"No such file or directory" \ 12883e2bfb6SAlan Somers rmextattr user myattr foo 12983e2bfb6SAlan Somers} 13083e2bfb6SAlan Somers 13183e2bfb6SAlan Somersatf_test_case null 13283e2bfb6SAlan Somersnull_head() { 13383e2bfb6SAlan Somers atf_set "descr" "NUL-terminate an attribute value" 13483e2bfb6SAlan Somers} 13583e2bfb6SAlan Somersnull_body() { 1369be960daSAlan Somers check_fs 13783e2bfb6SAlan Somers touch foo 13883e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr -n user myattr myvalue foo 13983e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue\0\n" getextattr -q user myattr foo 14083e2bfb6SAlan Somers} 14183e2bfb6SAlan Somers 14283e2bfb6SAlan Somersatf_test_case one_user_attr 14383e2bfb6SAlan Somersone_user_attr_head() { 14483e2bfb6SAlan Somers atf_set "descr" "A file with one extended attribute" 14583e2bfb6SAlan Somers} 14683e2bfb6SAlan Somersone_user_attr_body() { 1479be960daSAlan Somers check_fs 14883e2bfb6SAlan Somers touch foo 14983e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user myattr myvalue foo 15083e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myattr\n" lsextattr -q user foo 15183e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue\n" getextattr -q user myattr foo 15283e2bfb6SAlan Somers atf_check -s exit:0 -o empty rmextattr user myattr foo 15383e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q user foo 15483e2bfb6SAlan Somers} 15583e2bfb6SAlan Somers 15683e2bfb6SAlan Somersatf_test_case one_system_attr 15783e2bfb6SAlan Somersone_system_attr_head() { 15883e2bfb6SAlan Somers atf_set "descr" "A file with one extended attribute" 15983e2bfb6SAlan Somers atf_set "require.user" "root" 16083e2bfb6SAlan Somers} 16183e2bfb6SAlan Somersone_system_attr_body() { 1629be960daSAlan Somers check_fs 16383e2bfb6SAlan Somers touch foo 16483e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr system myattr myvalue foo 16583e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myattr\n" lsextattr -q system foo 16683e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue\n" getextattr -q system myattr foo 16783e2bfb6SAlan Somers atf_check -s exit:0 -o empty rmextattr system myattr foo 16883e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q system foo 16983e2bfb6SAlan Somers} 17083e2bfb6SAlan Somers 171c29930cfSAlan Somersatf_test_case stdin 172c29930cfSAlan Somersstdin_head() { 173c29930cfSAlan Somers atf_set "descr" "Set attribute value from stdin" 174c29930cfSAlan Somers} 175c29930cfSAlan Somersstdin_body() { 1769be960daSAlan Somers check_fs 177c29930cfSAlan Somers dd if=/dev/random of=infile bs=1k count=8 178c29930cfSAlan Somers touch foo 179c29930cfSAlan Somers setextattr -i user myattr foo < infile || atf_fail "setextattr failed" 180c29930cfSAlan Somers atf_check -s exit:0 -o inline:"myattr\n" lsextattr -q user foo 181c29930cfSAlan Somers getextattr -qq user myattr foo > outfile || atf_fail "getextattr failed" 182c29930cfSAlan Somers atf_check -s exit:0 cmp -s infile outfile 183c29930cfSAlan Somers} 184c29930cfSAlan Somers 18583e2bfb6SAlan Somersatf_test_case stringify 18683e2bfb6SAlan Somersstringify_head() { 18783e2bfb6SAlan Somers atf_set "descr" "Stringify the output of getextattr" 18883e2bfb6SAlan Somers} 18983e2bfb6SAlan Somersstringify_body() { 1909be960daSAlan Somers check_fs 19183e2bfb6SAlan Somers touch foo 19283e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user myattr "my value" foo 19383e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"\"my\\\040value\"\n" \ 19483e2bfb6SAlan Somers getextattr -qs user myattr foo 19583e2bfb6SAlan Somers} 19683e2bfb6SAlan Somers 19783e2bfb6SAlan Somersatf_test_case symlink 19883e2bfb6SAlan Somerssymlink_head() { 19983e2bfb6SAlan Somers atf_set "descr" "A symlink to an ordinary file" 20083e2bfb6SAlan Somers} 20183e2bfb6SAlan Somerssymlink_body() { 2029be960daSAlan Somers check_fs 20383e2bfb6SAlan Somers touch foo 20483e2bfb6SAlan Somers ln -s foo foolink 20583e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user myattr myvalue foolink 20683e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue\n" \ 20783e2bfb6SAlan Somers getextattr -q user myattr foolink 20883e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue\n" getextattr -q user myattr foo 20983e2bfb6SAlan Somers} 21083e2bfb6SAlan Somers 21183e2bfb6SAlan Somersatf_test_case symlink_nofollow 21283e2bfb6SAlan Somerssymlink_nofollow_head() { 21383e2bfb6SAlan Somers atf_set "descr" "Operating directly on a symlink" 21483e2bfb6SAlan Somers} 21583e2bfb6SAlan Somerssymlink_nofollow_body() { 2169be960daSAlan Somers check_fs 21783e2bfb6SAlan Somers touch foo 21883e2bfb6SAlan Somers ln -s foo foolink 21983e2bfb6SAlan Somers # Check that with -h we can operate directly on the link 22083e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr -h user myattr myvalue foolink 22183e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue\n" \ 22283e2bfb6SAlan Somers getextattr -qh user myattr foolink 22383e2bfb6SAlan Somers atf_check -s exit:1 -e match:"Attribute not found" \ 22483e2bfb6SAlan Somers getextattr user myattr foolink 22583e2bfb6SAlan Somers atf_check -s exit:1 -e match:"Attribute not found" \ 22683e2bfb6SAlan Somers getextattr user myattr foo 22783e2bfb6SAlan Somers 22883e2bfb6SAlan Somers # Check that with -h we cannot operate on the destination file 22983e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user otherattr othervalue foo 23083e2bfb6SAlan Somers atf_check -s exit:1 getextattr -qh user otherattr foolink 23183e2bfb6SAlan Somers} 23283e2bfb6SAlan Somers 23383e2bfb6SAlan Somersatf_test_case system_and_user_attrs 23483e2bfb6SAlan Somerssystem_and_user_attrs_head() { 23583e2bfb6SAlan Somers atf_set "descr" "A file with both system and user extended attributes" 23683e2bfb6SAlan Somers atf_set "require.user" "root" 23783e2bfb6SAlan Somers} 23883e2bfb6SAlan Somerssystem_and_user_attrs_body() { 2399be960daSAlan Somers check_fs 24083e2bfb6SAlan Somers touch foo 24183e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user userattr userval foo 24283e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr system sysattr sysval foo 24383e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"userattr\n" lsextattr -q user foo 24483e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"sysattr\n" lsextattr -q system foo 24583e2bfb6SAlan Somers 24683e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"userval\n" getextattr -q user userattr foo 24783e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"sysval\n" getextattr -q system sysattr foo 24883e2bfb6SAlan Somers atf_check -s exit:0 -o empty rmextattr user userattr foo 24983e2bfb6SAlan Somers atf_check -s exit:0 -o empty rmextattr system sysattr foo 25083e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q user foo 25183e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q system foo 25283e2bfb6SAlan Somers} 25383e2bfb6SAlan Somers 25483e2bfb6SAlan Somersatf_test_case two_files 25583e2bfb6SAlan Somerstwo_files_head() { 25683e2bfb6SAlan Somers atf_set "descr" "Manipulate two files" 25783e2bfb6SAlan Somers} 25883e2bfb6SAlan Somerstwo_files_body() { 2599be960daSAlan Somers check_fs 26083e2bfb6SAlan Somers touch foo bar 26183e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user myattr myvalue foo bar 26283e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"foo\tmyattr\nbar\tmyattr\n" \ 26383e2bfb6SAlan Somers lsextattr user foo bar 26483e2bfb6SAlan Somers atf_check -s exit:0 \ 26583e2bfb6SAlan Somers -o inline:"foo\tmyvalue\nbar\tmyvalue\n" \ 26683e2bfb6SAlan Somers getextattr user myattr foo bar 26783e2bfb6SAlan Somers atf_check -s exit:0 -o empty rmextattr user myattr foo bar 26883e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q user foo bar 26983e2bfb6SAlan Somers} 27083e2bfb6SAlan Somers 27183e2bfb6SAlan Somersatf_test_case two_files_force 27283e2bfb6SAlan Somerstwo_files_force_head() { 27383e2bfb6SAlan Somers atf_set "descr" "Manipulate two files. The first does not exist" 27483e2bfb6SAlan Somers} 27583e2bfb6SAlan Somerstwo_files_force_body() { 2769be960daSAlan Somers check_fs 27783e2bfb6SAlan Somers touch bar 27883e2bfb6SAlan Somers atf_check -s exit:1 -e match:"No such file or directory" \ 27983e2bfb6SAlan Somers setextattr user myattr myvalue foo bar 28083e2bfb6SAlan Somers atf_check -s exit:0 -e ignore setextattr -f user myattr myvalue foo bar 28183e2bfb6SAlan Somers atf_check -s exit:1 -e match:"No such file or directory" \ 28283e2bfb6SAlan Somers lsextattr user foo bar 28383e2bfb6SAlan Somers atf_check -s exit:0 -e ignore -o inline:"bar\tmyattr\n" \ 28483e2bfb6SAlan Somers lsextattr -f user foo bar 28583e2bfb6SAlan Somers atf_check -s exit:1 -e match:"No such file or directory" \ 28683e2bfb6SAlan Somers getextattr user myattr foo bar 28783e2bfb6SAlan Somers atf_check -s exit:0 -e ignore \ 28883e2bfb6SAlan Somers -o inline:"bar\tmyvalue\n" \ 28983e2bfb6SAlan Somers getextattr -f user myattr foo bar 29083e2bfb6SAlan Somers atf_check -s exit:1 -e match:"No such file or directory" \ 29183e2bfb6SAlan Somers rmextattr user myattr foo bar 29283e2bfb6SAlan Somers atf_check -s exit:0 -e ignore \ 29383e2bfb6SAlan Somers rmextattr -f user myattr foo bar 29483e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q user bar 29583e2bfb6SAlan Somers} 29683e2bfb6SAlan Somers 29783e2bfb6SAlan Somersatf_test_case two_user_attrs 29883e2bfb6SAlan Somerstwo_user_attrs_head() { 29983e2bfb6SAlan Somers atf_set "descr" "A file with two extended attributes" 30083e2bfb6SAlan Somers} 30183e2bfb6SAlan Somerstwo_user_attrs_body() { 3029be960daSAlan Somers check_fs 30383e2bfb6SAlan Somers touch foo 30483e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user myattr1 myvalue1 foo 30583e2bfb6SAlan Somers atf_check -s exit:0 -o empty setextattr user myattr2 myvalue2 foo 30683e2bfb6SAlan Somers # lsextattr could return the attributes in any order, so we must be 30783e2bfb6SAlan Somers # careful how we compare them. 30883e2bfb6SAlan Somers raw_output=`lsextattr -q user foo` || atf_fail "lsextattr failed" 30983e2bfb6SAlan Somers tabless_output=`printf "%s %s" ${raw_output}` 31083e2bfb6SAlan Somers if [ "myattr1 myattr2" != "${tabless_output}" -a \ 31183e2bfb6SAlan Somers "myattr2 myattr1" != "${tabless_output}" ]; then 31283e2bfb6SAlan Somers atf_fail "lsextattr printed ${tabless_output}" 31383e2bfb6SAlan Somers fi 31483e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue1\n" getextattr -q user myattr1 foo 31583e2bfb6SAlan Somers atf_check -s exit:0 -o inline:"myvalue2\n" getextattr -q user myattr2 foo 31683e2bfb6SAlan Somers atf_check -s exit:0 -o empty rmextattr user myattr2 foo 31783e2bfb6SAlan Somers atf_check -s exit:0 -o empty rmextattr user myattr1 foo 31883e2bfb6SAlan Somers atf_check -s exit:0 -o empty lsextattr -q user foo 31983e2bfb6SAlan Somers} 32083e2bfb6SAlan Somers 32183e2bfb6SAlan Somersatf_test_case unprivileged_user_cannot_set_system_attr 32283e2bfb6SAlan Somersunprivileged_user_cannot_set_system_attr_head() { 32383e2bfb6SAlan Somers atf_set "descr" "Unprivileged users can't set system attributes" 32483e2bfb6SAlan Somers atf_set "require.user" "unprivileged" 32583e2bfb6SAlan Somers} 32683e2bfb6SAlan Somersunprivileged_user_cannot_set_system_attr_body() { 3279be960daSAlan Somers check_fs 32883e2bfb6SAlan Somers touch foo 32983e2bfb6SAlan Somers atf_check -s exit:1 -e match:"Operation not permitted" \ 33083e2bfb6SAlan Somers setextattr system myattr myvalue foo 33183e2bfb6SAlan Somers} 33283e2bfb6SAlan Somers 33383e2bfb6SAlan Somers 33483e2bfb6SAlan Somersatf_init_test_cases() { 33583e2bfb6SAlan Somers atf_add_test_case bad_namespace 33683e2bfb6SAlan Somers atf_add_test_case hex 33779e29f95SAlan Somers atf_add_test_case hex_nonascii 33883e2bfb6SAlan Somers atf_add_test_case long_name 339c29930cfSAlan Somers atf_add_test_case loud 34083e2bfb6SAlan Somers atf_add_test_case noattrs 34183e2bfb6SAlan Somers atf_add_test_case nonexistent_file 34283e2bfb6SAlan Somers atf_add_test_case null 34383e2bfb6SAlan Somers atf_add_test_case symlink_nofollow 34483e2bfb6SAlan Somers atf_add_test_case one_user_attr 34583e2bfb6SAlan Somers atf_add_test_case one_system_attr 346c29930cfSAlan Somers atf_add_test_case stdin 34783e2bfb6SAlan Somers atf_add_test_case stringify 34883e2bfb6SAlan Somers atf_add_test_case symlink 34983e2bfb6SAlan Somers atf_add_test_case symlink_nofollow 35083e2bfb6SAlan Somers atf_add_test_case system_and_user_attrs 35183e2bfb6SAlan Somers atf_add_test_case two_files 35283e2bfb6SAlan Somers atf_add_test_case two_files_force 35383e2bfb6SAlan Somers atf_add_test_case two_user_attrs 35483e2bfb6SAlan Somers atf_add_test_case unprivileged_user_cannot_set_system_attr 35583e2bfb6SAlan Somers} 3569be960daSAlan Somers 3579be960daSAlan Somerscheck_fs() { 3589be960daSAlan Somers case `df -T . | tail -n 1 | cut -wf 2` in 359d68da43bSRuslan Bukin "ufs") 360d68da43bSRuslan Bukin case `dumpfs . | head -1 | awk -F'[()]' '{print $2}'` in 361d68da43bSRuslan Bukin "UFS1") atf_skip "UFS1 is not supported by this test";; 362d68da43bSRuslan Bukin "UFS2") ;; # UFS2 is fine 363d68da43bSRuslan Bukin esac ;; 3649be960daSAlan Somers "zfs") ;; # ZFS is fine 3659be960daSAlan Somers "tmpfs") atf_skip "tmpfs does not support extended attributes";; 3669be960daSAlan Somers esac 3679be960daSAlan Somers} 368