gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r10800 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r10800 - gnunet/src/dht
Date: Mon, 5 Apr 2010 16:47:28 +0200

Author: nevans
Date: 2010-04-05 16:47:28 +0200 (Mon, 05 Apr 2010)
New Revision: 10800

Added:
   gnunet/src/dht/test_dht_tools.sh
Modified:
   gnunet/src/dht/Makefile.am
   gnunet/src/dht/gnunet-dht-get.c
   gnunet/src/dht/gnunet-dht-put.c
Log:
put and get testcase

Modified: gnunet/src/dht/Makefile.am
===================================================================
--- gnunet/src/dht/Makefile.am  2010-04-05 14:13:25 UTC (rev 10799)
+++ gnunet/src/dht/Makefile.am  2010-04-05 14:47:28 UTC (rev 10800)
@@ -49,9 +49,9 @@
   $(top_builddir)/src/util/libgnunetutil.la 
 
 check_PROGRAMS = \
- test_dht_api
+ test_dht_api 
 
-TESTS = $(check_PROGRAMS) # $(check_SCRIPTS)
+TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
 
 test_dht_api_SOURCES = \
  test_dht_api.c
@@ -62,5 +62,5 @@
 EXTRA_DIST = \
   test_dht_api_data.conf 
 
-#check_SCRIPTS = \
-#  test_gnunet_peerinfo.sh
+check_SCRIPTS = \
+  test_dht_tools.sh

Modified: gnunet/src/dht/gnunet-dht-get.c
===================================================================
--- gnunet/src/dht/gnunet-dht-get.c     2010-04-05 14:13:25 UTC (rev 10799)
+++ gnunet/src/dht/gnunet-dht-get.c     2010-04-05 14:47:28 UTC (rev 10800)
@@ -213,10 +213,10 @@
    1, &GNUNET_GETOPT_set_string, &query_key},
   {'t', "type", "TYPE",
    gettext_noop ("the type of data to look for"),
-   0, &GNUNET_GETOPT_set_uint, &query_type},
+   1, &GNUNET_GETOPT_set_uint, &query_type},
   {'T', "timeout", "TIMEOUT",
    gettext_noop ("how long to execute this query before giving up?"),
-   0, &GNUNET_GETOPT_set_ulong, &timeout_request},
+   1, &GNUNET_GETOPT_set_ulong, &timeout_request},
   {'V', "verbose", NULL,
    gettext_noop ("be verbose (print progress information)"),
    0, &GNUNET_GETOPT_set_one, &verbose},

Modified: gnunet/src/dht/gnunet-dht-put.c
===================================================================
--- gnunet/src/dht/gnunet-dht-put.c     2010-04-05 14:13:25 UTC (rev 10799)
+++ gnunet/src/dht/gnunet-dht-put.c     2010-04-05 14:47:28 UTC (rev 10800)
@@ -183,13 +183,13 @@
    1, &GNUNET_GETOPT_set_string, &data},
   {'t', "type", "TYPE",
    gettext_noop ("the type to insert data as"),
-   0, &GNUNET_GETOPT_set_uint, &query_type},
+   1, &GNUNET_GETOPT_set_uint, &query_type},
   {'T', "timeout", "TIMEOUT",
    gettext_noop ("how long to execute this query before giving up?"),
-   0, &GNUNET_GETOPT_set_ulong, &timeout_request},
+   1, &GNUNET_GETOPT_set_ulong, &timeout_request},
   {'e', "expiration", "EXPIRATION",
    gettext_noop ("how long to store this entry in the dht (in seconds)"),
-   0, &GNUNET_GETOPT_set_ulong, &expiration_seconds},
+   1, &GNUNET_GETOPT_set_ulong, &expiration_seconds},
   {'V', "verbose", NULL,
    gettext_noop ("be verbose (print progress information)"),
    0, &GNUNET_GETOPT_set_one, &verbose},

Added: gnunet/src/dht/test_dht_tools.sh
===================================================================
--- gnunet/src/dht/test_dht_tools.sh                            (rev 0)
+++ gnunet/src/dht/test_dht_tools.sh    2010-04-05 14:47:28 UTC (rev 10800)
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+armexe="gnunet-arm -c test_dht_api_peer1.conf "
+putexe="gnunet-dht-put -c test_dht_api_peer1.conf "
+getexe="gnunet-dht-get -c test_dht_api_peer1.conf "
+out=`mktemp /tmp/test-gnunet-arm-logXXXXXXXX`
+checkout="check.out"
+
+stop_arm()
+{
+  if ! $armexe $DEBUG -e > $out ; then
+    echo "FAIL: error running $armexe"
+    echo "Command output was:"
+    cat $out
+    stop_arm
+    exit 1
+  fi
+}
+
+echo -n "TEST: Starting ARM..."
+if ! $armexe $DEBUG -s > $out ; then
+  echo "FAIL: error running $armexe"
+  echo "Command output was:"
+  cat $out
+  stop_arm
+  exit 1
+fi
+echo "PASS"
+sleep 1
+
+echo -n "TEST: Testing put..."
+if ! $putexe -k testkey -d testdata > $out ; then
+  echo "FAIL: error running $putexe"
+  echo "Command output was:"
+  cat $out
+  stop_arm
+  exit 1
+fi
+echo "PASS"
+sleep 1
+
+echo -n "TEST: Testing get..."
+echo "Result 0, type 0:" > $checkout
+echo "testdata" >> $checkout
+
+if ! $getexe -k testkey -T 1 > $out ; then
+  echo "FAIL: error running $putexe"
+  echo "Command output was:"
+  cat $out
+  stop_arm
+  exit 1
+fi
+if ! diff -q $out $checkout ; then
+  echo "FAIL: $out and $checkout differ"
+  stop_arm
+  exit 1
+fi
+echo "PASS"
+
+stop_arm


Property changes on: gnunet/src/dht/test_dht_tools.sh
___________________________________________________________________
Added: svn:executable
   + *





reply via email to

[Prev in Thread] Current Thread [Next in Thread]