File: | build-scan/../src/test/test-cpu-set-util.c |
Warning: | line 124, column 9 Value stored to 'str' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
2 | |
3 | #include <errno(*__errno_location ()).h> |
4 | |
5 | #include "alloc-util.h" |
6 | #include "cpu-set-util.h" |
7 | #include "string-util.h" |
8 | #include "macro.h" |
9 | |
10 | static void test_parse_cpu_set(void) { |
11 | CPUSet c = {}; |
12 | _cleanup_free___attribute__((cleanup(freep))) char *str = NULL((void*)0); |
13 | int cpu; |
14 | |
15 | log_info("/* %s */", __func__)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 15, __func__, "/* %s */" , __func__) : -abs(_e); }); |
16 | |
17 | /* Single value */ |
18 | assert_se(parse_cpu_set_full("0", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0", & c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 18, __PRETTY_FUNCTION__ ); } while (0); |
19 | assert_se(c.set)do { if ((__builtin_expect(!!(!(c.set)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c.set"), "../src/test/test-cpu-set-util.c" , 19, __PRETTY_FUNCTION__); } while (0); |
20 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X288 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y289 = ((8)); (__unique_prefix_X288 / __unique_prefix_Y289 + !!(__unique_prefix_X288 % __unique_prefix_Y289 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 20, __PRETTY_FUNCTION__ ); } while (0); |
21 | assert_se(CPU_ISSET_S(0, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (0); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask * ) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask))) ] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(0, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 21, __PRETTY_FUNCTION__); } while (0); |
22 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 1)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 1)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 1"), "../src/test/test-cpu-set-util.c" , 22, __PRETTY_FUNCTION__); } while (0); |
23 | |
24 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 24, __PRETTY_FUNCTION__ ); } while (0); |
25 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 25, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
26 | str = mfree(str); |
27 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 27, __PRETTY_FUNCTION__ ); } while (0); |
28 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 28, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
29 | assert_se(streq(str, "0"))do { if ((__builtin_expect(!!(!((strcmp((str),("0")) == 0))), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"0\")" ), "../src/test/test-cpu-set-util.c", 29, __PRETTY_FUNCTION__ ); } while (0); |
30 | str = mfree(str); |
31 | cpu_set_reset(&c); |
32 | |
33 | /* Simple range (from CPUAffinity example) */ |
34 | assert_se(parse_cpu_set_full("1 2 4", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("1 2 4", & c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"1 2 4\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 34, __PRETTY_FUNCTION__ ); } while (0); |
35 | assert_se(c.set)do { if ((__builtin_expect(!!(!(c.set)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c.set"), "../src/test/test-cpu-set-util.c" , 35, __PRETTY_FUNCTION__); } while (0); |
36 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X290 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y291 = ((8)); (__unique_prefix_X290 / __unique_prefix_Y291 + !!(__unique_prefix_X290 % __unique_prefix_Y291 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 36, __PRETTY_FUNCTION__ ); } while (0); |
37 | assert_se(CPU_ISSET_S(1, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (1); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask * ) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask))) ] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(1, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 37, __PRETTY_FUNCTION__); } while (0); |
38 | assert_se(CPU_ISSET_S(2, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (2); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask * ) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask))) ] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(2, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 38, __PRETTY_FUNCTION__); } while (0); |
39 | assert_se(CPU_ISSET_S(4, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (4); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask * ) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask))) ] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(4, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 39, __PRETTY_FUNCTION__); } while (0); |
40 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 3)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 3)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 3"), "../src/test/test-cpu-set-util.c" , 40, __PRETTY_FUNCTION__); } while (0); |
41 | |
42 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 42, __PRETTY_FUNCTION__ ); } while (0); |
43 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 43, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
44 | str = mfree(str); |
45 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 45, __PRETTY_FUNCTION__ ); } while (0); |
46 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 46, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
47 | assert_se(streq(str, "1-2 4"))do { if ((__builtin_expect(!!(!((strcmp((str),("1-2 4")) == 0 ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"1-2 4\")" ), "../src/test/test-cpu-set-util.c", 47, __PRETTY_FUNCTION__ ); } while (0); |
48 | str = mfree(str); |
49 | cpu_set_reset(&c); |
50 | |
51 | /* A more interesting range */ |
52 | assert_se(parse_cpu_set_full("0 1 2 3 8 9 10 11", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0 1 2 3 8 9 10 11" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0 1 2 3 8 9 10 11\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 52, __PRETTY_FUNCTION__ ); } while (0); |
53 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X292 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y293 = ((8)); (__unique_prefix_X292 / __unique_prefix_Y293 + !!(__unique_prefix_X292 % __unique_prefix_Y293 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 53, __PRETTY_FUNCTION__ ); } while (0); |
54 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 8)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 8)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 8"), "../src/test/test-cpu-set-util.c" , 54, __PRETTY_FUNCTION__); } while (0); |
55 | for (cpu = 0; cpu < 4; cpu++) |
56 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 56, __PRETTY_FUNCTION__); } while (0); |
57 | for (cpu = 8; cpu < 12; cpu++) |
58 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 58, __PRETTY_FUNCTION__); } while (0); |
59 | |
60 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 60, __PRETTY_FUNCTION__ ); } while (0); |
61 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 61, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
62 | str = mfree(str); |
63 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 63, __PRETTY_FUNCTION__ ); } while (0); |
64 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 64, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
65 | assert_se(streq(str, "0-3 8-11"))do { if ((__builtin_expect(!!(!((strcmp((str),("0-3 8-11")) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"0-3 8-11\")" ), "../src/test/test-cpu-set-util.c", 65, __PRETTY_FUNCTION__ ); } while (0); |
66 | str = mfree(str); |
67 | cpu_set_reset(&c); |
68 | |
69 | /* Quoted strings */ |
70 | assert_se(parse_cpu_set_full("8 '9' 10 \"11\"", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("8 '9' 10 \"11\"" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"8 '9' 10 \\\"11\\\"\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 70, __PRETTY_FUNCTION__ ); } while (0); |
71 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X294 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y295 = ((8)); (__unique_prefix_X294 / __unique_prefix_Y295 + !!(__unique_prefix_X294 % __unique_prefix_Y295 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 71, __PRETTY_FUNCTION__ ); } while (0); |
72 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 4)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 4)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 4"), "../src/test/test-cpu-set-util.c" , 72, __PRETTY_FUNCTION__); } while (0); |
73 | for (cpu = 8; cpu < 12; cpu++) |
74 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 74, __PRETTY_FUNCTION__); } while (0); |
75 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 75, __PRETTY_FUNCTION__ ); } while (0); |
76 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 76, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
77 | str = mfree(str); |
78 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 78, __PRETTY_FUNCTION__ ); } while (0); |
79 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 79, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
80 | assert_se(streq(str, "8-11"))do { if ((__builtin_expect(!!(!((strcmp((str),("8-11")) == 0) )),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"8-11\")" ), "../src/test/test-cpu-set-util.c", 80, __PRETTY_FUNCTION__ ); } while (0); |
81 | str = mfree(str); |
82 | cpu_set_reset(&c); |
83 | |
84 | /* Use commas as separators */ |
85 | assert_se(parse_cpu_set_full("0,1,2,3 8,9,10,11", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0,1,2,3 8,9,10,11" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0,1,2,3 8,9,10,11\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 85, __PRETTY_FUNCTION__ ); } while (0); |
86 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X296 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y297 = ((8)); (__unique_prefix_X296 / __unique_prefix_Y297 + !!(__unique_prefix_X296 % __unique_prefix_Y297 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 86, __PRETTY_FUNCTION__ ); } while (0); |
87 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 8)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 8)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 8"), "../src/test/test-cpu-set-util.c" , 87, __PRETTY_FUNCTION__); } while (0); |
88 | for (cpu = 0; cpu < 4; cpu++) |
89 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 89, __PRETTY_FUNCTION__); } while (0); |
90 | for (cpu = 8; cpu < 12; cpu++) |
91 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 91, __PRETTY_FUNCTION__); } while (0); |
92 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 92, __PRETTY_FUNCTION__ ); } while (0); |
93 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 93, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
94 | str = mfree(str); |
95 | cpu_set_reset(&c); |
96 | |
97 | /* Commas with spaces (and trailing comma, space) */ |
98 | assert_se(parse_cpu_set_full("0, 1, 2, 3, 4, 5, 6, 7, 63, ", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0, 1, 2, 3, 4, 5, 6, 7, 63, " , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0, 1, 2, 3, 4, 5, 6, 7, 63, \", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 98, __PRETTY_FUNCTION__ ); } while (0); |
99 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X298 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y299 = ((8)); (__unique_prefix_X298 / __unique_prefix_Y299 + !!(__unique_prefix_X298 % __unique_prefix_Y299 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 99, __PRETTY_FUNCTION__ ); } while (0); |
100 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 9)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 9)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 9"), "../src/test/test-cpu-set-util.c" , 100, __PRETTY_FUNCTION__); } while (0); |
101 | for (cpu = 0; cpu < 8; cpu++) |
102 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 102, __PRETTY_FUNCTION__); } while (0); |
103 | |
104 | assert_se(CPU_ISSET_S(63, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (63); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask * ) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask))) ] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(63, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 104, __PRETTY_FUNCTION__); } while (0); |
105 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 105, __PRETTY_FUNCTION__ ); } while (0); |
106 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 106, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
107 | str = mfree(str); |
108 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 108, __PRETTY_FUNCTION__ ); } while (0); |
109 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 109, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
110 | assert_se(streq(str, "0-7 63"))do { if ((__builtin_expect(!!(!((strcmp((str),("0-7 63")) == 0 ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"0-7 63\")" ), "../src/test/test-cpu-set-util.c", 110, __PRETTY_FUNCTION__ ); } while (0); |
111 | str = mfree(str); |
112 | cpu_set_reset(&c); |
113 | |
114 | /* Ranges */ |
115 | assert_se(parse_cpu_set_full("0-3,8-11", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0-3,8-11" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0-3,8-11\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 115, __PRETTY_FUNCTION__ ); } while (0); |
116 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X300 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y301 = ((8)); (__unique_prefix_X300 / __unique_prefix_Y301 + !!(__unique_prefix_X300 % __unique_prefix_Y301 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 116, __PRETTY_FUNCTION__ ); } while (0); |
117 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 8)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 8)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 8"), "../src/test/test-cpu-set-util.c" , 117, __PRETTY_FUNCTION__); } while (0); |
118 | for (cpu = 0; cpu < 4; cpu++) |
119 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 119, __PRETTY_FUNCTION__); } while (0); |
120 | for (cpu = 8; cpu < 12; cpu++) |
121 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 121, __PRETTY_FUNCTION__); } while (0); |
122 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 122, __PRETTY_FUNCTION__ ); } while (0); |
123 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 123, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
124 | str = mfree(str); |
Value stored to 'str' is never read | |
125 | cpu_set_reset(&c); |
126 | |
127 | /* Ranges with trailing comma, space */ |
128 | assert_se(parse_cpu_set_full("0-3 8-11, ", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0-3 8-11, " , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0-3 8-11, \", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 128, __PRETTY_FUNCTION__ ); } while (0); |
129 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X302 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y303 = ((8)); (__unique_prefix_X302 / __unique_prefix_Y303 + !!(__unique_prefix_X302 % __unique_prefix_Y303 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 129, __PRETTY_FUNCTION__ ); } while (0); |
130 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 8)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 8)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 8"), "../src/test/test-cpu-set-util.c" , 130, __PRETTY_FUNCTION__); } while (0); |
131 | for (cpu = 0; cpu < 4; cpu++) |
132 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 132, __PRETTY_FUNCTION__); } while (0); |
133 | for (cpu = 8; cpu < 12; cpu++) |
134 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 134, __PRETTY_FUNCTION__); } while (0); |
135 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 135, __PRETTY_FUNCTION__ ); } while (0); |
136 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 136, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
137 | str = mfree(str); |
138 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 138, __PRETTY_FUNCTION__ ); } while (0); |
139 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 139, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
140 | assert_se(streq(str, "0-3 8-11"))do { if ((__builtin_expect(!!(!((strcmp((str),("0-3 8-11")) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"0-3 8-11\")" ), "../src/test/test-cpu-set-util.c", 140, __PRETTY_FUNCTION__ ); } while (0); |
141 | str = mfree(str); |
142 | cpu_set_reset(&c); |
143 | |
144 | /* Negative range (returns empty cpu_set) */ |
145 | assert_se(parse_cpu_set_full("3-0", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("3-0", & c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"3-0\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 145, __PRETTY_FUNCTION__ ); } while (0); |
146 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X304 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y305 = ((8)); (__unique_prefix_X304 / __unique_prefix_Y305 + !!(__unique_prefix_X304 % __unique_prefix_Y305 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 146, __PRETTY_FUNCTION__ ); } while (0); |
147 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 0)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 0"), "../src/test/test-cpu-set-util.c" , 147, __PRETTY_FUNCTION__); } while (0); |
148 | cpu_set_reset(&c); |
149 | |
150 | /* Overlapping ranges */ |
151 | assert_se(parse_cpu_set_full("0-7 4-11", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0-7 4-11" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0-7 4-11\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 151, __PRETTY_FUNCTION__ ); } while (0); |
152 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X306 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y307 = ((8)); (__unique_prefix_X306 / __unique_prefix_Y307 + !!(__unique_prefix_X306 % __unique_prefix_Y307 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 152, __PRETTY_FUNCTION__ ); } while (0); |
153 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 12)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 12)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 12"), "../src/test/test-cpu-set-util.c" , 153, __PRETTY_FUNCTION__); } while (0); |
154 | for (cpu = 0; cpu < 12; cpu++) |
155 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 155, __PRETTY_FUNCTION__); } while (0); |
156 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 156, __PRETTY_FUNCTION__ ); } while (0); |
157 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 157, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
158 | str = mfree(str); |
159 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 159, __PRETTY_FUNCTION__ ); } while (0); |
160 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 160, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
161 | assert_se(streq(str, "0-11"))do { if ((__builtin_expect(!!(!((strcmp((str),("0-11")) == 0) )),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"0-11\")" ), "../src/test/test-cpu-set-util.c", 161, __PRETTY_FUNCTION__ ); } while (0); |
162 | str = mfree(str); |
163 | cpu_set_reset(&c); |
164 | |
165 | /* Mix ranges and individual CPUs */ |
166 | assert_se(parse_cpu_set_full("0,2 4-11", &c, true, NULL, "fake", 1, "CPUAffinity") >= 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0,2 4-11" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") >= 0)), 0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0,2 4-11\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") >= 0" ), "../src/test/test-cpu-set-util.c", 166, __PRETTY_FUNCTION__ ); } while (0); |
167 | assert_se(c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8))do { if ((__builtin_expect(!!(!(c.allocated >= ({ const typeof ((sizeof(__cpu_mask))) __unique_prefix_X308 = ((sizeof(__cpu_mask ))); const typeof((8)) __unique_prefix_Y309 = ((8)); (__unique_prefix_X308 / __unique_prefix_Y309 + !!(__unique_prefix_X308 % __unique_prefix_Y309 )); }))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c.allocated >= DIV_ROUND_UP(sizeof(__cpu_mask), 8)" ), "../src/test/test-cpu-set-util.c", 167, __PRETTY_FUNCTION__ ); } while (0); |
168 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 10)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 10)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 10"), "../src/test/test-cpu-set-util.c" , 168, __PRETTY_FUNCTION__); } while (0); |
169 | assert_se(CPU_ISSET_S(0, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (0); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask * ) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask))) ] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(0, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 169, __PRETTY_FUNCTION__); } while (0); |
170 | assert_se(CPU_ISSET_S(2, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (2); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask * ) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask))) ] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(2, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 170, __PRETTY_FUNCTION__); } while (0); |
171 | for (cpu = 4; cpu < 12; cpu++) |
172 | assert_se(CPU_ISSET_S(cpu, c.allocated, c.set))do { if ((__builtin_expect(!!(!((__extension__ ({ size_t __cpu = (cpu); __cpu / 8 < (c.allocated) ? ((((const __cpu_mask *) ((c.set)->__bits))[((__cpu) / (8 * sizeof (__cpu_mask) ))] & ((__cpu_mask) 1 << ((__cpu) % (8 * sizeof (__cpu_mask )))))) != 0 : 0; })))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_ISSET_S(cpu, c.allocated, c.set)"), "../src/test/test-cpu-set-util.c" , 172, __PRETTY_FUNCTION__); } while (0); |
173 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 173, __PRETTY_FUNCTION__ ); } while (0); |
174 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 174, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
175 | str = mfree(str); |
176 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 176, __PRETTY_FUNCTION__ ); } while (0); |
177 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 177, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
178 | assert_se(streq(str, "0 2 4-11"))do { if ((__builtin_expect(!!(!((strcmp((str),("0 2 4-11")) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"0 2 4-11\")" ), "../src/test/test-cpu-set-util.c", 178, __PRETTY_FUNCTION__ ); } while (0); |
179 | str = mfree(str); |
180 | cpu_set_reset(&c); |
181 | |
182 | /* Garbage */ |
183 | assert_se(parse_cpu_set_full("0 1 2 3 garbage", &c, true, NULL, "fake", 1, "CPUAffinity") == -EINVAL)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0 1 2 3 garbage" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") == -22)),0 ))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0 1 2 3 garbage\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == -EINVAL" ), "../src/test/test-cpu-set-util.c", 183, __PRETTY_FUNCTION__ ); } while (0); |
184 | assert_se(!c.set)do { if ((__builtin_expect(!!(!(!c.set)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("!c.set"), "../src/test/test-cpu-set-util.c" , 184, __PRETTY_FUNCTION__); } while (0); |
185 | assert_se(c.allocated == 0)do { if ((__builtin_expect(!!(!(c.allocated == 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c.allocated == 0"), "../src/test/test-cpu-set-util.c" , 185, __PRETTY_FUNCTION__); } while (0); |
186 | |
187 | /* Range with garbage */ |
188 | assert_se(parse_cpu_set_full("0-3 8-garbage", &c, true, NULL, "fake", 1, "CPUAffinity") == -EINVAL)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0-3 8-garbage" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") == -22)),0 ))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0-3 8-garbage\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == -EINVAL" ), "../src/test/test-cpu-set-util.c", 188, __PRETTY_FUNCTION__ ); } while (0); |
189 | assert_se(!c.set)do { if ((__builtin_expect(!!(!(!c.set)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("!c.set"), "../src/test/test-cpu-set-util.c" , 189, __PRETTY_FUNCTION__); } while (0); |
190 | assert_se(c.allocated == 0)do { if ((__builtin_expect(!!(!(c.allocated == 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c.allocated == 0"), "../src/test/test-cpu-set-util.c" , 190, __PRETTY_FUNCTION__); } while (0); |
191 | |
192 | /* Empty string */ |
193 | assert_se(parse_cpu_set_full("", &c, true, NULL, "fake", 1, "CPUAffinity") == 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("", &c , 1, ((void*)0), "fake", 1, "CPUAffinity") == 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == 0" ), "../src/test/test-cpu-set-util.c", 193, __PRETTY_FUNCTION__ ); } while (0); |
194 | assert_se(!c.set)do { if ((__builtin_expect(!!(!(!c.set)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("!c.set"), "../src/test/test-cpu-set-util.c" , 194, __PRETTY_FUNCTION__); } while (0); /* empty string returns NULL */ |
195 | assert_se(c.allocated == 0)do { if ((__builtin_expect(!!(!(c.allocated == 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c.allocated == 0"), "../src/test/test-cpu-set-util.c" , 195, __PRETTY_FUNCTION__); } while (0); |
196 | |
197 | /* Runaway quoted string */ |
198 | assert_se(parse_cpu_set_full("0 1 2 3 \"4 5 6 7 ", &c, true, NULL, "fake", 1, "CPUAffinity") == -EINVAL)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("0 1 2 3 \"4 5 6 7 " , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") == -22)),0 ))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"0 1 2 3 \\\"4 5 6 7 \", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == -EINVAL" ), "../src/test/test-cpu-set-util.c", 198, __PRETTY_FUNCTION__ ); } while (0); |
199 | assert_se(!c.set)do { if ((__builtin_expect(!!(!(!c.set)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("!c.set"), "../src/test/test-cpu-set-util.c" , 199, __PRETTY_FUNCTION__); } while (0); |
200 | assert_se(c.allocated == 0)do { if ((__builtin_expect(!!(!(c.allocated == 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c.allocated == 0"), "../src/test/test-cpu-set-util.c" , 200, __PRETTY_FUNCTION__); } while (0); |
201 | |
202 | /* Maximum allocation */ |
203 | assert_se(parse_cpu_set_full("8000-8191", &c, true, NULL, "fake", 1, "CPUAffinity") == 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_full("8000-8191" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") == 0)),0)) ) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_full(\"8000-8191\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == 0" ), "../src/test/test-cpu-set-util.c", 203, __PRETTY_FUNCTION__ ); } while (0); |
204 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 192)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 192)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 192"), "../src/test/test-cpu-set-util.c" , 204, __PRETTY_FUNCTION__); } while (0); |
205 | assert_se(str = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_string(& c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 205, __PRETTY_FUNCTION__ ); } while (0); |
206 | log_info("cpu_set_to_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 206, __func__, "cpu_set_to_string: %s" , str) : -abs(_e); }); |
207 | str = mfree(str); |
208 | assert_se(str = cpu_set_to_range_string(&c))do { if ((__builtin_expect(!!(!(str = cpu_set_to_range_string (&c))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("str = cpu_set_to_range_string(&c)" ), "../src/test/test-cpu-set-util.c", 208, __PRETTY_FUNCTION__ ); } while (0); |
209 | log_info("cpu_set_to_range_string: %s", str)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 209, __func__, "cpu_set_to_range_string: %s" , str) : -abs(_e); }); |
210 | assert_se(streq(str, "8000-8191"))do { if ((__builtin_expect(!!(!((strcmp((str),("8000-8191")) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(str, \"8000-8191\")" ), "../src/test/test-cpu-set-util.c", 210, __PRETTY_FUNCTION__ ); } while (0); |
211 | str = mfree(str); |
212 | cpu_set_reset(&c); |
213 | } |
214 | |
215 | static void test_parse_cpu_set_extend(void) { |
216 | CPUSet c = {}; |
217 | _cleanup_free___attribute__((cleanup(freep))) char *s1 = NULL((void*)0), *s2 = NULL((void*)0); |
218 | |
219 | log_info("/* %s */", __func__)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 219, __func__, "/* %s */" , __func__) : -abs(_e); }); |
220 | |
221 | assert_se(parse_cpu_set_extend("1 3", &c, true, NULL, "fake", 1, "CPUAffinity") == 1)do { if ((__builtin_expect(!!(!(parse_cpu_set_extend("1 3", & c, 1, ((void*)0), "fake", 1, "CPUAffinity") == 1)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("parse_cpu_set_extend(\"1 3\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == 1" ), "../src/test/test-cpu-set-util.c", 221, __PRETTY_FUNCTION__ ); } while (0); |
222 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 2)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 2)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 2"), "../src/test/test-cpu-set-util.c" , 222, __PRETTY_FUNCTION__); } while (0); |
223 | assert_se(s1 = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(s1 = cpu_set_to_string(&c ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("s1 = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 223, __PRETTY_FUNCTION__ ); } while (0); |
224 | log_info("cpu_set_to_string: %s", s1)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 224, __func__, "cpu_set_to_string: %s" , s1) : -abs(_e); }); |
225 | |
226 | assert_se(parse_cpu_set_extend("4", &c, true, NULL, "fake", 1, "CPUAffinity") == 1)do { if ((__builtin_expect(!!(!(parse_cpu_set_extend("4", & c, 1, ((void*)0), "fake", 1, "CPUAffinity") == 1)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("parse_cpu_set_extend(\"4\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == 1" ), "../src/test/test-cpu-set-util.c", 226, __PRETTY_FUNCTION__ ); } while (0); |
227 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 3)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 3)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 3"), "../src/test/test-cpu-set-util.c" , 227, __PRETTY_FUNCTION__); } while (0); |
228 | assert_se(s2 = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(s2 = cpu_set_to_string(&c ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("s2 = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 228, __PRETTY_FUNCTION__ ); } while (0); |
229 | log_info("cpu_set_to_string: %s", s2)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 229, __func__, "cpu_set_to_string: %s" , s2) : -abs(_e); }); |
230 | |
231 | assert_se(parse_cpu_set_extend("", &c, true, NULL, "fake", 1, "CPUAffinity") == 0)do { if ((__builtin_expect(!!(!(parse_cpu_set_extend("", & c, 1, ((void*)0), "fake", 1, "CPUAffinity") == 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("parse_cpu_set_extend(\"\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == 0" ), "../src/test/test-cpu-set-util.c", 231, __PRETTY_FUNCTION__ ); } while (0); |
232 | assert_se(!c.set)do { if ((__builtin_expect(!!(!(!c.set)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("!c.set"), "../src/test/test-cpu-set-util.c" , 232, __PRETTY_FUNCTION__); } while (0); |
233 | assert_se(c.allocated == 0)do { if ((__builtin_expect(!!(!(c.allocated == 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c.allocated == 0"), "../src/test/test-cpu-set-util.c" , 233, __PRETTY_FUNCTION__); } while (0); |
234 | log_info("cpu_set_to_string: (null)")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 234, __func__, "cpu_set_to_string: (null)" ) : -abs(_e); }); |
235 | } |
236 | |
237 | static void test_cpu_set_to_from_dbus(void) { |
238 | _cleanup_(cpu_set_reset)__attribute__((cleanup(cpu_set_reset))) CPUSet c = {}, c2 = {}; |
239 | _cleanup_free___attribute__((cleanup(freep))) char *s = NULL((void*)0); |
240 | |
241 | log_info("/* %s */", __func__)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 241, __func__, "/* %s */" , __func__) : -abs(_e); }); |
242 | |
243 | assert_se(parse_cpu_set_extend("1 3 8 100-200", &c, true, NULL, "fake", 1, "CPUAffinity") == 1)do { if ((__builtin_expect(!!(!(parse_cpu_set_extend("1 3 8 100-200" , &c, 1, ((void*)0), "fake", 1, "CPUAffinity") == 1)),0)) ) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("parse_cpu_set_extend(\"1 3 8 100-200\", &c, true, NULL, \"fake\", 1, \"CPUAffinity\") == 1" ), "../src/test/test-cpu-set-util.c", 243, __PRETTY_FUNCTION__ ); } while (0); |
244 | assert_se(s = cpu_set_to_string(&c))do { if ((__builtin_expect(!!(!(s = cpu_set_to_string(&c) )),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("s = cpu_set_to_string(&c)" ), "../src/test/test-cpu-set-util.c", 244, __PRETTY_FUNCTION__ ); } while (0); |
245 | log_info("cpu_set_to_string: %s", s)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 245, __func__, "cpu_set_to_string: %s" , s) : -abs(_e); }); |
246 | assert_se(CPU_COUNT_S(c.allocated, c.set) == 104)do { if ((__builtin_expect(!!(!(__sched_cpucount (c.allocated , c.set) == 104)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("CPU_COUNT_S(c.allocated, c.set) == 104"), "../src/test/test-cpu-set-util.c" , 246, __PRETTY_FUNCTION__); } while (0); |
247 | |
248 | _cleanup_free___attribute__((cleanup(freep))) uint8_t *array = NULL((void*)0); |
249 | size_t allocated; |
250 | static const char expected[32] = |
251 | "\x0A\x01\x00\x00\x00\x00\x00\x00\x00\x00" |
252 | "\x00\x00\xF0\xFF\xFF\xFF\xFF\xFF\xFF\xFF" |
253 | "\xFF\xFF\xFF\xFF\xFF\x01"; |
254 | |
255 | assert_se(cpu_set_to_dbus(&c, &array, &allocated) == 0)do { if ((__builtin_expect(!!(!(cpu_set_to_dbus(&c, & array, &allocated) == 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("cpu_set_to_dbus(&c, &array, &allocated) == 0" ), "../src/test/test-cpu-set-util.c", 255, __PRETTY_FUNCTION__ ); } while (0); |
256 | assert_se(array)do { if ((__builtin_expect(!!(!(array)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("array"), "../src/test/test-cpu-set-util.c" , 256, __PRETTY_FUNCTION__); } while (0); |
257 | assert_se(allocated == c.allocated)do { if ((__builtin_expect(!!(!(allocated == c.allocated)),0) )) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("allocated == c.allocated" ), "../src/test/test-cpu-set-util.c", 257, __PRETTY_FUNCTION__ ); } while (0); |
258 | |
259 | assert_se(allocated <= sizeof expected)do { if ((__builtin_expect(!!(!(allocated <= sizeof expected )),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("allocated <= sizeof expected" ), "../src/test/test-cpu-set-util.c", 259, __PRETTY_FUNCTION__ ); } while (0); |
260 | assert_se(allocated >= DIV_ROUND_UP(201u, 8u))do { if ((__builtin_expect(!!(!(allocated >= ({ const typeof ((201u)) __unique_prefix_X310 = ((201u)); const typeof((8u)) __unique_prefix_Y311 = ((8u)); (__unique_prefix_X310 / __unique_prefix_Y311 + !!( __unique_prefix_X310 % __unique_prefix_Y311)); }))),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("allocated >= DIV_ROUND_UP(201u, 8u)" ), "../src/test/test-cpu-set-util.c", 260, __PRETTY_FUNCTION__ ); } while (0); /* We need at least 201 bits for our mask */ |
261 | assert(memcmp(array, expected, allocated) == 0)do { if ((__builtin_expect(!!(!(memcmp(array, expected, allocated ) == 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("memcmp(array, expected, allocated) == 0" ), "../src/test/test-cpu-set-util.c", 261, __PRETTY_FUNCTION__ ); } while (0); |
262 | |
263 | assert_se(cpu_set_from_dbus(array, allocated, &c2) == 0)do { if ((__builtin_expect(!!(!(cpu_set_from_dbus(array, allocated , &c2) == 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("cpu_set_from_dbus(array, allocated, &c2) == 0"), "../src/test/test-cpu-set-util.c" , 263, __PRETTY_FUNCTION__); } while (0); |
264 | assert_se(c2.set)do { if ((__builtin_expect(!!(!(c2.set)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c2.set"), "../src/test/test-cpu-set-util.c" , 264, __PRETTY_FUNCTION__); } while (0); |
265 | assert_se(c2.allocated == c.allocated)do { if ((__builtin_expect(!!(!(c2.allocated == c.allocated)) ,0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("c2.allocated == c.allocated" ), "../src/test/test-cpu-set-util.c", 265, __PRETTY_FUNCTION__ ); } while (0); |
266 | assert_se(memcmp(c.set, c2.set, c.allocated) == 0)do { if ((__builtin_expect(!!(!(memcmp(c.set, c2.set, c.allocated ) == 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("memcmp(c.set, c2.set, c.allocated) == 0" ), "../src/test/test-cpu-set-util.c", 266, __PRETTY_FUNCTION__ ); } while (0); |
267 | } |
268 | |
269 | static void test_cpus_in_affinity_mask(void) { |
270 | int r; |
271 | |
272 | r = cpus_in_affinity_mask(); |
273 | assert(r > 0)do { if ((__builtin_expect(!!(!(r > 0)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("r > 0"), "../src/test/test-cpu-set-util.c" , 273, __PRETTY_FUNCTION__); } while (0); |
274 | log_info("cpus_in_affinity_mask: %d", r)({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 274, __func__, "cpus_in_affinity_mask: %d" , r) : -abs(_e); }); |
275 | } |
276 | |
277 | int main(int argc, char *argv[]) { |
278 | log_info("CPU_ALLOC_SIZE(1) = %zu", CPU_ALLOC_SIZE(1))({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 278, __func__, "CPU_ALLOC_SIZE(1) = %zu" , ((((1) + (8 * sizeof (__cpu_mask)) - 1) / (8 * sizeof (__cpu_mask ))) * sizeof (__cpu_mask))) : -abs(_e); }); |
279 | log_info("CPU_ALLOC_SIZE(9) = %zu", CPU_ALLOC_SIZE(9))({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 279, __func__, "CPU_ALLOC_SIZE(9) = %zu" , ((((9) + (8 * sizeof (__cpu_mask)) - 1) / (8 * sizeof (__cpu_mask ))) * sizeof (__cpu_mask))) : -abs(_e); }); |
280 | log_info("CPU_ALLOC_SIZE(64) = %zu", CPU_ALLOC_SIZE(64))({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 280, __func__, "CPU_ALLOC_SIZE(64) = %zu" , ((((64) + (8 * sizeof (__cpu_mask)) - 1) / (8 * sizeof (__cpu_mask ))) * sizeof (__cpu_mask))) : -abs(_e); }); |
281 | log_info("CPU_ALLOC_SIZE(65) = %zu", CPU_ALLOC_SIZE(65))({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 281, __func__, "CPU_ALLOC_SIZE(65) = %zu" , ((((65) + (8 * sizeof (__cpu_mask)) - 1) / (8 * sizeof (__cpu_mask ))) * sizeof (__cpu_mask))) : -abs(_e); }); |
282 | log_info("CPU_ALLOC_SIZE(1024) = %zu", CPU_ALLOC_SIZE(1024))({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 282, __func__, "CPU_ALLOC_SIZE(1024) = %zu" , ((((1024) + (8 * sizeof (__cpu_mask)) - 1) / (8 * sizeof (__cpu_mask ))) * sizeof (__cpu_mask))) : -abs(_e); }); |
283 | log_info("CPU_ALLOC_SIZE(1025) = %zu", CPU_ALLOC_SIZE(1025))({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 283, __func__, "CPU_ALLOC_SIZE(1025) = %zu" , ((((1025) + (8 * sizeof (__cpu_mask)) - 1) / (8 * sizeof (__cpu_mask ))) * sizeof (__cpu_mask))) : -abs(_e); }); |
284 | log_info("CPU_ALLOC_SIZE(8191) = %zu", CPU_ALLOC_SIZE(8191))({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-cpu-set-util.c", 284, __func__, "CPU_ALLOC_SIZE(8191) = %zu" , ((((8191) + (8 * sizeof (__cpu_mask)) - 1) / (8 * sizeof (__cpu_mask ))) * sizeof (__cpu_mask))) : -abs(_e); }); |
285 | |
286 | test_parse_cpu_set(); |
287 | test_parse_cpu_set_extend(); |
288 | test_cpus_in_affinity_mask(); |
289 | test_cpu_set_to_from_dbus(); |
290 | |
291 | return 0; |
292 | } |