]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-set-disable-mempool.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 #include "process-util.h"
11 static void* thread(void *p
) {
17 assert_se(!is_main_thread());
18 assert_se(set_size(*s
) == NUM
);
24 static void test_one(const char *val
) {
30 log_info("Testing with SYSTEMD_MEMPOOL=%s", val
);
31 assert_se(setenv("SYSTEMD_MEMPOOL", val
, true) == 0);
32 assert_se(is_main_thread());
34 assert_se(s
= set_new(NULL
));
35 for (i
= 0; i
< NUM
; i
++)
36 assert_se(set_put(s
, &x
[i
]));
38 assert_se(pthread_create(&t
, NULL
, thread
, &s
) == 0);
39 assert_se(pthread_join(t
, NULL
) == 0);
44 int main(int argc
, char *argv
[]) {
45 test_setup_logging(LOG_DEBUG
);
48 /* The value $SYSTEMD_MEMPOOL= is cached. So the following
49 * test should also succeed. */