]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-compress-benchmark: look at $SYSTEMD_SLOW_TESTS
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 12 Jul 2017 21:02:05 +0000 (21:02 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Jul 2017 21:52:49 +0000 (17:52 -0400)
src/journal/test-compress-benchmark.c

index 4fb93ded73ef32b1156c2185243b8367434e6a3e..2a0ef634a5d2d2e42b233f5e9d69f25d9b102d88 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "alloc-util.h"
 #include "compress.h"
+#include "env-util.h"
 #include "macro.h"
 #include "parse-util.h"
 #include "random-util.h"
@@ -32,7 +33,7 @@ typedef int (decompress_t)(const void *src, uint64_t src_size,
 
 #if defined(HAVE_XZ) || defined(HAVE_LZ4)
 
-static usec_t arg_duration = 2 * USEC_PER_SEC;
+static usec_t arg_duration;
 static size_t arg_start;
 
 #define MAX_SIZE (1024*1024LU)
@@ -158,6 +159,7 @@ static void test_compress_decompress(const char* label, const char* type,
 int main(int argc, char *argv[]) {
 #if defined(HAVE_XZ) || defined(HAVE_LZ4)
         const char *i;
+        int r;
 
         log_set_max_level(LOG_INFO);
 
@@ -166,7 +168,15 @@ int main(int argc, char *argv[]) {
 
                 assert_se(safe_atou(argv[1], &x) >= 0);
                 arg_duration = x * USEC_PER_SEC;
+        } else {
+                bool slow;
+
+                r = getenv_bool("SYSTEMD_SLOW_TESTS");
+                slow = r >= 0 ? r : SYSTEMD_SLOW_TESTS_DEFAULT;
+
+                arg_duration = slow ? 2 * USEC_PER_SEC : USEC_PER_SEC / 50;
         }
+
         if (argc == 3)
                 (void) safe_atozu(argv[2], &arg_start);
         else