diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-30 23:34:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-30 23:34:06 +0000 |
commit | 5838ccbde451b0fae44079e1f2ead027b1428144 (patch) | |
tree | a0da80b456f5712f55736247462a5b87b7b67436 /src/core | |
parent | b1e42cac7feee71c93d506d8c80f941efbe7b1cb (diff) | |
download | gnunet-5838ccbde451b0fae44079e1f2ead027b1428144.tar.gz gnunet-5838ccbde451b0fae44079e1f2ead027b1428144.zip |
minor test cleanup
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/test_core_quota_compliance.c | 76 |
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 01eafbfe0..118347e88 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -20,6 +20,7 @@ | |||
20 | /** | 20 | /** |
21 | * @file core/test_core_quota_compliance.c | 21 | * @file core/test_core_quota_compliance.c |
22 | * @brief testcase for core_api.c focusing quota compliance on core level | 22 | * @brief testcase for core_api.c focusing quota compliance on core level |
23 | * @author Christian Grothoff | ||
23 | */ | 24 | */ |
24 | #include "platform.h" | 25 | #include "platform.h" |
25 | #include "gnunet_arm_service.h" | 26 | #include "gnunet_arm_service.h" |
@@ -820,6 +821,30 @@ check () | |||
820 | } | 821 | } |
821 | 822 | ||
822 | 823 | ||
824 | static void | ||
825 | cleanup_directory (int test) | ||
826 | { | ||
827 | switch (test) { | ||
828 | case SYMMETRIC: | ||
829 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/"); | ||
830 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/"); | ||
831 | break; | ||
832 | case ASYMMETRIC_SEND_LIMITED: | ||
833 | GNUNET_DISK_directory_remove | ||
834 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/"); | ||
835 | GNUNET_DISK_directory_remove | ||
836 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/"); | ||
837 | break; | ||
838 | case ASYMMETRIC_RECV_LIMITED: | ||
839 | GNUNET_DISK_directory_remove | ||
840 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/"); | ||
841 | GNUNET_DISK_directory_remove | ||
842 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/"); | ||
843 | break; | ||
844 | } | ||
845 | } | ||
846 | |||
847 | |||
823 | int | 848 | int |
824 | main (int argc, | 849 | main (int argc, |
825 | char *argv[]) | 850 | char *argv[]) |
@@ -827,63 +852,30 @@ main (int argc, | |||
827 | int ret; | 852 | int ret; |
828 | 853 | ||
829 | test = -1; | 854 | test = -1; |
830 | if (strstr (argv[0], "_symmetric") != NULL) | 855 | if (NULL != strstr (argv[0], |
856 | "_symmetric")) | ||
831 | { | 857 | { |
832 | test = SYMMETRIC; | 858 | test = SYMMETRIC; |
833 | } | 859 | } |
834 | else if (strstr (argv[0], "_asymmetric_send") != NULL) | 860 | else if (NULL != strstr (argv[0], |
861 | "_asymmetric_send")) | ||
835 | { | 862 | { |
836 | test = ASYMMETRIC_SEND_LIMITED; | 863 | test = ASYMMETRIC_SEND_LIMITED; |
837 | } | 864 | } |
838 | else if (strstr (argv[0], "_asymmetric_recv") != NULL) | 865 | else if (NULL != strstr (argv[0], |
866 | "_asymmetric_recv")) | ||
839 | { | 867 | { |
840 | test = ASYMMETRIC_RECV_LIMITED; | 868 | test = ASYMMETRIC_RECV_LIMITED; |
841 | } | 869 | } |
842 | GNUNET_assert (test != -1); | 870 | GNUNET_assert (test != -1); |
843 | if (test == SYMMETRIC) | 871 | cleanup_directory (test); |
844 | { | ||
845 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/"); | ||
846 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/"); | ||
847 | } | ||
848 | else if (test == ASYMMETRIC_SEND_LIMITED) | ||
849 | { | ||
850 | GNUNET_DISK_directory_remove | ||
851 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/"); | ||
852 | GNUNET_DISK_directory_remove | ||
853 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/"); | ||
854 | } | ||
855 | else if (test == ASYMMETRIC_RECV_LIMITED) | ||
856 | { | ||
857 | GNUNET_DISK_directory_remove | ||
858 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/"); | ||
859 | GNUNET_DISK_directory_remove | ||
860 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/"); | ||
861 | } | ||
862 | |||
863 | GNUNET_log_setup ("test-core-quota-compliance", | 872 | GNUNET_log_setup ("test-core-quota-compliance", |
864 | "WARNING", | 873 | "WARNING", |
865 | NULL); | 874 | NULL); |
866 | ret = check (); | 875 | ret = check (); |
867 | if (test == SYMMETRIC) | 876 | cleanup_directory (test); |
868 | { | ||
869 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/"); | ||
870 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/"); | ||
871 | } | ||
872 | else if (test == ASYMMETRIC_SEND_LIMITED) | ||
873 | { | ||
874 | GNUNET_DISK_directory_remove | ||
875 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/"); | ||
876 | GNUNET_DISK_directory_remove | ||
877 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/"); | ||
878 | } | ||
879 | else if (test == ASYMMETRIC_RECV_LIMITED) | ||
880 | { | ||
881 | GNUNET_DISK_directory_remove | ||
882 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/"); | ||
883 | GNUNET_DISK_directory_remove | ||
884 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/"); | ||
885 | } | ||
886 | return ret; | 877 | return ret; |
887 | } | 878 | } |
888 | 879 | ||
880 | |||
889 | /* end of test_core_quota_compliance.c */ | 881 | /* end of test_core_quota_compliance.c */ |