fix
[oweals/gnunet.git] / src / transport / test_quota_compliance.c
index 041bd0968ea9d684a03a4fa881f11a7bed9b7e3e..0f552cbb006edb20d1563ff8be846a3397a4e395 100644 (file)
@@ -42,7 +42,7 @@
 #define DEBUG_MEASUREMENT GNUNET_NO
 #define DEBUG_CONNECTIONS GNUNET_NO
 
-#define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
+#define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
 #define MEASUREMENT_MSG_SIZE 1024
 #define MEASUREMENT_MSG_SIZE_BIG 32768
 #define MEASUREMENT_MAX_QUOTA 1024 * 1024 * 1024
@@ -400,6 +400,23 @@ measurement_end (void *cls,
   else
          delta = (quota_allowed/10);
 
+  /* Throughput is far too slow. This is to prevent the test to exit with success when throughput is 0 */
+  if ((total_bytes_sent/(duration.rel_value / 1000)) < 100)
+  {
+         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                         "\nQuota compliance failed: \n"\
+                         "Hard quota limit allowed: %10llu kB/s (%llu B/s)\n"\
+                         "Soft quota limit allowed: %10llu kB/s (%llu B/s)\n"\
+                         "Throughput              : %10llu kB/s (%llu B/s)\n",
+                         (quota_allowed / (1024)), quota_allowed,
+                         ((quota_allowed+delta) / (1024)),  quota_allowed+delta,
+                         (total_bytes_sent/(duration.rel_value / 1000)/1024),
+                         total_bytes_sent/(duration.rel_value / 1000));
+         ok = 1;
+         end();
+  }
+
+  /* Throughput is bigger than allowed quota + some extra*/
   if ((total_bytes_sent/(duration.rel_value / 1000)) > (quota_allowed + delta))
   {
          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,