2 * Check: a unit test framework for C
3 * Copyright (C) 2001, 2002 Arien Malec
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 * The purpose of this test is to be used by valgrind to check for
23 * memory leaks. Each public API that check exports is used at
24 * least once. Tests which use non-public API, or leak intentionally,
25 * are not included here.
33 #include "check_check.h"
41 * First, the sub suite is run. This suite has failures which
42 * are intentional, as the output of the failures is checked
43 * in check_check_master.c. However, here we do not check if
44 * the failures are expected. Instead, we just want to run
45 * them and see if they leak. Because of this, the result
46 * of the suite is not checked.
48 sr = srunner_create(make_sub_suite());
50 * Enable all logging types, just in case one of them
53 srunner_set_log (sr, "test_mem_leak.log");
54 srunner_set_xml (sr, "test_mem_leak.xml");
55 srunner_set_tap (sr, "test_mem_leak.tap");
56 srunner_run_all(sr, CK_NORMAL);
59 /* Now, the other suite is run. These are all expected to pass. */
61 /* The following setup is necessary for the fork suite */
64 sr = srunner_create (make_log_suite());
65 srunner_add_suite(sr, make_fork_suite());
67 #if defined(HAVE_FORK) && HAVE_FORK==1
68 srunner_add_suite(sr, make_exit_suite());
70 srunner_add_suite(sr, make_tag_suite());
71 srunner_add_suite(sr, make_selective_suite());
74 * Enable all logging types, just in case one of them
77 srunner_set_log (sr, "test_mem_leak.log");
78 srunner_set_xml (sr, "test_mem_leak.xml");
79 srunner_set_tap (sr, "test_mem_leak.tap");
81 srunner_run_all(sr, CK_NORMAL);
83 /* Cleanup from the fork suite setup */
86 number_failed = srunner_ntests_failed(sr);
88 return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;