Index: bin/chio/Makefile =================================================================== --- bin/chio/Makefile +++ bin/chio/Makefile @@ -1,7 +1,12 @@ # $FreeBSD$ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +.include + PACKAGE=runtime PROG= chio +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Index: bin/chio/tests/Makefile =================================================================== --- /dev/null +++ bin/chio/tests/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +ATF_TESTS_SH+= chio_test + +.include Index: bin/chio/tests/chio_test.sh =================================================================== --- /dev/null +++ bin/chio/tests/chio_test.sh @@ -0,0 +1,83 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright 2017 Shivansh Rai +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +atf_test_case invalid_usage +invalid_usage_head() +{ + atf_set "descr" "Verify that an invalid usage with a supported option " \ + "produces a valid error message" +} + +invalid_usage_body() +{ + atf_check -s not-exit:0 -e inline:"chio: option requires an argument -- f +usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio -f + atf_check -s not-exit:0 -e inline:"chio: illegal option -- v +usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio -v + atf_check -s not-exit:0 -e inline:"chio: illegal option -- V +usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio -V + atf_check -s not-exit:0 -e inline:"chio: illegal option -- s +usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio -s + atf_check -s not-exit:0 -e inline:"chio: illegal option -- S +usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio -S + atf_check -s not-exit:0 -e inline:"chio: illegal option -- b +usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio -b + atf_check -s not-exit:0 -e inline:"chio: illegal option -- I +usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio -I + atf_check -s not-exit:0 -e inline:"chio: illegal option -- a +usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio -a +} + +atf_test_case no_arguments +no_arguments_head() +{ + atf_set "descr" "Verify that chio(1) fails and generates a valid usage " \ + "message when no arguments are supplied" +} + +no_arguments_body() +{ + atf_check -s not-exit:0 -e inline:"usage: chio [-f changer] command [-] arg1 arg2 [arg3 [...]] +" chio +} + +atf_init_test_cases() +{ + atf_add_test_case invalid_usage + atf_add_test_case no_arguments +} Index: bin/cp/Makefile =================================================================== --- bin/cp/Makefile +++ bin/cp/Makefile @@ -1,9 +1,14 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= cp SRCS= cp.c utils.c CFLAGS+= -DVM_AND_BUFFER_CACHE_SYNCHRONIZED -D_ACL_PRIVATE +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Index: bin/cp/tests/Makefile =================================================================== --- /dev/null +++ bin/cp/tests/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +ATF_TESTS_SH+= cp_test + +.include Index: bin/cp/tests/cp_test.sh =================================================================== --- /dev/null +++ bin/cp/tests/cp_test.sh @@ -0,0 +1,73 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright 2017 Shivansh Rai +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +usage_output='usage: cp' + +atf_test_case invalid_usage +invalid_usage_head() +{ + atf_set "descr" "Verify that an invalid usage with a supported option " \ + "produces a valid error message" +} + +invalid_usage_body() +{ + atf_check -s not-exit:0 -e match:"$usage_output" cp -H + atf_check -s not-exit:0 -e match:"$usage_output" cp -L + atf_check -s not-exit:0 -e match:"$usage_output" cp -P + atf_check -s not-exit:0 -e match:"$usage_output" cp -R + atf_check -s not-exit:0 -e match:"$usage_output" cp -a + atf_check -s not-exit:0 -e match:"$usage_output" cp -f + atf_check -s not-exit:0 -e match:"$usage_output" cp -i + atf_check -s not-exit:0 -e match:"$usage_output" cp -l + atf_check -s not-exit:0 -e match:"$usage_output" cp -n + atf_check -s not-exit:0 -e match:"$usage_output" cp -p + atf_check -s not-exit:0 -e match:"$usage_output" cp -s + atf_check -s not-exit:0 -e match:"$usage_output" cp -v + atf_check -s not-exit:0 -e match:"$usage_output" cp -x +} + +atf_test_case no_arguments +no_arguments_head() +{ + atf_set "descr" "Verify that cp(1) fails and generates a valid usage " \ + "message when no arguments are supplied" +} + +no_arguments_body() +{ + atf_check -s not-exit:0 -e match:"$usage_output" cp +} + +atf_init_test_cases() +{ + atf_add_test_case invalid_usage + atf_add_test_case no_arguments +} Index: bin/domainname/Makefile =================================================================== --- bin/domainname/Makefile +++ bin/domainname/Makefile @@ -1,6 +1,11 @@ # $FreeBSD$ +.include + PACKAGE=runtime PROG= domainname +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Index: bin/domainname/tests/Makefile =================================================================== --- /dev/null +++ bin/domainname/tests/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +ATF_TESTS_SH+= domainname_test + +.include Index: bin/domainname/tests/domainname_test.sh =================================================================== --- /dev/null +++ bin/domainname/tests/domainname_test.sh @@ -0,0 +1,47 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright 2017 Shivansh Rai +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +atf_test_case no_arguments +no_arguments_head() +{ + atf_set "descr" "Verify that domainname(1) generates a valid output " \ + "when no arguments are supplied" +} + +no_arguments_body() +{ + atf_check -s exit:0 -o inline:" +" domainname +} + +atf_init_test_cases() +{ + atf_add_test_case no_arguments +} Index: bin/rm/Makefile =================================================================== --- bin/rm/Makefile +++ bin/rm/Makefile @@ -1,10 +1,15 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= rm LINKS= ${BINDIR}/rm ${BINDIR}/unlink MLINKS= rm.1 unlink.1 +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Index: bin/rm/tests/Makefile =================================================================== --- /dev/null +++ bin/rm/tests/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +ATF_TESTS_SH+= rm_test + +.include Index: bin/rm/tests/rm_test.sh =================================================================== --- /dev/null +++ bin/rm/tests/rm_test.sh @@ -0,0 +1,70 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright 2017 Shivansh Rai +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +usage_output='usage: rm' + +atf_test_case invalid_usage +invalid_usage_head() +{ + atf_set "descr" "Verify that an invalid usage with a supported option " \ + "produces a valid error message" +} + +invalid_usage_body() +{ + atf_check -s not-exit:0 -e match:"$usage_output" rm -d + atf_check -s exit:0 -e empty rm -f + atf_check -s not-exit:0 -e match:"$usage_output" rm -i + atf_check -s not-exit:0 -e match:"$usage_output" rm -I + atf_check -s not-exit:0 -e match:"$usage_output" rm -P + atf_check -s not-exit:0 -e match:"$usage_output" rm -R + atf_check -s not-exit:0 -e match:"$usage_output" rm -r + atf_check -s not-exit:0 -e match:"$usage_output" rm -v + atf_check -s not-exit:0 -e match:"$usage_output" rm -W + atf_check -s not-exit:0 -e match:"$usage_output" rm -x +} + +atf_test_case no_arguments +no_arguments_head() +{ + atf_set "descr" "Verify that rm(1) fails and generates a valid usage " \ + "message when no arguments are supplied" +} + +no_arguments_body() +{ + atf_check -s not-exit:0 -e match:"$usage_output" rm +} + +atf_init_test_cases() +{ + atf_add_test_case invalid_usage + atf_add_test_case no_arguments +} Index: bin/sync/Makefile =================================================================== --- bin/sync/Makefile +++ bin/sync/Makefile @@ -1,8 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= sync MAN= sync.8 +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Index: bin/sync/tests/Makefile =================================================================== --- /dev/null +++ bin/sync/tests/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +ATF_TESTS_SH+= sync_test + +.include Index: bin/sync/tests/sync_test.sh =================================================================== --- /dev/null +++ bin/sync/tests/sync_test.sh @@ -0,0 +1,45 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright 2017 Shivansh Rai +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +atf_test_case no_arguments +no_arguments_head() +{ + atf_set "descr" "Verify that sync(8) exits silently when no arguments are supplied" +} + +no_arguments_body() +{ + atf_check -s exit:0 -e empty sync +} + +atf_init_test_cases() +{ + atf_add_test_case no_arguments +} Index: etc/mtree/BSD.tests.dist =================================================================== --- etc/mtree/BSD.tests.dist +++ etc/mtree/BSD.tests.dist @@ -10,12 +10,18 @@ .. chflags .. + chio + .. chmod .. + cp + .. date .. dd .. + domainname + .. echo .. expr @@ -34,6 +40,8 @@ .. pwait .. + rm + .. rmdir .. sh @@ -56,6 +64,8 @@ .. sleep .. + sync + .. test .. ..