LTP GCOV extension - code coverage report
Current view: directory - src/engine/data_structures_api - data_test_case.c
Test: min.info
Date: 2009-06-18 Instrumented lines: 189
Code covered: 97.9 % Executed lines: 185

       1                 : /*
       2                 :  * This file is part of MIN Test Framework. Copyright © 2008 Nokia Corporation
       3                 :  * and/or its subsidiary(-ies).
       4                 :  * Contact: Marko Hyyppä
       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                 : /**
      22                 :  *  @file       data_test_case.c
      23                 :  *  @version    0.1
      24                 :  *  @brief      This file contains implementation of Test Case API
      25                 :  */
      26                 : 
      27                 : /* ------------------------------------------------------------------------- */
      28                 : /* INCLUDE FILES */
      29                 : 
      30                 : #include <string.h>
      31                 : #include <pthread.h>
      32                 : #include <data_test_case.h>
      33                 : 
      34                 : /* ------------------------------------------------------------------------- */
      35                 : /* EXTERNAL DATA STRUCTURES */
      36                 : /* None */
      37                 : 
      38                 : /* ------------------------------------------------------------------------- */
      39                 : /* EXTERNAL FUNCTION PROTOTYPES */
      40                 : /* None */
      41                 : 
      42                 : /* ------------------------------------------------------------------------- */
      43                 : /* CONSTANTS */
      44                 : /* None */
      45                 : 
      46                 : /* ------------------------------------------------------------------------- */
      47                 : /* MACROS */
      48                 : /* None */
      49                 : 
      50                 : /* ------------------------------------------------------------------------- */
      51                 : /* LOCAL CONSTANTS AND MACROS */
      52                 : 
      53                 : /** Test Case thread spesicific mutex data variable.
      54                 : Initial value is PTHREAD_MUTEX_INITIALIZER.
      55                 : (Note scope of variable and mutex are the same.)
      56                 : */
      57                 : LOCAL pthread_mutex_t TC_MUTEX = PTHREAD_MUTEX_INITIALIZER;
      58                 : 
      59                 : /* ------------------------------------------------------------------------- */
      60                 : /* MODULE DATA STRUCTURES */
      61                 : /* None */
      62                 : 
      63                 : /* ------------------------------------------------------------------------- */
      64                 : /* LOCAL FUNCTION PROTOTYPES */
      65                 : /* None */
      66                 : 
      67                 : /* ------------------------------------------------------------------------- */
      68                 : /* FORWARD DECLARATIONS */
      69                 : /* None */
      70                 : 
      71                 : /* ==================== LOCAL FUNCTIONS ==================================== */
      72                 : /* None */
      73                 : 
      74                 : /* ======================== FUNCTIONS ====================================== */
      75                 : 
      76                 : /** Adds new Test Case data structure to linked list DLList
      77                 :  *  @param list_handle link to list to which a new element is added.
      78                 :  *  @param tc_data pointer to data that is stored on the list.
      79                 :  *  @return iterator pointing to added element, or INITPTR if adding
      80                 :  *          failed.
      81                 :  *
      82                 :  *  Possible errors:
      83                 :  *  - INITPTR if data adding not completed.
      84                 :  */
      85                 : DLListIterator tc_add (DLList * list_handle, test_case_s * tc_data)
      86             764 : {
      87             764 :         DLListIterator  dllist_item = INITPTR;
      88                 : 
      89             764 :         pthread_mutex_lock (&TC_MUTEX);
      90                 : 
      91                 : 
      92                 :         /* Add Test Case data item to given linked list */
      93             764 :         if (list_handle != INITPTR) {
      94             764 :                 dl_list_add (list_handle, (void *)tc_data);
      95             764 :                 dllist_item = dl_list_tail (list_handle);
      96                 :         }
      97                 : 
      98             764 :         pthread_mutex_unlock (&TC_MUTEX);
      99                 : 
     100             764 :         return dllist_item;
     101                 : }
     102                 : 
     103                 : /* ------------------------------------------------------------------------- */
     104                 : 
     105                 : /** Creates new Test Case data structure
     106                 :  *  @param tm_data_item pointer to Test Module Info data item.
     107                 :  *  @param tc_cfg_filename contains filaname string of
     108                 :  *         Test Case config file.
     109                 :  *  @param tc_title contains title name string of Test Case. 
     110                 :  *  @return pointer to Test Case data, or NULL if creation failed.
     111                 :  *
     112                 :  *  Possible errors:
     113                 :  *  - NULL if data creation not completed.
     114                 :  */
     115                 : test_case_s    *tc_create (DLListIterator tm_data_item,
     116                 :                            filename_t tc_cfg_filename,
     117                 :                            title_string_t tc_title)
     118             753 : {
     119             753 :         pthread_mutex_lock (&TC_MUTEX);
     120                 : 
     121             753 :         test_case_s    *tc_data = NEW (test_case_s);
     122                 :         
     123            1505 :         if ((tc_data != NULL) &&
     124                 :             (strlen (tc_cfg_filename) < MaxFileName + 1) &&
     125                 :             (strlen (tc_title) < MaxTestCaseName + 1)) {
     126                 : 
     127                 :                 /* Test Case basic initialization data */
     128             752 :                 tc_data->tc_id_ = 0;
     129             752 :                 tc_data->tc_ext_id_ = 0;
     130             752 :                 tc_data->tc_group_id_ = 0;
     131                 : 
     132             752 :                 tc_data->status_ = TEST_CASE_IDLE;
     133             752 :                 tc_data->priority_ = 0;
     134             752 :                 tc_data->test_result_list_ = dl_list_create ();
     135             752 :                 tc_data->ip_slave_case_ = 0;
     136                 :                 /* Test Case given data */
     137             752 :                 tc_data->tm_data_item_ = tm_data_item;
     138             752 :                 STRCPY (tc_data->title_, tc_title, strlen (tc_title) + 1);
     139             752 :                 STRCPY (tc_data->tc_cfg_filename_, tc_cfg_filename,
     140                 :                         strlen (tc_cfg_filename) + 1);
     141                 :         } else {
     142               1 :                 tc_data = INITPTR;
     143                 :         }
     144                 : 
     145             753 :         pthread_mutex_unlock (&TC_MUTEX);
     146                 : 
     147             753 :         return tc_data;
     148                 : }
     149                 : 
     150                 : /* ------------------------------------------------------------------------- */
     151                 : 
     152                 : /** Searches for test module by id from the given list
     153                 :  *  @param list_handle pointer to linked list of Test Modules Info data
     154                 :  *  @param id search key
     155                 :  *  @return pointer to Test Module Info data item,
     156                 :  *          or returns INITPTR if operation failed.  
     157                 :  *
     158                 :  */
     159                 : DLListIterator  tc_find_by_id (DLList * list_handle, 
     160                 :                                int test_id)
     161              91 : {
     162                 :         DLListIterator  it;
     163                 :         
     164              91 :         pthread_mutex_lock (&TC_MUTEX);
     165                 : 
     166             769 :         for (it = dl_list_head (list_handle); it != INITPTR;
     167             587 :              it = dl_list_next(it)) {
     168             678 :                 if (((test_case_s    *)dl_list_data(it))->tc_ext_id_ ==
     169                 :                     test_id) {
     170              91 :                         pthread_mutex_unlock (&TC_MUTEX);
     171              91 :                         return it;
     172                 :                 }
     173                 :         }
     174                 : 
     175               0 :         pthread_mutex_unlock (&TC_MUTEX);
     176                 :         
     177               0 :         return INITPTR;
     178                 : 
     179                 : }
     180                 : 
     181                 : /* ------------------------------------------------------------------------- */
     182                 : 
     183                 : /** Removes Test Case data item from linked list where this exists
     184                 :  *  @param tc_data_item pointer to Test Case data item.
     185                 :  */
     186                 : void tc_remove (DLListIterator tc_data_item)
     187              89 : {
     188              89 :         pthread_mutex_lock (&TC_MUTEX);
     189                 : 
     190              89 :         if ((tc_data_item != INITPTR) && (tc_data_item != NULL))
     191              89 :                 dl_list_remove_it (tc_data_item);
     192                 : 
     193              89 :         pthread_mutex_unlock (&TC_MUTEX);
     194              89 : }
     195                 : 
     196                 : /* ------------------------------------------------------------------------- */
     197                 : 
     198                 : /** Deletes Test Case data structure and freeing used memory allocation
     199                 :  *  @param test_case pointer to Test Case data structure.
     200                 :  */
     201                 : void tc_delete (test_case_s * test_case)
     202              82 : {
     203                 :         DLListIterator  it, next_it;
     204                 :         test_result_s  *tr;
     205                 : 
     206              82 :         pthread_mutex_lock (&TC_MUTEX);
     207                 : 
     208                 : 
     209                 :         /* if( (test_case != NULL) && (test_case != INITPTR) ) { */
     210              82 :         it = dl_list_head (test_case->test_result_list_);
     211             245 :         while (it != INITPTR) {
     212              81 :                 next_it = dl_list_next (it);
     213              81 :                 tr = dl_list_data (it);
     214              81 :                 tr_remove (it);
     215              81 :                 DELETE (tr);
     216              81 :                 it = next_it;
     217                 :         }
     218              82 :         dl_list_free (&test_case->test_result_list_);
     219              82 :         DELETE (test_case);
     220                 : 
     221                 : 
     222              82 :         pthread_mutex_unlock (&TC_MUTEX);
     223              82 : }
     224                 : 
     225                 : /* ------------------------------------------------------------------------- */
     226                 : 
     227                 : /** Gets ID value of specific Test Case data item
     228                 :  *  @param tc_data_item pointer to Test Case data item.
     229                 :  *  @return positive integer value of ID, or -1 if get ID failed.
     230                 :  *
     231                 :  *  Possible errors:
     232                 :  *  -1 if Test Case data item not exists.
     233                 :  */
     234                 : int tc_get_id (DLListIterator tc_data_item)
     235            1444 : {
     236            1444 :         pthread_mutex_lock (&TC_MUTEX);
     237                 : 
     238                 :         int             tc_id;
     239                 :         test_case_s    *test_case;
     240                 : 
     241            1444 :         test_case = (test_case_s *) dl_list_data (tc_data_item);
     242                 : 
     243            2887 :         if ((test_case != INITPTR) && (test_case != NULL))
     244            1443 :                 tc_id = test_case->tc_id_;
     245                 :         else
     246               1 :                 tc_id = -1;
     247                 : 
     248            1444 :         pthread_mutex_unlock (&TC_MUTEX);
     249                 : 
     250            1444 :         return tc_id;
     251                 : }
     252                 : 
     253                 : /* ------------------------------------------------------------------------- */
     254                 : 
     255                 : /** Gets the external ID value of specific Test Case data item
     256                 :  *  @param tc_data_item pointer to Test Case data item.
     257                 :  *  @return positive integer value of ID, or -1 if get ID failed.
     258                 :  *
     259                 :  *  Possible errors:
     260                 :  *  -1 if Test Case data item not exists.
     261                 :  */
     262                 : int tc_get_ext_id (DLListIterator tc_data_item)
     263             201 : {
     264             201 :         pthread_mutex_lock (&TC_MUTEX);
     265                 : 
     266                 :         int             tc_id;
     267                 :         test_case_s    *test_case;
     268                 : 
     269             201 :         test_case = (test_case_s *) dl_list_data (tc_data_item);
     270                 : 
     271             402 :         if ((test_case != INITPTR) && (test_case != NULL))
     272             201 :                 tc_id = test_case->tc_ext_id_;
     273                 :         else
     274               0 :                 tc_id = -1;
     275                 : 
     276             201 :         pthread_mutex_unlock (&TC_MUTEX);
     277                 : 
     278             201 :         return tc_id;
     279                 : }
     280                 : 
     281                 : /* ------------------------------------------------------------------------- */
     282                 : 
     283                 : /** Gets run ID value of specific Test Case data item
     284                 :  *  @param tc_data_item pointer to Test Case data item.
     285                 :  *  @return positive integer value of ID, or -1 if get ID failed.
     286                 :  *
     287                 :  *  Possible errors:
     288                 :  *  -1 if Test Case data item not exists.
     289                 :  */
     290                 : long tc_get_run_id (DLListIterator tc_data_item)
     291             238 : {
     292             238 :         pthread_mutex_lock (&TC_MUTEX);
     293                 : 
     294                 :         long             run_id;
     295                 :         test_case_s    *test_case;
     296                 : 
     297             238 :         test_case = (test_case_s *) dl_list_data (tc_data_item);
     298                 : 
     299             476 :         if ((test_case != INITPTR) && (test_case != NULL))
     300             238 :                 run_id = test_case->tc_run_id_;
     301                 :         else
     302               0 :                 run_id = -1;
     303                 : 
     304             238 :         pthread_mutex_unlock (&TC_MUTEX);
     305                 : 
     306             238 :         return run_id;
     307                 : }
     308                 : 
     309                 : /* ------------------------------------------------------------------------- */
     310                 : 
     311                 : /** Gets group ID value of specific Test Case data item
     312                 :  *  @param tc_data_item pointer to Test Case data item.
     313                 :  *  @return positive integer value of group ID,
     314                 :  *          or -1 if get group ID failed.
     315                 :  *
     316                 :  *  Possible errors:
     317                 :  *  -1 if Test Case data item not exists.
     318                 :  */
     319                 : int tc_get_group_id (DLListIterator tc_data_item)
     320             802 : {
     321             802 :         pthread_mutex_lock (&TC_MUTEX);
     322                 : 
     323                 :         int             tc_group_id;
     324                 :         test_case_s    *test_case;
     325                 : 
     326             802 :         test_case = (test_case_s *) dl_list_data (tc_data_item);
     327                 : 
     328            1603 :         if ((test_case != INITPTR) && (test_case != NULL))
     329             801 :                 tc_group_id = test_case->tc_group_id_;
     330                 :         else
     331               1 :                 tc_group_id = -1;
     332                 : 
     333             802 :         pthread_mutex_unlock (&TC_MUTEX);
     334                 : 
     335             802 :         return tc_group_id;
     336                 : }
     337                 : 
     338                 : /* ------------------------------------------------------------------------- */
     339                 : 
     340                 : /** Gets Test Case title string and copying it to
     341                 :  *  given title string parameter
     342                 :  *  @param tc_data_item pointer to Test Case data item.
     343                 :  *  @param title_string title string parameter where will be copied title.
     344                 :  *  @return 1 value if title string copied complete,
     345                 :  *          or -1 if get title operation failed.
     346                 :  *
     347                 :  *  Possible errors:
     348                 :  *  -1 if Test Case data item not exists.
     349                 :  */
     350                 : int tc_get_title (DLListIterator tc_data_item, title_string_t title_string)
     351             108 : {
     352             108 :         pthread_mutex_lock (&TC_MUTEX);
     353                 : 
     354                 :         int             result;
     355                 :         test_case_s    *test_case =
     356             108 :             (test_case_s *) dl_list_data (tc_data_item);
     357                 : 
     358             215 :         if ((test_case != INITPTR) && (test_case != NULL)) {
     359             107 :                 STRCPY (title_string, test_case->title_,
     360                 :                         strlen (test_case->title_) + 1);
     361             107 :                 result = 1;
     362                 :         } else {
     363                 :                 /* Something failed, so will returned error value -1 */
     364               1 :                 result = -1;
     365                 :         }
     366                 : 
     367             108 :         pthread_mutex_unlock (&TC_MUTEX);
     368                 : 
     369             108 :         return result;
     370                 : }
     371                 : 
     372                 : /* ------------------------------------------------------------------------- */
     373                 : 
     374                 : /** Gets Test Case status value
     375                 :  *  @param tc_data_item pointer to Test Case data item.
     376                 :  *  @return status integer value,
     377                 :  *          or -1 if get status operation failed.
     378                 :  *
     379                 :  *  Possible errors:
     380                 :  *  -1 if Test Case data item not exists.
     381                 :  */
     382                 : int tc_get_status (DLListIterator tc_data_item)
     383            2431 : {
     384            2431 :         pthread_mutex_lock (&TC_MUTEX);
     385                 : 
     386                 :         /* If Test Case status data not available then error value -1 */
     387            2431 :         int             tc_status = -1;
     388                 :         test_case_s    *test_case =
     389            2431 :             (test_case_s *) dl_list_data (tc_data_item);
     390                 : 
     391            2431 :         if ((test_case != INITPTR) && (test_case != NULL))
     392            2429 :                 tc_status = test_case->status_;
     393                 : 
     394            2431 :         pthread_mutex_unlock (&TC_MUTEX);
     395                 : 
     396            2431 :         return tc_status;
     397                 : }
     398                 : 
     399                 : /* ------------------------------------------------------------------------- */
     400                 : 
     401                 : /** Gets Test Case config filename string and
     402                 :  *  copying it to given title string parameter
     403                 :  *  @param tc_data_item pointer to Test Case data item.
     404                 :  *  @param tc_cfg_filename filename string where data will be copied
     405                 :  */
     406                 : void tc_get_cfg_filename (DLListIterator tc_data_item,
     407                 :                           filename_t tc_cfg_filename)
     408             898 : {
     409             898 :         pthread_mutex_lock (&TC_MUTEX);
     410                 : 
     411                 :         test_case_s    *test_case =
     412             898 :             (test_case_s *) dl_list_data (tc_data_item);
     413                 : 
     414             898 :         if ((test_case != INITPTR) && (test_case != NULL)) {
     415             898 :                 STRCPY (tc_cfg_filename, test_case->tc_cfg_filename_,
     416                 :                         strlen (test_case->tc_cfg_filename_) + 1);
     417                 :         }
     418                 : 
     419             898 :         pthread_mutex_unlock (&TC_MUTEX);
     420             898 : }
     421                 : 
     422                 : /* ------------------------------------------------------------------------- */
     423                 : 
     424                 : /** Gets Test Result list pointer according to Test Case data item
     425                 :  *  @param tc_data_item pointer to Test Case data item.
     426                 :  *  @return pointer to Test Result linked list,
     427                 :  *          or -1 if get status operation failed.
     428                 :  *
     429                 :  *  Possible errors:
     430                 :  *  INITPTR if Test Case data item not exists.
     431                 :  */
     432                 : DLList         *tc_get_tr_list (DLListIterator tc_data_item)
     433             575 : {
     434             575 :         pthread_mutex_lock (&TC_MUTEX);
     435                 : 
     436             575 :         DLList         *test_result_list = INITPTR;
     437                 :         test_case_s    *test_case =
     438             575 :             (test_case_s *) dl_list_data (tc_data_item);
     439                 : 
     440             575 :         if ((test_case != INITPTR) && (test_case != NULL))
     441             573 :                 test_result_list = test_case->test_result_list_;
     442                 : 
     443             575 :         pthread_mutex_unlock (&TC_MUTEX);
     444                 : 
     445             575 :         return test_result_list;
     446                 : }
     447                 : 
     448                 : /* ------------------------------------------------------------------------- */
     449                 : 
     450                 : /** Gets Test Result priority value
     451                 :  *  @param tc_data_item pointer to Test Case data item.
     452                 :  *  @return positive integer priority value,
     453                 :  *          or -1 if get priority operation failed.
     454                 :  *
     455                 :  *  Possible errors:
     456                 :  *  -1 if Test Case data item not exists.
     457                 :  */
     458                 : int tc_get_priority (DLListIterator tc_data_item)
     459             108 : {
     460             108 :         pthread_mutex_lock (&TC_MUTEX);
     461                 : 
     462                 :         /* If Test Case priority value not available then returns error -1 */
     463             108 :         int             priority = -1;
     464                 :         test_case_s    *test_case =
     465             108 :             (test_case_s *) dl_list_data (tc_data_item);
     466                 : 
     467             108 :         if ((test_case != INITPTR) && (test_case != NULL))
     468             107 :                 priority = test_case->priority_;
     469                 : 
     470             108 :         pthread_mutex_unlock (&TC_MUTEX);
     471                 : 
     472             108 :         return priority;
     473                 : }
     474                 : 
     475                 : /* ------------------------------------------------------------------------- */
     476                 : 
     477                 : /** Gets Test Module Info data iten pointer according to Test Case data item
     478                 :  *  @param tc_data_item pointer to Test Case data item.
     479                 :  *  @return pointer to Test Module Info data item,
     480                 :  *          or INITPTR if get data pointer operation failed.
     481                 :  *
     482                 :  *  Possible errors:
     483                 :  *  INITPTR if Test Case data item not exists.
     484                 :  */
     485                 : DLListIterator tc_get_test_module_ptr (DLListIterator tc_data_item)
     486             467 : {
     487             467 :         pthread_mutex_lock (&TC_MUTEX);
     488                 : 
     489             467 :         DLListIterator  tm_data_item = INITPTR;
     490                 :         test_case_s    *test_case =
     491             467 :             (test_case_s *) dl_list_data (tc_data_item);
     492                 : 
     493             467 :         if ((test_case != INITPTR) && (test_case != NULL))
     494             466 :                 tm_data_item = test_case->tm_data_item_;
     495                 : 
     496             467 :         pthread_mutex_unlock (&TC_MUTEX);
     497                 : 
     498             467 :         return tm_data_item;
     499                 : }
     500                 : 
     501                 : /* ------------------------------------------------------------------------- */
     502                 : 
     503                 : /** Sets Test Case ID value
     504                 :  *  @param tc_data_item pointer to Test Case data item.
     505                 :  *  @param test_case_id integer value of Test Case ID.
     506                 :  */
     507                 : void tc_set_id (DLListIterator tc_data_item, int test_case_id)
     508             711 : {
     509             711 :         pthread_mutex_lock (&TC_MUTEX);
     510                 : 
     511                 :         test_case_s    *test_case =
     512             711 :             (test_case_s *) dl_list_data (tc_data_item);
     513                 : 
     514             711 :         if ((test_case != INITPTR) && (test_case != NULL))
     515             711 :                 test_case->tc_id_ = test_case_id;
     516                 : 
     517             711 :         pthread_mutex_unlock (&TC_MUTEX);
     518             711 : }
     519                 : 
     520                 : /* ------------------------------------------------------------------------- */
     521                 : 
     522                 : /** Sets Test Case run ID value
     523                 :  *  @param tc_data_item pointer to Test Case data item.
     524                 :  *  @param run_id integer value of Test Case ryb ID.
     525                 :  */
     526                 : void tc_set_run_id (DLListIterator tc_data_item, long run_id)
     527              95 : {
     528              95 :         pthread_mutex_lock (&TC_MUTEX);
     529                 : 
     530                 :         test_case_s    *test_case =
     531              95 :             (test_case_s *) dl_list_data (tc_data_item);
     532                 : 
     533              95 :         if ((test_case != INITPTR) && (test_case != NULL))
     534              95 :                 test_case->tc_run_id_ = run_id;
     535                 : 
     536              95 :         pthread_mutex_unlock (&TC_MUTEX);
     537              95 : }
     538                 : 
     539                 : 
     540                 : /* ------------------------------------------------------------------------- */
     541                 : 
     542                 : /** Sets Test Case group ID value
     543                 :  *  @param tc_data_item pointer to Test Case data item.
     544                 :  *  @param group_id integer value of Test Case group ID.
     545                 :  */
     546                 : void tc_set_group_id (DLListIterator tc_data_item, int group_id)
     547             108 : {
     548             108 :         pthread_mutex_lock (&TC_MUTEX);
     549                 : 
     550                 :         test_case_s    *test_case =
     551             108 :             (test_case_s *) dl_list_data (tc_data_item);
     552                 : 
     553             108 :         if ((test_case != INITPTR) && (test_case != NULL))
     554             108 :                 test_case->tc_group_id_ = group_id;
     555                 : 
     556             108 :         pthread_mutex_unlock (&TC_MUTEX);
     557             108 : }
     558                 : 
     559                 : /* ------------------------------------------------------------------------- */
     560                 : 
     561                 : /** Sets Test Case status value
     562                 :  *  @param tc_data_item pointer to Test Case data item.
     563                 :  *  @param status integer value of Test Case status.
     564                 :  */
     565                 : void tc_set_status (DLListIterator tc_data_item, int status)
     566             186 : {
     567             186 :         pthread_mutex_lock (&TC_MUTEX);
     568                 : 
     569                 :         test_case_s    *test_case =
     570             186 :             (test_case_s *) dl_list_data (tc_data_item);
     571                 : 
     572             186 :         if ((test_case != INITPTR) && (test_case != NULL))
     573             186 :                 test_case->status_ = status;
     574                 : 
     575             186 :         pthread_mutex_unlock (&TC_MUTEX);
     576             186 : }
     577                 : 
     578                 : /* ------------------------------------------------------------------------- */
     579                 : 
     580                 : /** Sets Test Case config filename string
     581                 :  *  @param tc_data_item pointer to Test Case data item.
     582                 :  *  @param tc_cfg_filename new Test Case config filename string.
     583                 :  */
     584                 : void tc_set_cfg_filename (DLListIterator tc_data_item,
     585                 :                           filename_t tc_cfg_filename)
     586               1 : {
     587               1 :         pthread_mutex_lock (&TC_MUTEX);
     588                 : 
     589                 :         test_case_s    *test_case =
     590               1 :             (test_case_s *) dl_list_data (tc_data_item);
     591                 : 
     592               1 :         if ((test_case != INITPTR) &&
     593                 :             (test_case != NULL) &&
     594                 :             (strlen (tc_cfg_filename) < MaxFileName + 1)) {
     595               1 :                 STRCPY (test_case->tc_cfg_filename_, tc_cfg_filename,
     596                 :                         strlen (tc_cfg_filename) + 1);
     597                 : 
     598                 :         }
     599                 : 
     600               1 :         pthread_mutex_unlock (&TC_MUTEX);
     601               1 : }
     602                 : 
     603                 : /* ------------------------------------------------------------------------- */
     604                 : 
     605                 : /** Sets Test Case priority value
     606                 :  *  @param tc_data_item pointer to Test Case data item.
     607                 :  *  @param priority integer value of Test Case priority.
     608                 :  */
     609                 : void tc_set_priority (DLListIterator tc_data_item, int priority)
     610             108 : {
     611             108 :         pthread_mutex_lock (&TC_MUTEX);
     612                 : 
     613                 :         test_case_s    *test_case =
     614             108 :             (test_case_s *) dl_list_data (tc_data_item);
     615                 : 
     616             108 :         if ((test_case != INITPTR) && (test_case != NULL))
     617             107 :                 test_case->priority_ = priority;
     618                 : 
     619             108 :         pthread_mutex_unlock (&TC_MUTEX);
     620             108 : }
     621                 : 
     622                 : /* ------------------------------------------------------------------------- */
     623                 : 
     624                 : /** Sets Test Result list pointer for Test Case data item
     625                 :  *  @param tc_data_item pointer to Test Case data item.
     626                 :  *  @param test_result_list pointer to linked list of Test Result list.
     627                 :  */
     628                 : void tc_set_tr_list (DLListIterator tc_data_item, DLList * test_result_list)
     629               3 : {
     630               3 :         pthread_mutex_lock (&TC_MUTEX);
     631                 : 
     632                 :         test_case_s    *test_case =
     633               3 :             (test_case_s *) dl_list_data (tc_data_item);
     634                 : 
     635               3 :         if ((test_case != INITPTR) && (test_case != NULL))
     636               3 :                 test_case->test_result_list_ = test_result_list;
     637                 : 
     638               3 :         pthread_mutex_unlock (&TC_MUTEX);
     639               3 : }
     640                 : 
     641                 : /* ------------------------------------------------------------------------- */
     642                 : 
     643                 : /** Sets Test Module Info data item pointer for Test Case data item
     644                 :  *  @param tc_data_item pointer to Test Case data item.
     645                 :  *  @param tm_data_item pointer to setting Test Module Info data item.
     646                 :  */
     647                 : void tc_set_test_module_ptr (DLListIterator tc_data_item,
     648                 :                              DLListIterator tm_data_item)
     649               3 : {
     650               3 :         pthread_mutex_lock (&TC_MUTEX);
     651                 : 
     652                 :         test_case_s    *test_case =
     653               3 :             (test_case_s *) dl_list_data (tc_data_item);
     654                 : 
     655               3 :         if ((test_case != INITPTR) && (test_case != NULL))
     656               3 :                 test_case->tm_data_item_ = tm_data_item;
     657                 : 
     658               3 :         pthread_mutex_unlock (&TC_MUTEX);
     659               3 : }
     660                 : 
     661                 : /* ------------------------------------------------------------------------- */
     662                 : 
     663                 : /* ================= OTHER EXPORTED FUNCTIONS ============================== */
     664                 : /* None */
     665                 : 
     666                 : /* ================= TESTS FOR LOCAL FUNCTIONS ============================= */
     667                 : /* None */
     668                 : 
     669                 : /* ========================================================================= */
     670                 : /* End of file */

Generated by: LTP GCOV extension version 1.6