LTP GCOV extension - code coverage report
Current view: directory - src/utils/lib_loader - tllib.tests
Test: min.info
Date: 2009-06-18 Instrumented lines: 35
Code covered: 100.0 % Executed lines: 35

       1                 : /*
       2                 :  * This file is part of MIN Test Framework. Copyright © 2008 Nokia Corporation
       3                 :  * and/or its subsidiary(-ies).
       4                 :  * Contact: Sampo Saaristo
       5                 :  * Contact e-mail: DG.MIN-Support@nokia.com
       6                 :  * 
       7                 :  * This program is free software: you can redistribute it and/or modify it 
       8                 :  * under the terms of the GNU General Public License as published by the Free 
       9                 :  * Software Foundation, version 2 of the License. 
      10                 :  * 
      11                 :  * This program is distributed in the hope that it will be useful, but WITHOUT 
      12                 :  * ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or 
      13                 :  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General  Public License for
      14                 :  * more details. You should have received a copy of the GNU General Public 
      15                 :  * License along with this program. If not,  see 
      16                 :  * <http://www.gnu.org/licenses/>.
      17                 :  */
      18                 : 
      19                 : 
      20                 : /**
      21                 :  *  @file       tllib.tests
      22                 :  *  @version    0.1
      23                 :  *  @brief      This file contains test for MIN library loader utility
      24                 :  */
      25                 : 
      26                 : /* ------------------------------------------------------------------------- */
      27                 : /* INCLUDES */
      28                 : #include <check.h>
      29                 : #include <min_text.h>
      30                 : 
      31                 : /* ------------------------------------------------------------------------- */
      32                 : /* CONSTANTS */
      33                 : /* None */
      34                 : 
      35                 : /* ------------------------------------------------------------------------- */
      36                 : /* MACROS */
      37                 : /* None */
      38                 : 
      39                 : /* ------------------------------------------------------------------------- */
      40                 : /* DATA TYPES */
      41                 : /* None */
      42                 : 
      43                 : /* ------------------------------------------------------------------------- */
      44                 : /* LOCAL FUNCTION PROTOTYPES */
      45                 : /* None */
      46                 : 
      47                 : /* ------------------------------------------------------------------------- */
      48                 : /* FORWARD DECLARATIONS */
      49                 : /* None */
      50                 : 
      51                 : /* ------------------------------------------------------------------------- */
      52                 : /* STRUCTURES */
      53                 : /* None */
      54                 : 
      55                 : /* ------------------------------------------------------------------------- */
      56                 : /* ==================== LOCAL FUNCTIONS ==================================== */
      57                 : /* None */
      58                 : 
      59                 : /* ------------------------------------------------------------------------- */
      60                 : /* ============================= TESTS ===================================== */
      61                 : /* ------------------------------------------------------------------------- */
      62               1 : START_TEST(test_lib_open_ok)
      63                 : {
      64                 :         test_libl_t tlib;
      65                 :         Text *path;
      66                 :         int retval;
      67                 : 
      68               1 :         path = tx_create (getenv("PWD")) ;
      69               1 :         tx_c_append (path, "/../src/test_libraries/.libs/minDemoModule.so");
      70               1 :         retval = tl_open  (&tlib, tx_share_buf (path));
      71               1 :         fail_unless (retval == 0, "failed to open %s", tx_share_buf (path) );
      72                 : 
      73               1 :         fail_unless (tl_is_ok (&tlib), "tl_is_ok() returns error");
      74                 : }
      75               1 : END_TEST
      76                 : 
      77               1 : START_TEST(test_lib_open_nok)
      78                 : {
      79                 :         test_libl_t tlib;
      80                 :         Text *path;
      81                 :         int retval;
      82                 : 
      83               1 :         path = tx_create (getenv("PWD")) ;
      84               1 :         tx_c_append (path, "/../src/test_libraries/.libs/minDemoModdule.so");
      85               1 :         retval = tl_open  (&tlib, tx_share_buf (path));
      86               1 :         fail_if (retval == 0, "opening %s should have failed", tx_share_buf (path) );
      87                 : 
      88               1 :         fail_if (tl_is_ok (&tlib), "tl_is_ok() returns error");
      89                 : }
      90               1 : END_TEST
      91                 : 
      92               1 : START_TEST(test_lib_close_ok)
      93                 : {
      94                 :         test_libl_t tlib;
      95                 :         Text *path;
      96                 :         int retval;
      97                 : 
      98               1 :         path = tx_create (getenv("PWD")) ;
      99               1 :         tx_c_append (path, "/../src/test_libraries/.libs/minDemoModule.so");
     100               1 :         retval = tl_open  (&tlib, tx_share_buf (path));
     101               1 :         fail_unless (retval == 0, "failed to open %s", tx_share_buf (path) );
     102                 : 
     103               1 :         fail_unless (tl_is_ok (&tlib), "tl_is_ok() returns error");
     104                 : 
     105               1 :         fail_if (tl_close (&tlib), "tl_close() returns error");
     106                 : 
     107                 : }
     108               1 : END_TEST
     109                 : 
     110               1 : START_TEST(test_lib_close_nok)
     111                 : {
     112                 :         test_libl_t tlib;
     113                 :         Text *path;
     114                 :         int retval;
     115                 : 
     116               1 :         tlib.test_library_ = INITPTR;
     117               1 :         fail_unless (tl_close (&tlib), "tl_close() should fail");
     118                 : 
     119                 : }
     120               1 : END_TEST
     121                 : 
     122                 : /* ------------------------------------------------------------------------- */
     123                 : /* ------------------------------------------------------------------------- */
     124                 : /* ========================== FUNCTIONS ==================================== */
     125                 : /* ------------------------------------------------------------------------- */
     126                 : Suite* tllib_suite()
     127               1 : {
     128               1 :         Suite * s = suite_create ("library loader");
     129                 : 
     130                 :         /* Core test case */
     131               1 :         TCase *tc_core = tcase_create ("Core");
     132                 : 
     133               1 :         tcase_add_test (tc_core, test_lib_open_ok );
     134               1 :         tcase_add_test (tc_core, test_lib_open_nok );
     135               1 :         tcase_add_test (tc_core, test_lib_close_ok );
     136               1 :         tcase_add_test (tc_core, test_lib_close_nok );
     137                 : 
     138                 : //        tcase_add_test (tc_core, );
     139                 :         //      tcase_add_test (tc_core, );
     140                 : 
     141               1 :         suite_add_tcase (s, tc_core);
     142                 : 
     143               1 :         return s;
     144                 : }
     145                 : /* ------------------------------------------------------------------------- */
     146                 : /* End of file */

Generated by: LTP GCOV extension version 1.6