gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 87/90: -Removed references to explicit /tmp in test scripts and


From: gnunet
Subject: [gnunet] 87/90: -Removed references to explicit /tmp in test scripts and configurations in DHT, GNS, STATISTICS, and TRANSPORT subsystems.
Date: Tue, 18 Oct 2022 03:07:26 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 43b55e25e3824ea3bd9b4e10ee3dd2a5188b7f4c
Author: Willow Liquorice <willow@howhill.com>
AuthorDate: Mon Aug 29 22:01:18 2022 +0100

    -Removed references to explicit /tmp in test scripts and configurations in 
DHT, GNS, STATISTICS, and TRANSPORT subsystems.
---
 src/dht/dhtu_testbed_connect.sh                  |  8 +++++---
 src/dht/dhtu_testbed_deploy.conf                 |  2 +-
 src/dht/dhtu_testbed_deploy.sh                   | 11 +++++++----
 src/dht/test_dht_tools.sh                        |  5 +++--
 src/gns/test_dns2gns.conf                        |  2 +-
 src/gns/test_gns_lookup.conf                     |  2 +-
 src/gns/test_gns_lookup_peer1.conf               |  2 +-
 src/gns/test_gns_lookup_peer2.conf               |  2 +-
 src/gns/test_gns_proxy.conf                      |  2 +-
 src/gns/test_proxy.sh                            | 17 ++++++++++-------
 src/statistics/test_gnunet_statistics.py.in      | 13 +++++++++++--
 src/transport/test_transport_api2_tcp_node1.conf |  6 +++---
 src/transport/test_transport_api2_tcp_node2.conf |  4 ++--
 src/transport/test_transport_api2_tcp_peer1.conf |  4 ++--
 src/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
index daf6f34cf..b0ba474bf 100755
--- 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
index 59d69894a..efabd97d3 100644
--- 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
index 648da7313..e8ac8d5d1 100755
--- 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
index 56cc99e15..462866f87 100755
--- 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
index 3b034f8d5..f484d4114 100644
--- 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
index db0b4bfbe..01f94cf2d 100644
--- 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
 
 [revocation]
 WORKBITS = 2
diff --git a/src/gns/test_gns_lookup_peer1.conf 
b/src/gns/test_gns_lookup_peer1.conf
index 1cf0ba628..69e2f0973 100644
--- 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
index 2e861ff0a..3de81d7f3 100644
--- 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
index 3b21f1d90..db6cb6a4c 100644
--- a/src/gns/test_gns_proxy.conf
+++ b/src/gns/test_gns_proxy.conf
@@ -15,7 +15,7 @@ DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
 
 
 [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
index ee288413f..720fe643d 100755
--- 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
index ce277b13e..ad7e95bd1 100644
--- 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
index b8a743a3b..d396f43d7 100644
--- 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
index f94368b3f..a4557e7ea 100644
--- 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
index 745ed6887..5a21b2adb 100644
--- 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
index 022468bcd..e42704100 100644
--- 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]

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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