aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-30 23:34:06 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-30 23:34:06 +0000
commit5838ccbde451b0fae44079e1f2ead027b1428144 (patch)
treea0da80b456f5712f55736247462a5b87b7b67436 /src
parentb1e42cac7feee71c93d506d8c80f941efbe7b1cb (diff)
minor test cleanup
Diffstat (limited to 'src')
-rw-r--r--src/core/test_core_quota_compliance.c76
1 files changed, 34 insertions, 42 deletions
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index 01eafbfe0e..118347e883 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -20,6 +20,7 @@
/**
* @file core/test_core_quota_compliance.c
* @brief testcase for core_api.c focusing quota compliance on core level
+ * @author Christian Grothoff
*/
#include "platform.h"
#include "gnunet_arm_service.h"
@@ -820,6 +821,30 @@ check ()
}
+static void
+cleanup_directory (int test)
+{
+ switch (test) {
+ case SYMMETRIC:
+ GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
+ GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
+ break;
+ case ASYMMETRIC_SEND_LIMITED:
+ GNUNET_DISK_directory_remove
+ ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
+ GNUNET_DISK_directory_remove
+ ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
+ break;
+ case ASYMMETRIC_RECV_LIMITED:
+ GNUNET_DISK_directory_remove
+ ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
+ GNUNET_DISK_directory_remove
+ ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
+ break;
+ }
+}
+
+
int
main (int argc,
char *argv[])
@@ -827,63 +852,30 @@ main (int argc,
int ret;
test = -1;
- if (strstr (argv[0], "_symmetric") != NULL)
+ if (NULL != strstr (argv[0],
+ "_symmetric"))
{
test = SYMMETRIC;
}
- else if (strstr (argv[0], "_asymmetric_send") != NULL)
+ else if (NULL != strstr (argv[0],
+ "_asymmetric_send"))
{
test = ASYMMETRIC_SEND_LIMITED;
}
- else if (strstr (argv[0], "_asymmetric_recv") != NULL)
+ else if (NULL != strstr (argv[0],
+ "_asymmetric_recv"))
{
test = ASYMMETRIC_RECV_LIMITED;
}
GNUNET_assert (test != -1);
- if (test == SYMMETRIC)
- {
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
- }
- else if (test == ASYMMETRIC_SEND_LIMITED)
- {
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
- }
- else if (test == ASYMMETRIC_RECV_LIMITED)
- {
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
- }
-
+ cleanup_directory (test);
GNUNET_log_setup ("test-core-quota-compliance",
"WARNING",
NULL);
ret = check ();
- if (test == SYMMETRIC)
- {
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
- }
- else if (test == ASYMMETRIC_SEND_LIMITED)
- {
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
- }
- else if (test == ASYMMETRIC_RECV_LIMITED)
- {
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
- }
+ cleanup_directory (test);
return ret;
}
+
/* end of test_core_quota_compliance.c */