Line data Source code
1 : /** @file suite_clustercon.c 2 : * @brief Check testsuite for clustercon functions 3 : * @author François Cerbelle (Fanfan), francois@cerbelle.net 4 : * 5 : * @internal 6 : * Created: 20/03/2022 7 : * Revision: none 8 : * Last modified: 2024-11-13 19:20 9 : * Compiler: gcc 10 : * Organization: Cerbelle.net 11 : * Copyright: Copyright (c) 2024, François Cerbelle 12 : * 13 : * This source code is released for free distribution under the terms of the 14 : * GNU General Public License as published by the Free Software Foundation. 15 : */ 16 : 17 : #ifdef HAVE_CONFIG_H 18 : #include "config.h" 19 : #endif 20 : 21 : #include <check.h> 22 : #include <stdlib.h> 23 : #include "checktools.inc" 24 : 25 : #include "clustercon.c" 26 : 27 : /** Dummy test to trigger fixtures 28 : * 29 : * This test is defined and added to all testcases in order to execute at 30 : * least one test test in each testcase of the testsuite, trigger the 31 : * fixtures and have a decent coverage report. 32 : */ 33 3 : START_TEST(clustercon_test) { 34 : /* This test is supposed to trigger a SIGABRT(6) and will crash the 35 : * whole testsuite if not caught or not in a child process */ 36 3 : forktest_only; 37 : 38 2 : abort(); 39 : } 40 : END_TEST 41 : 42 : /************************************************************************/ 43 : /* Begining of test (potentially in child) */ 44 3 : void clustercon_checked_uninitialized_setup() { 45 3 : signals_catch(); 46 3 : forktest_gprofdir(); 47 3 : } 48 : 49 : /* End of test (potentially in child) */ 50 1 : void clustercon_checked_uninitialized_teardown() { 51 1 : signals_release(); 52 1 : } 53 : /************************************************************************/ 54 5 : void clustercon_unchecked_common_setup() { 55 5 : forktest_init(); 56 5 : } 57 3 : void clustercon_unchecked_common_teardown() { 58 3 : } 59 : /************************************************************************/ 60 6 : Suite* clustercon_suite() { 61 : Suite *s; 62 : TCase *tc; 63 : 64 6 : s = suite_create("Clustercon"); 65 : 66 6 : tc = tcase_create("ClusterconUninitialized"); 67 6 : tcase_set_tags(tc,"ClusterconTag ClusterconTag2"); 68 : /* tcase_set_timeout(tc,5); */ /* seconds */ 69 6 : tcase_add_checked_fixture(tc, clustercon_checked_uninitialized_setup, clustercon_checked_uninitialized_teardown); 70 6 : tcase_add_unchecked_fixture(tc, clustercon_unchecked_common_setup, clustercon_unchecked_common_teardown); 71 6 : suite_add_tcase(s, tc); 72 6 : tcase_add_test_raise_signal(tc, clustercon_test,6); 73 : 74 6 : return s; 75 : } 76 : /* vim: set tw=80: */