Hi!
> +RHOST=${RHOST:-`hostname`}

So the test defaults to local machine if RHOST is not set, but still
needs rsh installed to run the testcases.

Can we do it without the need for rsh in this case?

> +SERVER=""
> +CLIENT=""
> +CLIENT_EXTRA_OPTS=""
> +CLEANER=""
> +PROGNUMNOSVC=536875000

What is this magic constant?

> +SERVERTIMEOUT=1
> +
> +cleanup()
> +{
> +     if [ ! -z "$SERVER" ]; then

if [ -n "$SERVER" ] ?

> +             rsh -n "$RHOST" "killall -9 $SERVER"
> +             rsh -n "$RHOST" "$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

This is a bit hacky, but I cannot think of easy solution.

We can pass the cleaner to this wrapper which would be cleaner solution
but would require changing all the runtest records.

> +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
> +     rsh -n "$RHOST" "$SERVER $PROGNUMNOSVC" &
> +     sleep "$SERVERTIMEOUT"

This is not really timeout, but rather startup sleep.

> +fi
> +
> +"$CLIENT" "$RHOST" "$PROGNUMNOSVC" $CLIENT_EXTRA_OPTS
> +ret=$?
> +
> +if [ "$ret" -eq 0 ]; then
> +     tst_resm TPASS "Test passed"
> +else
> +     tst_resm TFAIL "Test failed"
> +fi
> +
> +tst_exit

-- 
Cyril Hrubis
chru...@suse.cz

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to