1#!/bin/sh 2# 3# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved. 4# Copyright (c) 2017 Petr Vorel <pvorel@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 23SERVER="" 24CLIENT="" 25CLIENT_EXTRA_OPTS="" 26CLEANER="" 27# Program number to register the services to rpcbind 28PROGNUMNOSVC=536875000 29 30cleanup() 31{ 32 if [ ! -z "$SERVER" ]; then 33 killall -9 $SERVER 34 $CLEANER $PROGNUMNOSVC 35 fi 36} 37 38usage() 39{ 40 cat << EOF 41USAGE: $0 [-s sprog] -c clprog [ -e extra ] 42 43sprog - server program binary 44clprog - client program binary 45extra - extra client options 46 47This scripts connects to the remote host and starts sprog there. After that it 48executes clprog passing it the remote host value. 49 50After the test completes, this script kills sprog on remote and performs a 51cleaning operation. 52EOF 53 54 exit 1 55} 56 57while getopts s:c:e:h arg; do 58 case $arg in 59 s) SERVER="$OPTARG" ;; 60 c) CLIENT="$OPTARG" ;; 61 e) CLIENT_EXTRA_OPTS="$OPTARG" ;; 62 h) usage ;; 63 esac 64done 65shift $(($OPTIND - 1)) 66 67if [ ! -z "$SERVER" ]; then 68 CLEANER="rpc_cleaner" 69 if echo "$SERVER" | grep -q '^tirpc'; then 70 CLEANER="tirpc_cleaner" 71 fi 72fi 73 74if [ -z "$CLIENT" ]; then 75 echo "client program not set" 76 echo "" 77 usage 78fi 79 80TCID="$CLIENT" 81TST_TOTAL=1 82TST_COUNT=1 83TST_CLEANUP=cleanup 84 85TST_USE_LEGACY_API=1 86. tst_net.sh 87 88if [ ! -z "$SERVER" ]; then 89 $SERVER $PROGNUMNOSVC & 90 91 for i in $(seq 1 10); do 92 rpcinfo -p localhost | grep -q $PROGNUMNOSVC && break 93 [ "$i" -eq 30 ] && tst_brkm TBROK "server not registered" 94 tst_sleep 100ms 95 done 96fi 97 98EXPECT_RHOST_PASS $CLIENT $(tst_ipaddr) $PROGNUMNOSVC $CLIENT_EXTRA_OPTS 99 100tst_exit 101