- 论坛徽章:
- 0
|
我在使用LTP中的perf_lan.sh脚本时,里面有个read_args的命令在系统中死活找不到,也不知道是哪个软件包里的。。。。有哪位可以指点一下么。。。- #! /bin/sh
- unset LIBPATH
- #
- # Copyright (c) International Business Machines Corp., 2000
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- # the GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- #
- #
- #
- # FILE : perf_lan
- #
- # PURPOSE: Generates LAN traffic using ICMP echo packets.
- #
- #
- # SETUP: The home directory of root on the machine exported as "RHOST"
- # MUST have a ".rhosts" file with the hostname of the client
- # machine, where the test is executed.
- #
- # HISTORY:
- # 06/06/03 Manoj Iyer manjo@mail.utexas.edu
- # - Modified testcase to use Test API and fixed bugs.
- # 03/01 Robbie Williamson (robbiew@us.ibm.com)
- # -Ported
- #
- #
- #***********************************************************************
- do_setup()
- {
- RHOST=${RHOST:-`hostname`}
- TCtmp=${TCtmp:-$LTPROOT/testcases/bin/${TC}$}
- PACKETSIZE=${PACKETSIZE:-512}
- NUMPACKETS=${NUMPACKETS:-1}
- NUMLOOPS=${NUMLOOPS:-10}
- PINGPONG="pingpong${EXEC_SUFFIX}"
- tst_setup
- trap interrupt_testcase INT TERM URG USR1
- }
- #-----------------------------------------------------------------------
- #
- # FUNCTION: do_test
- # INPUT: None.
- # OUTPUT: Informational messages are logged into the run log.
- #
- #-----------------------------------------------------------------------
- do_test()
- {
- tst_resm TINFO "Executing $0"
- while [ $TST_COUNT -le $NUMLOOPS ]; do
- $PINGPONG $RHOST $PACKETSIZE $NUMPACKETS
- RETVALUE=$?
- case "$RETVALUE" in
- 0) tst_resm TINFO "Successful execution for loop $TST_COUNT";;
- 1) end_testcase "Error trying to send to host";;
- 2) end_testcase "Error - Data length is too long";;
- 3) end_testcase "Usage error ";;
- 5) end_testcase "Error - Socket setting";;
- 6) end_testcase "Error - Pipe broken";;
- 7) end_testcase "Error - Fork fail";;
- 10) end_testcase "Error - wrong Protocol";;
- *) end_testcase "Unexpected exit code from $PINGPONG: $RETVALUE";;
- esac
- incr_tst_count
- done
- }
- #-----------------------------------------------------------------------
- #
- # FUNCTION: interrupt_testcase
- # PURPOSE: Finish up the testcase - called when the time has expired
- # INPUT: None.
- # OUTPUT: None.
- #
- #-----------------------------------------------------------------------
- interrupt_testcase()
- {
- tst_resm TINFO "Testcase interrupted - cleaning up"
- tst_resm TINFO "Killing background process if it is still running"
- kill -9 $CHILDPID
- end_testcase
- }
- #-----------------------------------------------------------------------
- #
- # FUNCTION: MAIN
- # PURPOSE: To invoke functions that perform the tasks as described in
- # the design in the prolog above.
- # INPUT: See SETUP in the prolog above.
- # OUTPUT: Logged run results written to testcase run log
- #
- #-----------------------------------------------------------------------
- . net_cmdlib.sh
- read_args $*
- do_setup
- do_test
- end_testcase
复制代码 |
|