use arm instead of bash-ish kill
authorChristian Grothoff <christian@grothoff.org>
Sun, 4 Oct 2009 12:17:19 +0000 (12:17 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 4 Oct 2009 12:17:19 +0000 (12:17 +0000)
src/statistics/test_gnunet_statistics.sh
src/statistics/test_statistics_api_data.conf

index 191b4321b1184376faa14b4b03ecc0685a192070..aacbc75b0c9c3338c85ab8ad1a2c8390c6dc7b28 100755 (executable)
@@ -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/
index 571a9b3e4d33c610dd9f90067c5b5e086e85c5dd..da4bed7754d50ef479808c9925a8564782a29e30 100644 (file)
@@ -1,5 +1,9 @@
 [PATHS]
 SERVICEHOME = /tmp/test-gnunetd-statistics/
+DEFAULTCONFIG = test_statistics_api_data.conf
 
 [statistics]
 PORT = 22353
+
+[arm]
+PORT = 22354