1 #!/bin/sh 2 # 3 # Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved. 4 # Copyright (c) 2017 Petr Vorel <pvorel (at] suse.cz> 5 # 6 # This program is free software; you can redistribute it and/or 7 # modify it under the terms of the GNU General Public License as 8 # published by the Free Software Foundation; either version 2 of 9 # the License, or (at your option) any later version. 10 # 11 # This program is distributed in the hope that it would be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program; if not, write the Free Software Foundation, 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 # 20 # This is a wrapper script to execute tests from the RPC/TI-RPC tests 21 # suite (http://nfsv4.bullopensource.org/doc/rpc_testsuite.php) in LTP. 22 23 SERVER="" 24 CLIENT="" 25 CLIENT_EXTRA_OPTS="" 26 CLEANER="" 27 # Program number to register the services to rpcbind 28 PROGNUMNOSVC=536875000 29 SERVER_STARTUP_SLEEP=1 30 31 cleanup() 32 { 33 if [ ! -z "$SERVER" ]; then 34 killall -9 $SERVER 35 $CLEANER $PROGNUMNOSVC 36 fi 37 } 38 39 usage() 40 { 41 cat << EOF 42 USAGE: $0 [-s sprog] -c clprog [ -e extra ] 43 44 sprog - server program binary 45 clprog - client program binary 46 extra - extra client options 47 48 This scripts connects to the remote host and starts sprog there. After that it 49 executes clprog passing it the remote host value. 50 51 After the test completes, this script kills sprog on remote and performs a 52 cleaning operation. 53 EOF 54 55 exit 1 56 } 57 58 while getopts s:c:e:h arg; do 59 case $arg in 60 s) SERVER="$LTPROOT/testcases/bin/$OPTARG" ;; 61 c) CLIENT="$OPTARG" ;; 62 e) CLIENT_EXTRA_OPTS="$OPTARG" ;; 63 h) usage ;; 64 esac 65 done 66 67 if [ ! -z "$SERVER" ]; then 68 if `echo "$SERVER" | grep -e '^tirpc'`; then 69 CLEANER="$LTPROOT/testcases/bin/tirpc_cleaner" 70 else 71 CLEANER="$LTPROOT/testcases/bin/rpc_cleaner" 72 fi 73 fi 74 75 if [ -z "$CLIENT" ]; then 76 echo "client program not set" 77 echo "" 78 usage 79 fi 80 81 TCID="$CLIENT" 82 TST_TOTAL=1 83 TST_COUNT=1 84 TST_CLEANUP=cleanup 85 86 . test_net.sh 87 88 if [ ! -z "$SERVER" ]; then 89 $SERVER $PROGNUMNOSVC & 90 sleep "$SERVER_STARTUP_SLEEP" 91 fi 92 93 tst_rhost_run -sc "$CLIENT $(tst_ipaddr) $PROGNUMNOSVC $CLIENT_EXTRA_OPTS" 94 95 tst_resm TPASS "Test passed" 96 97 tst_exit 98