Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sanitize the use of logs in unit testing of parmap to fix supernovae
[simgrid.git] / tools / tesh2 / include / unit.h
1 /*\r
2  * include/unit.h - type representing the tesh unit concept.\r
3  *\r
4  * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved. \r
5  *\r
6  * This program is free software; you can redistribute it and/or modify it \r
7  * under the terms of the license (GNU LGPL) which comes with this package.\r
8  *\r
9  * Purpose:\r
10  *              This file contains all the declarations of the functions related with\r
11  *              the tesh unit concept.\r
12  *\r
13  */  \r
14     \r
15 #ifndef __UNIT_H        \r
16 #define __UNIT_H\r
17     \r
18 #include <com.h>\r
19     \r
20 #ifdef __cplusplus\r
21 extern "C" {
22   \r
23 #endif  /* \r */
24   \r
25 /*! \brief unit_new - create a new unit.\r
26  *\r
27  * \param runner        The runner which runs the unit.\r
28  * \param owner         The unit which owns the unit if it is an included unit.\r
29  * \param fstream       The file stream object used to parse the unit.\r
30  *\r
31  * \return                      If successful the function returns the newly created\r
32  *                                      unit. Otherwise the function returns NULL and sets the\r
33  *                                      global variable errno with the appropiate error code.\r
34  *\r
35  * errors :\r
36  *                                      [EINVAL] if one of the parameters is invalid.\r
37  *                                      [ENOMEM] if the system has not enough space to allocate\r
38  *                                               the unit.\r
39  */ \r
40   unit_t \r
41       unit_new(runner_t runner, unit_t root, unit_t owner,
42                fstream_t fstream);
43   \r \r
44 /*! \brief unit_free - destroy a tesh unit.\r
45  *\r
46  * \param ptr           A pointer to the unit to destroy.\r
47  *\r
48  * \return                      If successful the function returns 0. Otherwise the \r
49  *                                      function returns -1 and sets the global variable errno \r
50  *                                      with the appropiate error code.\r
51  *\r
52  * errors :\r
53  *                                      [EINVAL] if the pointer to the unit to destroy is invalid.\r
54  */ \r
55   int \r unit_free(unit_t * ptr);
56   \r \r
57 /*! \brief unit_run - run a tesh unit.\r
58  *\r
59  * \param unit          The unit to run.\r
60  * \param mutex         A mutex used to synchronize the access of the runner properties.\r
61  *\r
62  * \return                      If successful the function returns 0. Otherwise the \r
63  *                                      function returns -1 and sets the global variable errno \r
64  *                                      with the appropiate error code.\r
65  *\r
66  * errors :\r
67  *                                      [EINVAL] if the unit specified as parameter is invalid.\r
68  *                                               if the mutex specified as parameter is invalid.\r
69  *\r
70  * remarks :            If the runner is interrupted during a call of this function,\r
71  *                                      the unit is not launched but its flag interrupted is signaled.\r
72  */ \r
73   int \r unit_run(unit_t unit, xbt_os_mutex_t mutex);
74   \r \r \r
75 /*! \brief unit_interrupt - interrupt a tesh unit.\r
76  *\r
77  * \param unit          The unit to interrupt.\r
78  *\r
79  * \return                      If successful the function returns 0. Otherwise the \r
80  *                                      function returns -1 and sets the global variable errno \r
81  *                                      with the appropiate error code.\r
82  *\r
83  * errors :\r
84  *                                      [EINVAL] if the unit specified as parameter is invalid.\r
85  *                                      [EALREADY] if the unit is already interrupted.\r
86  *\r
87  * remarks :            If the runner is interrupted during a call of this function,\r
88  *                                      the unit is not launched but its flag interrupted is signaled.\r
89  */ \r
90   int \r unit_interrupt(unit_t unit);
91   \r \r
92 /*! \brief unit_summuarize - summarize the run of tesh unit.\r
93  *\r
94  * \param unit          The unit to summarize the run.\r
95  *\r
96  * \return                      If successful the function returns 0. Otherwise the \r
97  *                                      function returns -1 and sets the global variable errno \r
98  *                                      with the appropiate error code.\r
99  *\r
100  * errors :\r
101  *                                      [EINVAL] if the unit specified as parameter is invalid.\r
102  */ \r
103   int \r unit_summuarize(unit_t unit);
104   \r \r int \r unit_reset(unit_t unit);
105   \r \r void \r
106       unit_set_error(unit_t unit, int errcode, int kind, const char *line);
107   \r\r
108 #ifdef __cplusplus\r
109\r
110 #endif  /* \r */
111 \r\r
112 #endif  /* !__UNIT_H */\r