gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit baea2e9c420475098e64cc199d51564f33b767c7
parent c9562b8cf7a29f4ec2457cb9d9d4530c24225da1
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Tue, 18 Oct 2022 10:05:37 +0900

Merge branch 'dev/willow/gnunet_temp_sh_py'

Diffstat:
Msrc/dht/dhtu_testbed_connect.sh | 8+++++---
Msrc/dht/dhtu_testbed_deploy.conf | 2+-
Msrc/dht/dhtu_testbed_deploy.sh | 11+++++++----
Msrc/dht/test_dht_tools.sh | 5+++--
Msrc/gns/test_dns2gns.conf | 2+-
Msrc/gns/test_gns_lookup.conf | 2+-
Msrc/gns/test_gns_lookup_peer1.conf | 2+-
Msrc/gns/test_gns_lookup_peer2.conf | 2+-
Msrc/gns/test_gns_proxy.conf | 2+-
Msrc/gns/test_proxy.sh | 17++++++++++-------
Msrc/statistics/test_gnunet_statistics.py.in | 13+++++++++++--
Msrc/transport/test_transport_api2_tcp_node1.conf | 6+++---
Msrc/transport/test_transport_api2_tcp_node2.conf | 4++--
Msrc/transport/test_transport_api2_tcp_peer1.conf | 4++--
Msrc/transport/test_transport_api2_tcp_peer2.conf | 4++--
15 files changed, 51 insertions(+), 33 deletions(-)

diff --git a/src/dht/dhtu_testbed_connect.sh b/src/dht/dhtu_testbed_connect.sh @@ -3,17 +3,19 @@ set -eu +GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)" + # Helper script for dhtu_testbed_deploy.sh. # Do not invoke directly. n=$1 -CFG="/tmp/deployment/${n}.conf" +CFG="$GNUNET_TMP/deployment/${n}.conf" HELLO=`gnunet-dht-hello -c $CFG` # Create dense topology: #for OFF in `seq 1 $MAX` #do -# TCFG="/tmp/deployment/${OFF}.conf" +# TCFG="$GNUNET_TMP/deployment/${OFF}.conf" # gnunet-dht-hello -c $TCFG $HELLO #done #exit 0 @@ -26,7 +28,7 @@ do for M in `seq $R $R $END` do OFF=`expr \( $n + $M \) % $MAX` - TCFG="/tmp/deployment/${OFF}.conf" + TCFG="$GNUNET_TMP/deployment/${OFF}.conf" gnunet-dht-hello -c $TCFG $HELLO done R=`expr $R + 1` diff --git a/src/dht/dhtu_testbed_deploy.conf b/src/dht/dhtu_testbed_deploy.conf @@ -4,7 +4,7 @@ # with peers using the IP underlay. [paths] -GNUNET_DATA_HOME=/tmp/%N% +GNUNET_DATA_HOME=$GNUNET_TMP/%N% [dht] UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-dht-%N%.sock diff --git a/src/dht/dhtu_testbed_deploy.sh b/src/dht/dhtu_testbed_deploy.sh @@ -1,6 +1,9 @@ #!/bin/bash # This file is in the public domain. +# Getting location for temporary files +GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)" + # We will use UDP ports above this number. MINPORT=10000 @@ -54,13 +57,13 @@ MAX=`expr $1 - 1` export GNUNET_FORCE_LOG="dht*;;;;DEBUG" echo -n "Starting $1 peers " -mkdir -p /tmp/deployment +mkdir -p "$GNUNET_TMP/deployment" for n in `seq 0 $MAX` do PORT=`expr $MINPORT + $n` - CFG="/tmp/deployment/${n}.conf" + CFG="$GNUNET_TMP/deployment/${n}.conf" cat dhtu_testbed_deploy.conf | sed -e "s/%N%/$PORT/" > $CFG - gnunet-service-dht -c $CFG -L DEBUG &> /tmp/deployment/$n.log & + gnunet-service-dht -c $CFG -L DEBUG &> "$GNUNET_TMP/deployment/$n.log" & echo -n "." done @@ -85,7 +88,7 @@ fi echo "" echo "Network ready. Press ENTER to terminate the testbed!" -echo "Interact with peers using '-c /tmp/deployment/\$N.conf'" +echo "Interact with peers using '-c $GNUNET_TMP/deployment/\$N.conf'" read diff --git a/src/dht/test_dht_tools.sh b/src/dht/test_dht_tools.sh @@ -1,8 +1,9 @@ #!/bin/sh # This file is in the public domain. -out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX` -tempcfg=`mktemp /tmp/test-dht-tools.XXXXXXXX` +GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)" +out=`mktemp $GNUNET_TMP/test-gnunet-dht-logXXXXXXXX` +tempcfg=`mktemp $GNUNET_TMP/test-dht-tools.XXXXXXXX` checkout="check.out" armexe="gnunet-arm -c $tempcfg " putexe="gnunet-dht-put -c $tempcfg " diff --git a/src/gns/test_dns2gns.conf b/src/gns/test_dns2gns.conf @@ -22,7 +22,7 @@ DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 [namestore] IMMEDIATE_START = YES -#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log +#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/ns_log [revocation] WORKBITS = 1 diff --git a/src/gns/test_gns_lookup.conf b/src/gns/test_gns_lookup.conf @@ -20,7 +20,7 @@ ZONE_PUBLISH_TIME_WINDOW = 1 h DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 [namestore] -#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log +#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/ns_log [zonemaster-monitor] IMMEDIATE_START = YES diff --git a/src/gns/test_gns_lookup_peer1.conf b/src/gns/test_gns_lookup_peer1.conf @@ -24,7 +24,7 @@ DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 [namestore] IMMEDIATE_START = YES -#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log +#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/ns_log [revocation] WORKBITS = 1 diff --git a/src/gns/test_gns_lookup_peer2.conf b/src/gns/test_gns_lookup_peer2.conf @@ -29,7 +29,7 @@ DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 [namestore] IMMEDIATE_START = YES -#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log +#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/ns_log [revocation] WORKBITS = 1 diff --git a/src/gns/test_gns_proxy.conf b/src/gns/test_gns_proxy.conf @@ -24,7 +24,7 @@ START_ON_DEMAND = YES [gns-proxy] -PROXY_CACERT = /tmp/proxy_cacert.pem +PROXY_CACERT = $GNUNET_TMP/proxy_cacert.pem PROXY_UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-gns-proxy.sock [namestore] diff --git a/src/gns/test_proxy.sh b/src/gns/test_proxy.sh @@ -1,9 +1,11 @@ #!/bin/bash # This file is in the public domain. TEST_DOMAIN="www.test" +GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)" +PROXY_CACERT="$(gnunet-config -f -c test_gnunet_proxy.conf -s gns-proxy -o PROXY_CACERT)" # Delete old files before starting test -rm -rf /tmp/gnunet/test-gnunet-gns-testing/ +rm -rf "$GNUNET_TMP/test-gnunet-gns-testing/" gnunet-arm -s -c test_gns_proxy.conf gnunet-gns-proxy-setup-ca -c test_gns_proxy.conf @@ -27,8 +29,9 @@ HEXCERT=`xxd -p local.der | tr -d '\n'` #echo "This is the certificate the server does use: $HEXCERT" BOXVALUE="6 8443 52 3 0 0 $HEXCERT" -cat local.crt > /tmp/server_cacert.pem -cat local.key >> /tmp/server_cacert.pem +SERVER_CACERT="$GNUNET_TMP/server_cacert.pem" +cat local.crt > "$SERVER_CACERT" +cat local.key >> "$SERVER_CACERT" gnunet-identity -C test -c test_gns_proxy.conf gnunet-namestore -p -z "test" -a -n www -t A -V 127.0.0.1 -e never -c test_gns_proxy.conf @@ -38,13 +41,13 @@ gnunet-namestore -p -z "test" -a -n www -t BOX -V "$BOXVALUE" -e never -c test_g gnunet-arm -i gns-proxy -c test_gns_proxy.conf -#gnurl --socks5-hostname 127.0.0.1:7777 https://www.test -v --cacert /tmp/proxy_cacert.pem -./test_gns_proxy -A /tmp/proxy_cacert.pem -S /tmp/server_cacert.pem -p 8443 -c test_gns_proxy.conf +#gnurl --socks5-hostname 127.0.0.1:7777 "https://$TEST_DOMAIN" -v --cacert "$PROXY_CACERT" +./test_gns_proxy -A "$PROXY_CACERT" -S "$SERVER_CACERT" -p 8443 -c test_gns_proxy.conf RES=$? -rm /tmp/proxy_cacert.pem -rm /tmp/server_cacert.pem +rm "$PROXY_CACERT" +rm "$SERVER_CACERT" gnunet-arm -e test_gns_proxy.conf diff --git a/src/statistics/test_gnunet_statistics.py.in b/src/statistics/test_gnunet_statistics.py.in @@ -7,6 +7,7 @@ import re import subprocess import time +raw_tmp = True if os.name == "nt": tmp = os.getenv("TEMP") elif None != os.environ.get("TMPDIR"): @@ -14,7 +15,9 @@ elif None != os.environ.get("TMPDIR"): elif None != os.environ.get("TMP"): tmp = os.getenv("TMP") else: - tmp = "/tmp" + raw_tmp = False + tmp = subprocess.check_output("gnunet-config -f -s PATHS -o GNUNET_TMP", + text=True) if os.name == 'nt': st = './gnunet-statistics.exe' @@ -30,8 +33,14 @@ if debug: run_arm += [debug.split(' ')] +if raw_tmp: + cleanup_path = "gnunet/test-gnunet-statistics" +else: + cleanup_path = "test-gnunet-statistics" + + def cleanup(): - shutil.rmtree(os.path.join(tmp, "gnunet/test-gnunet-statistics"), True) + shutil.rmtree(os.path.join(tmp, cleanup_path), True) def sub_run(args, want_stdo=True, want_stde=False, nofail=False): diff --git a/src/transport/test_transport_api2_tcp_node1.conf b/src/transport/test_transport_api2_tcp_node1.conf @@ -5,7 +5,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ [transport] BINARY = gnunet-service-tng PLUGINS = tcp -#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_peer1-%p +#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=$GNUNET_TEST_HOME/vg_peer1-%p UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock [communicator-tcp] @@ -14,11 +14,11 @@ BINDTO = 192.168.15.1:60002 DISABLE_V6 = YES IMMEDIATE_START = YES UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock -#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_ctpeer1-%p +#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=$GNUNET_TEST_HOME/vg_ctpeer1-%p #PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args [communicator-udp] -#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_cupeer1-%p +#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=$GNUNET_TEST_HOME/vg_cupeer1-%p BINARY = gnunet-communicator-udp BINDTO = 192.168.15.1:60002 DISABLE_V6 = YES diff --git a/src/transport/test_transport_api2_tcp_node2.conf b/src/transport/test_transport_api2_tcp_node2.conf @@ -4,7 +4,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ [transport] BINARY = gnunet-service-tng -#PREFIX = valgrind --log-file=/tmp/vg_peer2-%p +#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_peer2-%p UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p2.sock [communicator-tcp] @@ -12,7 +12,7 @@ BINARY = gnunet-communicator-tcp BINDTO = 192.168.15.2:60003 DISABLE_V6 = YES IMMEDIATE_START = YES -#PREFIX = valgrind --log-file=/tmp/vg_comm2-%p +#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_comm2-%p UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p2.sock [peerstore] diff --git a/src/transport/test_transport_api2_tcp_peer1.conf b/src/transport/test_transport_api2_tcp_peer1.conf @@ -5,7 +5,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ [transport] BINARY = gnunet-service-tng PLUGINS = tcp -#PREFIX = valgrind --log-file=/tmp/vg_peer1-%p +#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_peer1-%p UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock [communicator-tcp] @@ -14,7 +14,7 @@ BINDTO = 60002 DISABLE_V6 = YES IMMEDIATE_START = YES UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock -#PREFIX = valgrind --log-file=/tmp/vg_cpeer1-%p +#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_cpeer1-%p [peerstore] IMMEDIATE_START = YES diff --git a/src/transport/test_transport_api2_tcp_peer2.conf b/src/transport/test_transport_api2_tcp_peer2.conf @@ -4,7 +4,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ [transport] BINARY = gnunet-service-tng -#PREFIX = valgrind --log-file=/tmp/vg_peer2-%p +#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_peer2-%p UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p2.sock [communicator-tcp] @@ -12,7 +12,7 @@ BINARY = gnunet-communicator-tcp BINDTO = 60003 DISABLE_V6 = YES IMMEDIATE_START = YES -#PREFIX = valgrind --log-file=/tmp/vg_comm2-%p +#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_comm2-%p UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p2.sock [peerstore]