LCOV - code coverage report
Current view: top level - test - suite_modmgr-modules.c (source / functions) Hit Total Coverage
Test: mkernel.info Lines: 21 21 100.0 %
Date: 2024-07-29 18:09:36 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /**   \file  suite_modmgr-modules.c
       2             :  *   \brief  Check ModMgr module management
       3             :  *  \author  François Cerbelle (Fanfan), francois@cerbelle.net
       4             :  *
       5             :  *  \internal
       6             :  *       Created:  29/01/2024
       7             :  *      Revision:  none
       8             :  * Last modified:  2024-07-27 17:28
       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 "modmgr.h"
      22             : #include "oom.h"                                /* OOM simulation */
      23             : #include <check.h>
      24             : #include <unistd.h>                             /* pid_t getpid() */
      25             : #include <sys/stat.h>                           /* mkdir(), chdir(), mode_t */
      26             : #include <stdio.h>                              /* fprintf */
      27             : #include <stdlib.h>                             /* abort() */
      28             : #include <string.h>                             /* strdup */
      29             : #include "checktools.inc"
      30             : 
      31             : /*
      32             :  * Module management :
      33             :  * - from = uninitialized, empty, 1 module (mkmod1), 1 module (mkmod1:2),
      34             :  * 3 modules (mkmod1, mkmod2, mkmod3)
      35             :  * 3 modules (mkmod1:2, mkmod2, mkmod3)
      36             :  * 3 modules (mkmod1, mkmod2:2, mkmod3)
      37             :  * 3 modules (mkmod1, mkmod2, mkmod3:2)
      38             :  * 3 modules (mkmod1:2, mkmod2:2, mkmod3)
      39             :  * 3 modules (mkmod1:2, mkmod2, mkmod3:2)
      40             :  * 3 modules (mkmod1:2, mkmod2:2, mkmod3:2)
      41             :  *
      42             :  * load (normal, OOM, overflow)
      43             :  * - modfile = NULL, empty, missing, normal, subfolder, PATH_MAX+1, noOnLoad, noOnUnload, noGetSymbol, badInfos, badAPI
      44             :  *
      45             :  * getsymbol (normal, OOM, overflow)
      46             :  * - module = NULL, normal, noOnLoad, noOnUnload, noGetSymbol, badInfos, badAPI
      47             :  * - szSymbol = NULL, empty, missing, normal,
      48             :  *
      49             :  * unload (normal, OOM, overflow)
      50             :  * - module = NULL, normal, noOnLoad, noOnUnload, noGetSymbol, badInfos, badAPI
      51             :  *
      52             :  * */
      53           3 : START_TEST(modmgr_modules_dummy)
      54             : {
      55           3 : }
      56             : END_TEST
      57             : 
      58             : /************************************************************************/
      59           5 : void load_uninitialized_unchecked_setup()
      60             : {
      61           5 :     forktest_init();
      62           5 : }
      63           3 : void load_uninitialized_checked_setup()
      64             : {
      65           3 :     signals_catch();
      66           3 :     forktest_gprofdir();
      67           3 : }
      68           3 : void load_uninitialized_checked_teardown()
      69             : {
      70           3 :     signals_release();
      71           3 : }
      72           3 : void load_uninitialized_unchecked_teardown() { }
      73             : 
      74        2155 : Suite* modmgr_modules_suite()
      75             : {
      76             :     Suite *s;
      77             :     TCase *tc;
      78             : 
      79        2155 :     s = suite_create("ModMgr-Modules");
      80             : 
      81        2155 :     tc = tcase_create("Uninitialized");
      82        2155 :     tcase_add_checked_fixture(tc, load_uninitialized_checked_setup, load_uninitialized_checked_teardown);
      83        2155 :     tcase_add_unchecked_fixture(tc, load_uninitialized_unchecked_setup, load_uninitialized_unchecked_teardown);
      84        2155 :     suite_add_tcase(s, tc);
      85        2155 :     tcase_add_test(tc, modmgr_modules_dummy);
      86             : 
      87        2155 :     return s;
      88             : }
      89             : 

Generated by: LCOV version 1.16