]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix a problem with the mem_test unit test
authorWitold Kręcicki <wpk@culm.net>
Fri, 15 Nov 2019 12:30:04 +0000 (13:30 +0100)
committerEvan Hunt <each@isc.org>
Mon, 18 Nov 2019 02:59:40 +0000 (18:59 -0800)
isc_mem_traceflag_test messes with stdout/stderr, which can cause
problems with subsequent tests (no output, libuv problems).  Moving that
test case to the end ensures there are no side effects.

lib/isc/tests/mem_test.c

index c1c63be6109484c19d18228308ba1fb7ed83e345..c237ef23cd32285832f6373195973bf82ea62090 100644 (file)
@@ -511,20 +511,25 @@ main(void) {
                cmocka_unit_test_setup_teardown(isc_mem_inuse_test,
                                _setup, _teardown),
 
+#if !defined(__SANITIZE_THREAD__)
+               cmocka_unit_test_setup_teardown(isc_mem_benchmark,
+                                               _setup, _teardown),
+               cmocka_unit_test_setup_teardown(isc_mempool_benchmark,
+                                               _setup, _teardown),
+#endif /* __SANITIZE_THREAD__ */
 #if ISC_MEM_TRACKLINES
                cmocka_unit_test_setup_teardown(isc_mem_noflags_test,
                                _setup, _teardown),
                cmocka_unit_test_setup_teardown(isc_mem_recordflag_test,
                                _setup, _teardown),
+               /*
+                * traceflag_test closes stderr, which causes weird
+                * side effects for any next test trying to use libuv.
+                * This test has to be the last one to avoid problems.
+                */
                cmocka_unit_test_setup_teardown(isc_mem_traceflag_test,
                                _setup, _teardown),
 #endif
-#if !defined(__SANITIZE_THREAD__)
-               cmocka_unit_test_setup_teardown(isc_mem_benchmark,
-                                               _setup, _teardown),
-               cmocka_unit_test_setup_teardown(isc_mempool_benchmark,
-                                               _setup, _teardown),
-#endif /* __SANITIZE_THREAD__ */
        };
 
        return (cmocka_run_group_tests(tests, NULL, NULL));