From 15a3aa15f50b3c88fcd8b6cc1042ca49dc21bd51 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 4 Oct 2009 12:17:19 +0000 Subject: use arm instead of bash-ish kill --- src/statistics/test_gnunet_statistics.sh | 68 +++++++++++++--------------- src/statistics/test_statistics_api_data.conf | 4 ++ 2 files changed, 36 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/statistics/test_gnunet_statistics.sh b/src/statistics/test_gnunet_statistics.sh index 191b4321b..aacbc75b0 100755 --- a/src/statistics/test_gnunet_statistics.sh +++ b/src/statistics/test_gnunet_statistics.sh @@ -1,13 +1,17 @@ -#!/bin/sh +#!/bin/bash rm -rf /tmp/test-gnunetd-statistics/ exe="./gnunet-statistics -c test_statistics_api_data.conf" base=/tmp/gnunet-test-statistics +arm="gnunet-arm -c test_statistics_api_data.conf $DEBUG" #DEBUG="-L DEBUG" # ----------------------------------- echo -n "Preparing: Starting service..." -./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf & + +$arm -s > /dev/null sleep 1 +$arm -i statistics > /dev/null +sleep 1 echo "DONE" # ---------------------------------------------------------------------------------- @@ -15,7 +19,7 @@ echo -n "TEST: Bad argument checking..." if $exe -x 2> /dev/null; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi echo "PASS" @@ -25,7 +29,7 @@ echo -n "TEST: Set value..." if ! $exe $DEBUG -n test -s subsystem 42 ; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi echo "PASS" @@ -35,7 +39,7 @@ echo -n "TEST: Set another value..." if ! $exe $DEBUG -n other -s osystem 43 ; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi echo "PASS" @@ -45,13 +49,13 @@ echo -n "TEST: viewing all stats..." if ! $exe $DEBUG > $base.out; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi LINES=`cat $base.out | wc -l` if test $LINES -ne 2; then echo "FAIL: unexpected output" - kill %% + $arm -e exit 1 fi echo "PASS" @@ -61,13 +65,13 @@ echo -n "TEST: viewing stats by name..." if ! $exe $DEBUG -n other > $base.out; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi LINES=`cat $base.out | grep 43 | wc -l` if test $LINES -ne 1; then echo "FAIL: unexpected output" - kill %% + $arm -e exit 1 fi echo "PASS" @@ -77,13 +81,13 @@ echo -n "TEST: viewing stats by subsystem..." if ! $exe $DEBUG -s subsystem > $base.out; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi LINES=`cat $base.out | grep 42 | wc -l` if test $LINES -ne 1; then echo "FAIL: unexpected output" - kill %% + $arm -e exit 1 fi echo "PASS" @@ -94,37 +98,31 @@ echo -n "TEST: Set persistent value..." if ! $exe $DEBUG -n lasting -s subsystem 40 -p; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi echo "PASS" # ----------------------------------- echo -n "Restarting service..." +$arm -k statistics > /dev/null sleep 1 -if ! kill %%; -then - echo "FAIL: could not kill service" - kill %% - exit 1 -fi -sleep 1 -./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf & +$arm -i statistics > /dev/null sleep 1 - +echo "DONE" # ---------------------------------------------------------------------------------- echo -n "TEST: checking persistence..." if ! $exe $DEBUG > $base.out; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi LINES=`cat $base.out | grep 40 | wc -l` if test $LINES -ne 1; then echo "FAIL: unexpected output" - kill %% + $arm -e exit 1 fi echo "PASS" @@ -136,7 +134,7 @@ echo -n "TEST: Removing persistence..." if ! $exe $DEBUG -n lasting -s subsystem 40; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi echo "PASS" @@ -144,34 +142,32 @@ echo "PASS" # ----------------------------------- echo -n "Restarting service..." +$arm -k statistics > /dev/null sleep 1 -if ! kill %%; -then - echo "FAIL: could not kill service" - kill %% - exit 1 -fi -sleep 1 -./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf & +$arm -i statistics > /dev/null sleep 1 - +echo "DONE" # ---------------------------------------------------------------------------------- echo -n "TEST: checking removed persistence..." if ! $exe $DEBUG > $base.out; then echo "FAIL: error running $exe" - kill %% + $arm -e exit 1 fi LINES=`cat $base.out | grep 40 | wc -l` if test $LINES -ne 0; then echo "FAIL: unexpected output" - kill %% + $arm -e exit 1 fi echo "PASS" -kill %% +# ----------------------------------- +echo -n "Stopping service..." +$arm -e > /dev/null +sleep 1 +echo "DONE" rm -f $base.out rm -rf /tmp/test-gnunetd-statistics/ diff --git a/src/statistics/test_statistics_api_data.conf b/src/statistics/test_statistics_api_data.conf index 571a9b3e4..da4bed775 100644 --- a/src/statistics/test_statistics_api_data.conf +++ b/src/statistics/test_statistics_api_data.conf @@ -1,5 +1,9 @@ [PATHS] SERVICEHOME = /tmp/test-gnunetd-statistics/ +DEFAULTCONFIG = test_statistics_api_data.conf [statistics] PORT = 22353 + +[arm] +PORT = 22354 -- cgit v1.2.3