1014404dbSAlan Somers# 2014404dbSAlan Somers# Copyright 2017 Shivansh Rai 3014404dbSAlan Somers# All rights reserved. 4014404dbSAlan Somers# 5014404dbSAlan Somers# Redistribution and use in source and binary forms, with or without 6014404dbSAlan Somers# modification, are permitted provided that the following conditions 7014404dbSAlan Somers# are met: 8014404dbSAlan Somers# 1. Redistributions of source code must retain the above copyright 9014404dbSAlan Somers# notice, this list of conditions and the following disclaimer. 10014404dbSAlan Somers# 2. Redistributions in binary form must reproduce the above copyright 11014404dbSAlan Somers# notice, this list of conditions and the following disclaimer in the 12014404dbSAlan Somers# documentation and/or other materials provided with the distribution. 13014404dbSAlan Somers# 14014404dbSAlan Somers# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15014404dbSAlan Somers# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16014404dbSAlan Somers# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17014404dbSAlan Somers# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18014404dbSAlan Somers# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19014404dbSAlan Somers# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20014404dbSAlan Somers# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21014404dbSAlan Somers# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22014404dbSAlan Somers# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23014404dbSAlan Somers# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24014404dbSAlan Somers# SUCH DAMAGE. 25014404dbSAlan Somers# 26014404dbSAlan Somers# 27014404dbSAlan Somers 28014404dbSAlan Somersusage_output='usage: chflags' 29014404dbSAlan Somers 30014404dbSAlan Somersatf_test_case invalid_usage 31014404dbSAlan Somersinvalid_usage_head() 32014404dbSAlan Somers{ 33014404dbSAlan Somers atf_set "descr" "Verify that an invalid usage with a supported option produces a valid error message" 34014404dbSAlan Somers} 35014404dbSAlan Somers 36014404dbSAlan Somersinvalid_usage_body() 37014404dbSAlan Somers{ 38014404dbSAlan Somers atf_check -s not-exit:0 -e match:"$usage_output" chflags -f 39014404dbSAlan Somers atf_check -s not-exit:0 -e match:"$usage_output" chflags -H 40014404dbSAlan Somers atf_check -s not-exit:0 -e match:"$usage_output" chflags -h 41014404dbSAlan Somers atf_check -s not-exit:0 -e match:"$usage_output" chflags -L 42014404dbSAlan Somers atf_check -s not-exit:0 -e match:"$usage_output" chflags -P 43014404dbSAlan Somers atf_check -s not-exit:0 -e match:"$usage_output" chflags -R 44014404dbSAlan Somers atf_check -s not-exit:0 -e match:"$usage_output" chflags -v 45014404dbSAlan Somers} 46014404dbSAlan Somers 47014404dbSAlan Somersatf_test_case no_arguments 48014404dbSAlan Somersno_arguments_head() 49014404dbSAlan Somers{ 50014404dbSAlan Somers atf_set "descr" "Verify that chflags(1) fails and generates a valid usage message when no arguments are supplied" 51014404dbSAlan Somers} 52014404dbSAlan Somers 53014404dbSAlan Somersno_arguments_body() 54014404dbSAlan Somers{ 55014404dbSAlan Somers atf_check -s not-exit:0 -e match:"$usage_output" chflags 56014404dbSAlan Somers} 57014404dbSAlan Somers 58014404dbSAlan Somersatf_init_test_cases() 59014404dbSAlan Somers{ 60014404dbSAlan Somers atf_add_test_case invalid_usage 61014404dbSAlan Somers atf_add_test_case no_arguments 62014404dbSAlan Somers} 63