Imported Upstream version 20080331
[ltp-debian.git] / testcases / network / rpc / rpc-tirpc-full-test-suite / scripts / rpc_stdcall_clnt_call.performance.sh
blob975efdcf021978184c2b932468b630de53ccd812
1 #!/bin/sh
3 # This test is a part of RPC & TI-RPC Test Suite created by Cyril LACABANNE
4 # (c) 2007 BULL S.A.S.
5 # Please refer to RPC & TI-RPC Test Suite documentation.
6 # More details at http://nfsv4.bullopensource.org/doc/rpc_testsuite.php
8 # TEST : RPC stdcall clnt_call performance
9 # creation : 2007-06-28 revision 2007-
11 # **********************
12 # *** INITIALISATION ***
13 # **********************
14 # Parameters such as tests information, threads number...
15 # test information
16 TESTNAME="RPC_std-call_clnt_call.performance"
17 TESTVERS="1.0"
18 # test binaries, used to call
19 TESTCLIENTPATH="rpc_suite/rpc/rpc_stdcall_clnt_call"
20 TESTCLIENTBIN="7-performance.bin"
21 TESTCLIENT=$CLIENTTSTPACKDIR/$TESTCLIENTPATH/$TESTCLIENTBIN
22 # table to save all tests result
23 result=
24 # tmp file declaration to store test returned result
25 TMPRESULTFILE=/tmp/rpcts.tmp
27 # *****************
28 # *** PROCESSUS ***
29 # *****************
31 # erase temp. result file
32 echo -n "">$TMPRESULTFILE
34 # function to collect log result
35 get_test_result()
37 # default : test failed
38 r_value=1
40 # if result table is empty last test crashes (segment fault), so return must be "failed"
41 if [ ${#result[*]} -eq 0 ]
42 then
43 return
46 # if all test instances return same result return the first element, note that test succeeds if value is 0
47 r_value=${result[0]}
50 # function to put test result into logfile
51 result_to_logFile()
53 case $r_value in
54 0)r_valueTxt="PASS";;
55 1)r_valueTxt="FAILED";;
56 2)r_valueTxt="HUNG";;
57 3)r_valueTxt="INTERRUPTED";;
58 4)r_valueTxt="SKIP";;
59 5)r_valueTxt="UNTESTED";;
60 esac
62 echo $TESTCLIENTPATH"/"$( echo $TESTCLIENTBIN | cut -d . -f1 )": execution: "$r_valueTxt>>$LOCLOGDIR/$TESTLOGFILE
63 # print into log file tests perf results
64 echo -n "Average execution time : "${result[1]}" ms (">>$LOCLOGDIR/$TESTLOGFILE
65 echo "for "${result[2]}" iterations)">>$LOCLOGDIR/$TESTLOGFILE
66 echo "Minimal execution time : "${result[3]}" ms">>$LOCLOGDIR/$TESTLOGFILE
67 echo "Maximal execution time : "${result[4]}" ms">>$LOCLOGDIR/$TESTLOGFILE
70 # test needs this server to run
71 serv=$( $REMOTESHELL $SERVERUSER@$SERVERIP "ps -e | grep $TESTSERVER_1_BIN" )
72 if [ -z "$serv" ]
73 then
74 echo " - Skipped..."
75 echo "/!\ Panic : no test server found"
76 echo " $TESTSERVER_1_BIN needed, but not running on server"
77 echo " Test skipped with status 4"
78 r_value=4
79 result_to_logFile
80 echo " * $TESTNAME execution: "$r_valueTxt
81 exit 4
84 # launch client instances depeding on test...
85 $REMOTESHELL $CLIENTUSER@$CLIENTIP "$TESTCLIENT $SERVERIP $PROGNUMBASE $NBPERFTESTITER" >>$TMPRESULTFILE&
87 # wait for the end of all test
88 sleep $GLOBALTIMEOUT
90 # test if all test instances have stopped
91 # if it remains at least one instances, script kills instances and put status HUNG to the whole test case
93 IS_EX=`$REMOTESHELL $CLIENTUSER@$CLIENTIP "ps -e | grep $TESTCLIENTBIN"`
95 if [ "$IS_EX" ]
96 then
97 if [ $VERBOSE -eq 1 ]
98 then
99 echo " - error : prog is still running -> kill"
101 $REMOTESHELL $CLIENTUSER@$CLIENTIP "killall -9 $TESTCLIENTBIN"
102 r_value=2
103 result_to_logFile
104 echo " * $TESTNAME execution: "$r_valueTxt
105 exit 2
108 # ***************
109 # *** RESULTS ***
110 # ***************
112 # if test program correctly run, this part aims to collect all test results and put result into log file
113 result=( $(cat $TMPRESULTFILE) )
114 get_test_result
115 result_to_logFile
116 echo " * $TESTNAME execution: "$r_valueTxt