]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-cpu-limit - Remove checking for CPU usage upper limit
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 21 Sep 2021 10:38:27 +0000 (13:38 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 22 Sep 2021 08:44:01 +0000 (08:44 +0000)
These tests keep randomly failing on loaded systems. It's more important
anyway to check that the minimum CPU usage is high enough than it is to
check that CPU usage isn't too high.

src/lib/test-cpu-limit.c

index 23ac923f2f205510e083a328be0906ac66dc918a..aefb92ab7d9c3222618a53ae3199709ba966ee67 100644 (file)
@@ -68,8 +68,6 @@ test_cpu_limit_simple(enum cpu_limit_type type, const char *type_str)
        cpu = get_cpu_time(type);
        diff_msecs = timeval_diff_msecs(&cpu, &usage);
        test_assert_cmp(diff_msecs, >=, 2000 - ALLOW_MSECS_BELOW);
-       if ((type & CPU_LIMIT_TYPE_SYSTEM) == 0)
-               test_assert_cmp(diff_msecs, <=, 2000 + ALLOW_MSECS_ABOVE);
 
        lib_signals_deinit();
        test_end();
@@ -100,16 +98,12 @@ static void test_cpu_limit_nested(enum cpu_limit_type type, const char *type_str
                /* we may have looped only for a short time in case climit1
                   was triggered during this loop. */
                diff_msecs = timeval_diff_msecs(&cpu, &usage2);
-               if ((type & CPU_LIMIT_TYPE_SYSTEM) == 0)
-                       test_assert_cmp(diff_msecs, <=, 1000 + ALLOW_MSECS_ABOVE);
        }
 
        cpu_limit_deinit(&climit1);
        cpu = get_cpu_time(type);
        diff_msecs = timeval_diff_msecs(&cpu, &usage1);
        test_assert_cmp(diff_msecs, >=, 3000 - ALLOW_MSECS_BELOW);
-       if ((type & CPU_LIMIT_TYPE_SYSTEM) == 0)
-               test_assert_cmp(diff_msecs, <=, 3000 + ALLOW_MSECS_ABOVE);
 
        lib_signals_deinit();
        test_end();
@@ -138,16 +132,12 @@ static void test_cpu_limit_nested(enum cpu_limit_type type, const char *type_str
                /* we may have looped only for a short time in case climit1
                   was triggered during this loop. */
                diff_msecs = timeval_diff_msecs(&cpu, &usage2);
-               if ((type & CPU_LIMIT_TYPE_SYSTEM) == 0)
-                       test_assert_cmp(diff_msecs, <=, 1000 + ALLOW_MSECS_ABOVE);
        }
 
        cpu_limit_deinit(&climit1);
        cpu = get_cpu_time(type);
        diff_msecs = timeval_diff_msecs(&cpu, &usage1);
        test_assert_cmp(diff_msecs, >=, 3000 - ALLOW_MSECS_BELOW);
-       if ((type & CPU_LIMIT_TYPE_SYSTEM) == 0)
-               test_assert_cmp(diff_msecs, <=, 3000 + ALLOW_MSECS_ABOVE);
 
        i_unlink_if_exists(test_path);
        lib_signals_deinit();