gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30345 - gnunet/src/scalarproduct


From: gnunet
Subject: [GNUnet-SVN] r30345 - gnunet/src/scalarproduct
Date: Sat, 19 Oct 2013 01:13:19 +0200

Author: cfuchs
Date: 2013-10-19 01:13:19 +0200 (Sat, 19 Oct 2013)
New Revision: 30345

Removed:
   gnunet/src/scalarproduct/scalarproduct_testing.h
Modified:
   gnunet/src/scalarproduct/Makefile.am
   gnunet/src/scalarproduct/test_scalarproduct.sh
   gnunet/src/scalarproduct/test_scalarproduct_negative.sh
   gnunet/src/scalarproduct/test_scalarproduct_negativezero.sh
Log:
removed final non functional dead leftover code from gaurav... may that code be 
forgotten
testcases now do better logging together with make check
made testcases a bit more tolerat for really slow systems (5 seconds should 
suffice even on older systems)
activated new checks in Makefile



Modified: gnunet/src/scalarproduct/Makefile.am
===================================================================
--- gnunet/src/scalarproduct/Makefile.am        2013-10-18 20:26:25 UTC (rev 
30344)
+++ gnunet/src/scalarproduct/Makefile.am        2013-10-18 23:13:19 UTC (rev 
30345)
@@ -53,46 +53,15 @@
 libgnunetscalarproduct_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
 
-#check_PROGRAMS = \
-#      test_scalarproduct_api_regression \
-#      test_scalarproduct_api \
-#      test_scalarproduct_api_4peers
-#FIXME unfinished
-#test_scalarproduct_api_regression2 
+EXTRA_DIST = \
+  test_scalarproduct.conf \
+  $(check_SCRIPTS)
 
+check_SCRIPTS = \
+  test_scalarproduct.sh \
+  test_scalarproduct_negative.sh \
+  test_scalarproduct_negativezero.sh
+  
 if ENABLE_TEST_RUN
-  TESTS = $(check_PROGRAMS)
+  TESTS = $(check_SCRIPTS)
 endif
-
-test_scalarproduct_api_SOURCES = \
-  test_scalarproduct_api.c
-test_scalarproduct_api_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/scalarproduct/libgnunetscalarproduct.la \
-  -lgcrypt
-
-#FIXME unfinished
-#test_scalarproduct_api_regression2_SOURCES = \
-#      test_scalarproduct_api_regression2.c
-#test_scalarproduct_api_regression2_LDADD = \
-#  $(top_builddir)/src/scalarproduct/libgnunetscalarproduct.la \
-#  $(top_builddir)/src/util/libgnunetutil.la \
-#  -lgcrypt
-
-test_scalarproduct_api_regression_SOURCES = \
-        test_scalarproduct_api_regression.c
-test_scalarproduct_api_regression_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/scalarproduct/libgnunetscalarproduct.la \
-  -lgcrypt
-
-test_scalarproduct_api_4peers_SOURCES = \
- test_scalarproduct_api_4peers.c
-test_scalarproduct_api_4peers_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/scalarproduct/libgnunetscalarproduct.la \
-  -lgcrypt
-
-EXTRA_DIST = \
-  test_scalarproduct.conf
-

Deleted: gnunet/src/scalarproduct/scalarproduct_testing.h
===================================================================
--- gnunet/src/scalarproduct/scalarproduct_testing.h    2013-10-18 20:26:25 UTC 
(rev 30344)
+++ gnunet/src/scalarproduct/scalarproduct_testing.h    2013-10-18 23:13:19 UTC 
(rev 30345)
@@ -1,150 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2013 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
- */
-/**
- * @file scalarproduct/scalarproduct_testing.h
- * @brief VectorProduct testcase common declarations
- * @author Gaurav Kukreja
- * @author Christian Fuchs
- *
- * Created on June 29, 2013, 7:39 PM
- */
-
-#ifndef SCALARPRODUCT_TESTING_H
-#define        SCALARPRODUCT_TESTING_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct GNUNET_SCALARPRODUCT_TESTING_handle
-{
-  /**
-   * Testing library system handle
-   */
-  struct GNUNET_TESTING_System *tl_system;
-
-  /**
-   * head DLL of peers
-   */
-  struct PeerContext *p_head;
-
-  /**
-   * tail DLL of peers
-   */
-  struct PeerContext *p_tail;
-};
-
-struct PeerContext
-{
-  /**
-   * Next element in the DLL
-   */
-  struct PeerContext *next;
-
-  /**
-   * Previous element in the DLL
-   */
-  struct PeerContext *prev;
-
-  /**
-   * Peer's testing handle
-   */
-  struct GNUNET_TESTING_Peer *peer;
-
-  /**
-   * Peer identity
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Handle for the peer's ARM process
-   */
-  struct GNUNET_OS_Process *arm_proc;
-
-  /**
-   * Pointer to Vector Product Handle
-   */
-  struct GNUNET_SCALARPRODUCT_Handle *vh;
-
-  /**
-   * Closure for the callbacks
-   */
-  void *cb_cls;
-
-  /**
-   * An unique number to identify the peer
-   */
-  unsigned int no;
-
-  /**
-   * Peer's configuration
-   */
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Pointer to the master testing handle
-   */
-  struct GNUNET_SCALARPRODUCT_TESTING_handle * vth;
-
-  /**
-    * Callback when two peers are connected and both have called the connect 
callback
-    * to notify clients about a new peer
-    */
-   void (*start_cb) (struct PeerContext * p, void *cls);
-
-//  /**
-//   * Pointer to function where the test occurs
-//   */
-//  GNUNET_SCALARPRODUCT_TESTING_start_cb start_cb;
-};
-
-/**
- * Callback when two peers are connected and both have called the connect 
callback
- * to notify clients about a new peer
- */
-typedef void (*GNUNET_SCALARPRODUCT_TESTING_start_cb) (struct PeerContext * p,
-                                                   void *cls);
-
-struct GNUNET_SCALARPRODUCT_TESTING_handle *
-GNUNET_SCALARPRODUCT_TESTING_init();
-
-static void
-GNUNET_SCALARPRODUCT_TESTING_done(struct GNUNET_SCALARPRODUCT_TESTING_handle * 
vth);
-
-struct PeerContext *
-GNUNET_SCALARPRODUCT_TESTING_start_peer (struct 
GNUNET_SCALARPRODUCT_TESTING_handle * vth,
-                                     const char *cfgname, int peer_id,
-                                     GNUNET_SCALARPRODUCT_TESTING_start_cb 
start_cb,
-                                     void *cb_cls);
-
-static void
-GNUNET_SCALARPRODUCT_TESTING_stop_peer
-        (struct GNUNET_SCALARPRODUCT_TESTING_handle * vth,
-        struct PeerContext *p);
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SCALARPRODUCT_TESTING_H */
-

Modified: gnunet/src/scalarproduct/test_scalarproduct.sh
===================================================================
--- gnunet/src/scalarproduct/test_scalarproduct.sh      2013-10-18 20:26:25 UTC 
(rev 30344)
+++ gnunet/src/scalarproduct/test_scalarproduct.sh      2013-10-18 23:13:19 UTC 
(rev 30345)
@@ -16,34 +16,27 @@
 # interactive mode would terminate the test immediately 
 # because the rest of the script is already in stdin, 
 # thus redirecting stdin does not suffice)
-GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX 
../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 
2>service.log &
+GNUNET_LOG=';;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX 
../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
 PID=$!
+# sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
 sleep 5
 
 # get bob's peer ID, necessary for alice
 PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
 
-GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 
2>bob.log &
-RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE 
$INPUTALICE -p $PEERIDBOB 2>alice.log`
+GNUNET_LOG=';;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB &
+RESULT=`GNUNET_LOG=';;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p 
$PEERIDBOB`
 
-cat alice.log bob.log service.log >> test_scalarproduct.log
-rm -f alice.log bob.log service.log
-ISSUES=$((`grep scalarproduct test_scalarproduct.log | grep -c ERROR` + `grep 
scalarproduct test_scalarproduct.log | grep -c WARNING`))
-
 # terminate the testbed
 kill $PID 
 
 EXPECTED="0CCC"
-if [ "$ISSUES" -eq "0" ]
+if [ "$RESULT" == "$EXPECTED" ]
 then
-       if [ "$RESULT" == "$EXPECTED" ]
-       then
-         echo "OK"
-          rm -f test_scalarproduct.log
-         exit 0
-       fi
+       echo "OK"
+       exit 0
 else
-  echo "Result $RESULT NOTOK, see $PWD/test_scalarproduct.log for details"
-  exit 1
+       echo "Result $RESULT NOTOK"
+       exit 1
 fi
 

Modified: gnunet/src/scalarproduct/test_scalarproduct_negative.sh
===================================================================
--- gnunet/src/scalarproduct/test_scalarproduct_negative.sh     2013-10-18 
20:26:25 UTC (rev 30344)
+++ gnunet/src/scalarproduct/test_scalarproduct_negative.sh     2013-10-18 
23:13:19 UTC (rev 30345)
@@ -16,34 +16,26 @@
 # interactive mode would terminate the test immediately 
 # because the rest of the script is already in stdin, 
 # thus redirecting stdin does not suffice)
-GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX 
../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 
2>service.log &
+GNUNET_LOG=';;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX 
../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
 PID=$!
+# sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
 sleep 5
 
 # get bob's peer ID, necessary for alice
 PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
 
-GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 
2>bob.log &
-RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE 
$INPUTALICE -p $PEERIDBOB 2>alice.log`
+GNUNET_LOG=';;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB &
+RESULT=`GNUNET_LOG=';;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p 
$PEERIDBOB`
 
-cat alice.log bob.log service.log >> test_scalarproduct.log
-rm -f alice.log bob.log service.log
-ISSUES=$((`grep scalarproduct test_scalarproduct.log | grep -c ERROR` + `grep 
scalarproduct test_scalarproduct.log | grep -c WARNING`))
-
 # terminate the testbed
 kill $PID 
 
 EXPECTED="-0CCC"
-if [ "$ISSUES" -eq "0" ]
+if [ "$RESULT" == "$EXPECTED" ]
 then
-       if [ "$RESULT" == "$EXPECTED" ]
-       then
-         echo "OK"
-          rm -f test_scalarproduct.log
-         exit 0
-       fi
+       echo "OK"
+        exit 0
 else
-  echo "Result $RESULT NOTOK, see $PWD/test_scalarproduct.log for details"
-  exit 1
+       echo "Result $RESULT NOTOK"
+        exit 1
 fi
-

Modified: gnunet/src/scalarproduct/test_scalarproduct_negativezero.sh
===================================================================
--- gnunet/src/scalarproduct/test_scalarproduct_negativezero.sh 2013-10-18 
20:26:25 UTC (rev 30344)
+++ gnunet/src/scalarproduct/test_scalarproduct_negativezero.sh 2013-10-18 
23:13:19 UTC (rev 30345)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # compute a simple scalar product
 # payload for this test:
-INPUTALICE="-k CCC -e -1,1,-1"
+INPUTALICE="-k CCC -e -1,1,1"
 INPUTBOB="-k CCC -e 1,1,0"
 
 # necessary to make the testing prefix deterministic, so we can access the 
config files
@@ -16,34 +16,26 @@
 # interactive mode would terminate the test immediately 
 # because the rest of the script is already in stdin, 
 # thus redirecting stdin does not suffice)
-GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX 
../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 
2>service.log &
+GNUNET_LOG=';;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX 
../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
 PID=$!
+# sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
 sleep 5
 
 # get bob's peer ID, necessary for alice
 PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
 
-GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 
2>bob.log &
-RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE 
$INPUTALICE -p $PEERIDBOB 2>alice.log`
+GNUNET_LOG=';;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB &
+RESULT=`GNUNET_LOG=';;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p 
$PEERIDBOB`
 
-cat alice.log bob.log service.log >> test_scalarproduct.log
-rm -f alice.log bob.log service.log
-ISSUES=$((`grep scalarproduct test_scalarproduct.log | grep -c ERROR` + `grep 
scalarproduct test_scalarproduct.log | grep -c WARNING`))
-
 # terminate the testbed
 kill $PID 
 
 EXPECTED="00"
-if [ "$ISSUES" -eq "0" ]
+if [ "$RESULT" == "$EXPECTED" ]
 then
-       if [ "$RESULT" == "$EXPECTED" ]
-       then
-         echo "OK"
-          rm -f test_scalarproduct.log
-         exit 0
-       fi
+       echo "OK"
+        exit 0
 else
-  echo "Result $RESULT NOTOK, see $PWD/test_scalarproduct.log for details"
-  exit 1
+       echo "Result $RESULT NOTOK"
+        exit 1
 fi
-




reply via email to

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