aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/test_scalarproduct.sh
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2023-10-19 10:00:01 +0200
committerMartin Schanzenbach <schanzen@gnunet.org>2023-10-19 10:00:01 +0200
commita93ccc1ebb57f50ce6e90c7f0e57a3e58020b05e (patch)
tree8d1db5360aeb85b2c41e507869d1d3383c6999c5 /src/scalarproduct/test_scalarproduct.sh
parent98c00bad3d29a80c514818615c224a29307400cc (diff)
downloadgnunet-a93ccc1ebb57f50ce6e90c7f0e57a3e58020b05e.tar.gz
gnunet-a93ccc1ebb57f50ce6e90c7f0e57a3e58020b05e.zip
BUILD: Move scalarproduct to contrib/service
Diffstat (limited to 'src/scalarproduct/test_scalarproduct.sh')
-rwxr-xr-xsrc/scalarproduct/test_scalarproduct.sh48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/scalarproduct/test_scalarproduct.sh b/src/scalarproduct/test_scalarproduct.sh
deleted file mode 100755
index ed91cd5c4..000000000
--- a/src/scalarproduct/test_scalarproduct.sh
+++ /dev/null
@@ -1,48 +0,0 @@
1#!/bin/bash
2# compute a simple scalar product
3# payload for this test:
4INPUTALICE="-k CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'"
5INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'"
6EXPECTED="0CCC"
7
8# necessary to make the testing prefix deterministic, so we can access the config files
9PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
10
11# where can we find the peers config files?
12CFGALICE="-c $PREFIX/0/config"
13CFGBOB="-c $PREFIX/1/config"
14
15# launch two peers in line topology non-interactively
16#
17# interactive mode would terminate the test immediately
18# because the rest of the script is already in stdin,
19# thus redirecting stdin does not suffice)
20# GNUNET_FORCE_LOG='scalarproduct*;;;;DEBUG'
21GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
22PID=$!
23# sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
24echo "Waiting for peers to start..."
25sleep 5
26echo "Running test..."
27
28which timeout >/dev/null 2>&1 && DO_TIMEOUT="timeout 15"
29
30# get bob's peer ID, necessary for alice
31PEERIDBOB=`${DO_TIMEOUT} gnunet-peerinfo -qs $CFGBOB`
32
33#GNUNET_LOG=';;;;DEBUG'
34${DO_TIMEOUT} gnunet-scalarproduct $CFGBOB $INPUTBOB &
35#GNUNET_LOG=';;;;DEBUG'
36RESULT=`${DO_TIMEOUT} gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
37
38# terminate the testbed
39kill $PID
40
41if [ "$RESULT" = "$EXPECTED" ]
42then
43 echo "OK"
44 exit 0
45else
46 echo "Result $RESULT, expected $EXPECTED - NOTOK"
47 exit 1
48fi