libatf-sh.subr (240120) | libatf-sh.subr (273929) |
---|---|
1# 2# Automated Testing Framework (atf) 3# | |
4# Copyright (c) 2007 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# 1. Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 20# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 1# Copyright (c) 2007 The NetBSD Foundation, Inc. 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 18# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 20# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 22# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 24# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28# | |
29 | 25 |
30set -e 31 | |
32# ------------------------------------------------------------------------ 33# GLOBAL VARIABLES 34# ------------------------------------------------------------------------ 35 36# Values for the expect property. 37Expect=pass 38Expect_Reason= 39 --- 45 unchanged lines hidden (view full) --- 85# 86atf_check() 87{ 88 ${Atf_Check} "${@}" || \ 89 atf_fail "atf-check failed; see the output of the test for details" 90} 91 92# | 26# ------------------------------------------------------------------------ 27# GLOBAL VARIABLES 28# ------------------------------------------------------------------------ 29 30# Values for the expect property. 31Expect=pass 32Expect_Reason= 33 --- 45 unchanged lines hidden (view full) --- 79# 80atf_check() 81{ 82 ${Atf_Check} "${@}" || \ 83 atf_fail "atf-check failed; see the output of the test for details" 84} 85 86# |
93# atf_check_equal expr1 expr2 | 87# atf_check_equal expected_expression actual_expression |
94# | 88# |
95# Checks that expr1's value matches expr2's and, if not, raises an 96# error. Ideally expr1 and expr2 should be provided quoted (not 97# expanded) so that the error message is helpful; otherwise it will 98# only show the values, not the expressions themselves. | 89# Checks that expected_expression's value matches actual_expression's 90# and, if not, raises an error. Ideally expected_expression and 91# actual_expression should be provided quoted (not expanded) so that 92# the error message is helpful; otherwise it will only show the values, 93# not the expressions themselves. |
99# 100atf_check_equal() 101{ 102 eval _val1=\"${1}\" 103 eval _val2=\"${2}\" 104 test "${_val1}" = "${_val2}" || \ 105 atf_fail "${1} != ${2} (${_val1} != ${_val2})" 106} --- 483 unchanged lines hidden (view full) --- 590 _tcname=${1} 591 _tcpart=body 592 ;; 593 esac 594 595 _atf_has_tc "${_tcname}" || _atf_syntax_error "Unknown test case \`${1}'" 596 597 if [ "${__RUNNING_INSIDE_ATF_RUN}" != "internal-yes-value" ]; then | 94# 95atf_check_equal() 96{ 97 eval _val1=\"${1}\" 98 eval _val2=\"${2}\" 99 test "${_val1}" = "${_val2}" || \ 100 atf_fail "${1} != ${2} (${_val1} != ${_val2})" 101} --- 483 unchanged lines hidden (view full) --- 585 _tcname=${1} 586 _tcpart=body 587 ;; 588 esac 589 590 _atf_has_tc "${_tcname}" || _atf_syntax_error "Unknown test case \`${1}'" 591 592 if [ "${__RUNNING_INSIDE_ATF_RUN}" != "internal-yes-value" ]; then |
598 _atf_warning "Running test cases without atf-run(1) is unsupported" | 593 _atf_warning "Running test cases outside of kyua(1) is unsupported" |
599 _atf_warning "No isolation nor timeout control is being applied;" \ 600 "you may get unexpected failures; see atf-test-case(4)" 601 fi 602 603 _atf_parse_head ${_tcname} 604 605 case ${_tcpart} in 606 body) --- 129 unchanged lines hidden (view full) --- 736 \?) 737 _atf_syntax_error "Unknown option -${OPTARG}." 738 # NOTREACHED 739 ;; 740 esac 741 done 742 shift `expr ${OPTIND} - 1` 743 | 594 _atf_warning "No isolation nor timeout control is being applied;" \ 595 "you may get unexpected failures; see atf-test-case(4)" 596 fi 597 598 _atf_parse_head ${_tcname} 599 600 case ${_tcpart} in 601 body) --- 129 unchanged lines hidden (view full) --- 731 \?) 732 _atf_syntax_error "Unknown option -${OPTARG}." 733 # NOTREACHED 734 ;; 735 esac 736 done 737 shift `expr ${OPTIND} - 1` 738 |
744 # First of all, make sure that the source directory is correct. It 745 # doesn't matter if the user did not change it, because the default 746 # value may not work. (TODO: It possibly should, even though it is 747 # not a big deal because atf-run deals with this.) | |
748 case ${Source_Dir} in 749 /*) 750 ;; 751 *) 752 Source_Dir=$(pwd)/${Source_Dir} 753 ;; 754 esac 755 [ -f ${Source_Dir}/${Prog_Name} ] || \ --- 24 unchanged lines hidden --- | 739 case ${Source_Dir} in 740 /*) 741 ;; 742 *) 743 Source_Dir=$(pwd)/${Source_Dir} 744 ;; 745 esac 746 [ -f ${Source_Dir}/${Prog_Name} ] || \ --- 24 unchanged lines hidden --- |