From a669108f0f2d602bfea9c7a8132fb761388493ad Mon Sep 17 00:00:00 2001 From: LRN Date: Sun, 22 Jul 2012 13:47:09 +0000 Subject: [PATCH] Fix hostkey loading for old testing framework --- src/ats-test/test_transport_ats_1addr.conf | 2 +- src/ats-test/test_transport_ats_2addr.conf | 2 +- src/ats-test/test_transport_ats_4addr.conf | 2 +- src/dht/test_dht_2dtorus.conf | 2 +- src/dht/test_dht_api_data.conf | 2 +- src/dht/test_dht_line.conf | 2 +- src/dht/test_dht_multipeer_data.conf | 2 +- src/dht/test_dht_twopeer_data.conf | 2 +- src/dv/test_transport_dv_data.conf | 2 +- src/fs/test_fs_defaults.conf | 2 +- src/gns/test_gns_defaults.conf | 2 +- src/gns/test_gns_proxy.conf | 2 +- .../test_connection_stability.conf | 2 +- src/mesh/test_mesh_2dtorus.conf | 2 +- src/mesh/test_mesh_small.conf | 2 +- src/nse/test_nse.conf | 2 +- src/stream/test_stream_local.conf | 2 +- src/testing/test_testing_defaults.conf | 2 +- src/testing_old/test_testing_2dtorus.conf | 2 +- src/testing_old/test_testing_defaults.conf | 2 +- src/testing_old/testing_group.c | 19 ++++++++++++++++++- .../test_gnunet_daemon_topology_data.conf | 2 +- 22 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/ats-test/test_transport_ats_1addr.conf b/src/ats-test/test_transport_ats_1addr.conf index ab6e9cb5a..e01f743d2 100644 --- a/src/ats-test/test_transport_ats_1addr.conf +++ b/src/ats-test/test_transport_ats_1addr.conf @@ -4,7 +4,7 @@ SERVICEHOME = /tmp/test-gnunet-testing/ DEFAULTCONFIG = test_testing_data.conf [TESTING] -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [nat] ALLOW_NAT = NO diff --git a/src/ats-test/test_transport_ats_2addr.conf b/src/ats-test/test_transport_ats_2addr.conf index 3b5a6a87a..ce7d104ae 100644 --- a/src/ats-test/test_transport_ats_2addr.conf +++ b/src/ats-test/test_transport_ats_2addr.conf @@ -4,7 +4,7 @@ SERVICEHOME = /tmp/test-gnunet-testing/ DEFAULTCONFIG = test_testing_data.conf [TESTING] -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [transport-udp] PORT = 2571 diff --git a/src/ats-test/test_transport_ats_4addr.conf b/src/ats-test/test_transport_ats_4addr.conf index 830cd8810..cd224e6b0 100644 --- a/src/ats-test/test_transport_ats_4addr.conf +++ b/src/ats-test/test_transport_ats_4addr.conf @@ -4,7 +4,7 @@ SERVICEHOME = /tmp/test-gnunet-testing/ DEFAULTCONFIG = test_testing_data.conf [TESTING] -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [nat] ALLOW_NAT = NO diff --git a/src/dht/test_dht_2dtorus.conf b/src/dht/test_dht_2dtorus.conf index 459ebf376..33d5a3624 100644 --- a/src/dht/test_dht_2dtorus.conf +++ b/src/dht/test_dht_2dtorus.conf @@ -66,7 +66,7 @@ F2F = NO CONNECT_TIMEOUT = 60 s CONNECT_ATTEMPTS = 3 DEBUG = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat MAX_CONCURRENT_SSH = 20 USE_PROGRESSBARS = YES PEERGROUP_TIMEOUT = 2400 s diff --git a/src/dht/test_dht_api_data.conf b/src/dht/test_dht_api_data.conf index 06f9e46ef..e68e887c1 100644 --- a/src/dht/test_dht_api_data.conf +++ b/src/dht/test_dht_api_data.conf @@ -61,7 +61,7 @@ PORT = 2094 WEAKRANDOM = NO [testing_old] -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [gnunetd] HOSTKEY = $SERVICEHOME/.hostkey diff --git a/src/dht/test_dht_line.conf b/src/dht/test_dht_line.conf index 56c03f61a..884341dc7 100644 --- a/src/dht/test_dht_line.conf +++ b/src/dht/test_dht_line.conf @@ -66,7 +66,7 @@ F2F = NO CONNECT_TIMEOUT = 60 s CONNECT_ATTEMPTS = 3 DEBUG = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat MAX_CONCURRENT_SSH = 10 USE_PROGRESSBARS = YES PEERGROUP_TIMEOUT = 2400 s diff --git a/src/dht/test_dht_multipeer_data.conf b/src/dht/test_dht_multipeer_data.conf index eae68f948..790421c69 100644 --- a/src/dht/test_dht_multipeer_data.conf +++ b/src/dht/test_dht_multipeer_data.conf @@ -101,7 +101,7 @@ USE_PROGRESSBARS = YES #LOGNMODIFIER = .65 #PERCENTAGE = .75 NUM_PEERS = 10 -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [gnunetd] HOSTKEY = $SERVICEHOME/.hostkey diff --git a/src/dht/test_dht_twopeer_data.conf b/src/dht/test_dht_twopeer_data.conf index cc47c6f36..8ff702047 100644 --- a/src/dht/test_dht_twopeer_data.conf +++ b/src/dht/test_dht_twopeer_data.conf @@ -48,7 +48,7 @@ WEAKRANDOM = YES [testing_old] NUM_PEERS = 2 -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [gnunetd] HOSTKEY = $SERVICEHOME/.hostkey diff --git a/src/dv/test_transport_dv_data.conf b/src/dv/test_transport_dv_data.conf index 80eb87329..1078c369f 100644 --- a/src/dv/test_transport_dv_data.conf +++ b/src/dv/test_transport_dv_data.conf @@ -54,7 +54,7 @@ CONNECT_TOPOLOGY = LINE BLACKLIST_TOPOLOGY = LINE BLACKLIST_TRANSPORTS = tcp F2F = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [fs] AUTOSTART = NO diff --git a/src/fs/test_fs_defaults.conf b/src/fs/test_fs_defaults.conf index 671a43336..e0e697ec7 100644 --- a/src/fs/test_fs_defaults.conf +++ b/src/fs/test_fs_defaults.conf @@ -61,7 +61,7 @@ DELAY = YES WEAKRANDOM = YES [testing_old] -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [dhtcache] QUOTA=65536 diff --git a/src/gns/test_gns_defaults.conf b/src/gns/test_gns_defaults.conf index 1afd61ed7..f2ce34e2b 100644 --- a/src/gns/test_gns_defaults.conf +++ b/src/gns/test_gns_defaults.conf @@ -29,7 +29,7 @@ PORT = 2570 NUM_PEERS = 5 WEAKRANDOM = YES F2F = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [dht] AUTOSTART = NO diff --git a/src/gns/test_gns_proxy.conf b/src/gns/test_gns_proxy.conf index 9dd4a472b..8083b4ccc 100644 --- a/src/gns/test_gns_proxy.conf +++ b/src/gns/test_gns_proxy.conf @@ -12,7 +12,7 @@ ALLOW_SHUTDOWN = YES [testing] WEAKRANDOM = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [gns] AUTOSTART = YES diff --git a/src/integration-tests/test_connection_stability.conf b/src/integration-tests/test_connection_stability.conf index b3845452a..a0400d819 100644 --- a/src/integration-tests/test_connection_stability.conf +++ b/src/integration-tests/test_connection_stability.conf @@ -32,7 +32,7 @@ WEAKRANDOM = YES [testing_old] NUM_PEERS = 5 F2F = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [dht] AUTOSTART = NO diff --git a/src/mesh/test_mesh_2dtorus.conf b/src/mesh/test_mesh_2dtorus.conf index 5d91a8b43..e247f9f8c 100644 --- a/src/mesh/test_mesh_2dtorus.conf +++ b/src/mesh/test_mesh_2dtorus.conf @@ -77,7 +77,7 @@ F2F = NO CONNECT_TIMEOUT = 600 s CONNECT_ATTEMPTS = 2 DEBUG = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat MAX_CONCURRENT_SSH = 10 USE_PROGRESSBARS = YES PEERGROUP_TIMEOUT = 2400 s diff --git a/src/mesh/test_mesh_small.conf b/src/mesh/test_mesh_small.conf index 179264458..5d49443f0 100644 --- a/src/mesh/test_mesh_small.conf +++ b/src/mesh/test_mesh_small.conf @@ -81,7 +81,7 @@ F2F = NO CONNECT_TIMEOUT = 660 s CONNECT_ATTEMPTS = 2 DEBUG = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat MAX_CONCURRENT_SSH = 10 USE_PROGRESSBARS = YES PEERGROUP_TIMEOUT = 2400 s diff --git a/src/nse/test_nse.conf b/src/nse/test_nse.conf index 4508e9ca7..66075d792 100644 --- a/src/nse/test_nse.conf +++ b/src/nse/test_nse.conf @@ -69,7 +69,7 @@ F2F = NO CONNECT_TIMEOUT = 60 s CONNECT_ATTEMPTS = 3 #DEBUG = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat MAX_CONCURRENT_SSH = 20 USE_PROGRESSBARS = YES PEERGROUP_TIMEOUT = 1000 s diff --git a/src/stream/test_stream_local.conf b/src/stream/test_stream_local.conf index 09929ca27..603a87a1c 100644 --- a/src/stream/test_stream_local.conf +++ b/src/stream/test_stream_local.conf @@ -64,7 +64,7 @@ WEAKRANDOM = YES [testing_old] NUM_PEERS = 5 DEBUG = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat MAX_CONCURRENT_SSH = 10 USE_PROGRESSBARS = YES PEERGROUP_TIMEOUT = 2400 s diff --git a/src/testing/test_testing_defaults.conf b/src/testing/test_testing_defaults.conf index 0705b2d15..80049ba4c 100644 --- a/src/testing/test_testing_defaults.conf +++ b/src/testing/test_testing_defaults.conf @@ -33,7 +33,7 @@ PORT = 2570 NUM_PEERS = 5 WEAKRANDOM = YES F2F = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [dht] AUTOSTART = NO diff --git a/src/testing_old/test_testing_2dtorus.conf b/src/testing_old/test_testing_2dtorus.conf index d69969f1a..69c59567d 100644 --- a/src/testing_old/test_testing_2dtorus.conf +++ b/src/testing_old/test_testing_2dtorus.conf @@ -68,7 +68,7 @@ F2F = NO CONNECT_TIMEOUT = 600 s CONNECT_ATTEMPTS = 2 DEBUG = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat MAX_CONCURRENT_SSH = 10 USE_PROGRESSBARS = YES PEERGROUP_TIMEOUT = 2400 s diff --git a/src/testing_old/test_testing_defaults.conf b/src/testing_old/test_testing_defaults.conf index a89064f81..a28baa7be 100644 --- a/src/testing_old/test_testing_defaults.conf +++ b/src/testing_old/test_testing_defaults.conf @@ -30,7 +30,7 @@ PORT = 2570 NUM_PEERS = 5 WEAKRANDOM = YES F2F = YES -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [dht] AUTOSTART = NO diff --git a/src/testing_old/testing_group.c b/src/testing_old/testing_group.c index 62cc185ce..9191b9fdd 100644 --- a/src/testing_old/testing_group.c +++ b/src/testing_old/testing_group.c @@ -5940,9 +5940,26 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_get_value_string (cfg, "TESTING_OLD", "HOSTKEYSFILE", &hostkeys_file)) { + /* This is a hack to make old testing able to load keys from datadir, + * just as new testing does. + * No need to document it, just convert everything to the new testing + * framework... + */ + char *DATADIR = "${DATADIR}"; + size_t ddl = strlen (DATADIR); + if (strncmp (hostkeys_file, DATADIR, ddl) == 0) + { + char *data_dir; + char *filename; + data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); + GNUNET_asprintf (&filename, "%s%s", data_dir, &hostkeys_file[ddl]); + GNUNET_free (data_dir); + GNUNET_free (hostkeys_file); + hostkeys_file = filename; + } if (GNUNET_YES != GNUNET_DISK_file_test (hostkeys_file)) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("Could not read hostkeys file!\n")); + _("Could not read hostkeys file `%s'!\n"), hostkeys_file); else { /* Check hostkey file size, read entire thing into memory */ diff --git a/src/topology/test_gnunet_daemon_topology_data.conf b/src/topology/test_gnunet_daemon_topology_data.conf index d98dc9de7..c4e01aced 100644 --- a/src/topology/test_gnunet_daemon_topology_data.conf +++ b/src/topology/test_gnunet_daemon_topology_data.conf @@ -53,7 +53,7 @@ AUTOSTART = NO WEAKRANDOM = YES [testing_old] -HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat +HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat [dns] AUTOSTART = NO -- 2.25.1