public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH V3 08/14] rpc-tirpc: implemented a wrapper
       [not found] <5358EBCC.4070509@oracle.com>
@ 2014-04-30  7:15 ` Stanislav Kholmanskikh
  2014-04-30 15:45   ` chrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Kholmanskikh @ 2014-04-30  7:15 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Implemented a single wrapper script which can be used
to execute _most_ of the rpc-tirpc test binaries.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
Changes since V2:
* if RHOST is not set, rsh is not used
* added several comments to the script
* renamed SERVERTIMEOUT to SERVER_STARTUP_SLEEP

 testcases/network/rpc/rpc-tirpc/Makefile    |    5 +
 testcases/network/rpc/rpc-tirpc/rpc_test.sh |  119 +++++++++++++++++++++++++++
 2 files changed, 124 insertions(+), 0 deletions(-)
 create mode 100755 testcases/network/rpc/rpc-tirpc/rpc_test.sh

diff --git a/testcases/network/rpc/rpc-tirpc/Makefile b/testcases/network/rpc/rpc-tirpc/Makefile
index 1620b2c..2006616 100644
--- a/testcases/network/rpc/rpc-tirpc/Makefile
+++ b/testcases/network/rpc/rpc-tirpc/Makefile
@@ -19,4 +19,9 @@
 top_srcdir		?= ../../../..
 
 include	$(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= rpc_test.sh
+
+MAKE_TARGETS		:=
+
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/rpc_test.sh b/testcases/network/rpc/rpc-tirpc/rpc_test.sh
new file mode 100755
index 0000000..76627dd
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/rpc_test.sh
@@ -0,0 +1,119 @@
+#!/bin/sh
+#
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+#
+# 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 would 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 the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+# This is a wrapper script to execute tests from the RPC/TI-RPC tests
+# suite (http://nfsv4.bullopensource.org/doc/rpc_testsuite.php) in LTP
+#
+# This wrapper uses the RHOST environment variable:
+#
+# If the RHOST variable is set, then the rpc server instance (if needed)
+# is started on RHOST, using rsh, and the client program is passed
+# the RHOST value.
+#
+# If the RHOST variable is not set, then the rpc server instance (if needed)
+# is started on the local host, and the client program is passed `hostname`.
+
+SERVER_HOST=${RHOST:-`hostname`}
+SERVER=""
+CLIENT=""
+CLIENT_EXTRA_OPTS=""
+CLEANER=""
+# Program number to register the services to rpcbind
+PROGNUMNOSVC=536875000
+SERVER_STARTUP_SLEEP=1
+
+run_cmd()
+{
+	if [ ! -z "$RHOST" ]; then
+		rsh -n "$RHOST" "$1"
+	else
+		$1
+	fi
+}
+
+cleanup()
+{
+	if [ ! -z "$SERVER" ]; then
+		run_cmd "killall -9 $SERVER"
+		run_cmd "$CLEANER $PROGNUMNOSVC"
+	fi
+}
+
+usage()
+{
+	echo "USAGE: $0 [-s sprog] -c clprog [ -e extra ]"
+	echo ""
+	echo "sprog   - server program binary"
+	echo "clprog  - client program binary"
+	echo "extra   - extra client options"
+	echo ""
+	echo "This scripts connects to the RHOST host by rsh and starts"
+	echo "sprog there. After that it executes clprog passing it the"
+	echo "RHOST value."
+	echo "After the test completes, this script kills sprog on RHOST"
+	echo "and performs a cleaning operation."
+	echo ""
+	echo "If RHOST is not set, the local host is used."
+
+	exit 1
+}
+
+while getopts s:c:e:h arg; do
+	case $arg in
+		s) SERVER="$LTPROOT/testcases/bin/$OPTARG" ;;
+		c) CLIENT="$OPTARG" ;;
+		e) CLIENT_EXTRA_OPTS="$OPTARG" ;;
+		h) usage ;;
+	esac
+done
+
+if [ ! -z "$SERVER" ]; then
+	if `echo "$SERVER" | grep -e '^tirpc'`; then
+		CLEANER="$LTPROOT/testcases/bin/tirpc_cleaner"
+	else
+		CLEANER="$LTPROOT/testcases/bin/rpc_cleaner"
+	fi
+fi
+
+if [ -z "$CLIENT" ]; then
+	echo "client program not set"
+	echo ""
+	usage
+fi
+
+TCID="$CLIENT"
+TST_TOTAL=1
+TST_COUNT=1
+. test.sh
+TST_CLEANUP=cleanup
+
+if [ ! -z "$SERVER" ]; then
+	run_cmd "$SERVER $PROGNUMNOSVC" &
+	sleep "$SERVER_STARTUP_SLEEP"
+fi
+
+"$CLIENT" "$SERVER_HOST" "$PROGNUMNOSVC" $CLIENT_EXTRA_OPTS
+ret=$?
+
+if [ "$ret" -eq 0 ]; then
+	tst_resm TPASS "Test passed"
+else
+	tst_resm TFAIL "Test failed"
+fi
+
+tst_exit
-- 
1.7.1


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH V3 08/14] rpc-tirpc: implemented a wrapper
  2014-04-30  7:15 ` [LTP] [PATCH V3 08/14] rpc-tirpc: implemented a wrapper Stanislav Kholmanskikh
@ 2014-04-30 15:45   ` chrubis
  0 siblings, 0 replies; 2+ messages in thread
From: chrubis @ 2014-04-30 15:45 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, ltp-list

Hi!
> Implemented a single wrapper script which can be used
> to execute _most_ of the rpc-tirpc test binaries.

Looks good to me, acked.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-30 15:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5358EBCC.4070509@oracle.com>
2014-04-30  7:15 ` [LTP] [PATCH V3 08/14] rpc-tirpc: implemented a wrapper Stanislav Kholmanskikh
2014-04-30 15:45   ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox