Changeset 4b54bd9 in mainline for uspace/lib/pcut/src/os/generic.c
- Timestamp:
- 2018-09-12T13:23:03Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3da0ee4
- Parents:
- 275530a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/os/generic.c
r275530a4 r4b54bd9 31 31 * Platform-dependent test execution function when system() is available. 32 32 */ 33 33 #pragma warning(push, 0) 34 34 #include <stdlib.h> 35 35 #include <stdio.h> … … 38 38 #include <assert.h> 39 39 #include <string.h> 40 #pragma warning(pop) 41 40 42 #include "../internal.h" 41 43 … … 55 57 56 58 #define FORMAT_COMMAND(buffer, buffer_size, self_path, test_id, temp_file) \ 57 snprintf(buffer, buffer_size, "\"\"%s\" -t%d >%s\"", self_path, test_id, temp_file)59 pcut_snprintf(buffer, buffer_size, "\"\"%s\" -t%d >%s\"", self_path, test_id, temp_file) 58 60 #define FORMAT_TEMP_FILENAME(buffer, buffer_size) \ 59 snprintf(buffer, buffer_size, "pcut_%d.tmp", _getpid())61 pcut_snprintf(buffer, buffer_size, "pcut_%d.tmp", _getpid()) 60 62 61 63 #elif defined(__unix) … … 63 65 64 66 #define FORMAT_COMMAND(buffer, buffer_size, self_path, test_id, temp_file) \ 65 snprintf(buffer, buffer_size, "%s -t%d &>%s", self_path, test_id, temp_file)67 pcut_snprintf(buffer, buffer_size, "%s -t%d &>%s", self_path, test_id, temp_file) 66 68 #define FORMAT_TEMP_FILENAME(buffer, buffer_size) \ 67 snprintf(buffer, buffer_size, "pcut_%d.tmp", getpid())69 pcut_snprintf(buffer, buffer_size, "pcut_%d.tmp", getpid()) 68 70 69 71 #else … … 81 83 * @param test Test that is about to start. 82 84 */ 83 static void before_test_start(pcut_item_t *test) 84 { 85 static void before_test_start(pcut_item_t *test) { 85 86 pcut_report_test_start(test); 86 87 … … 94 95 * @return Test outcome code. 95 96 */ 96 static int convert_wait_status_to_outcome(int status) 97 { 97 static int convert_wait_status_to_outcome(int status) { 98 98 if (status < 0) { 99 99 return PCUT_OUTCOME_INTERNAL_ERROR; … … 110 110 * @param test Test to be run. 111 111 */ 112 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) 113 { 112 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) { 114 113 int rc, outcome; 115 114 FILE *tempfile; … … 121 120 FORMAT_TEMP_FILENAME(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1); 122 121 FORMAT_COMMAND(command, PCUT_COMMAND_LINE_BUFFER_SIZE - 1, 123 124 122 self_path, (test)->id, tempfile_name); 123 125 124 PCUT_DEBUG("Will execute <%s> (temp file <%s>) with system().", 126 125 command, tempfile_name); 127 126 128 127 rc = system(command); … … 147 146 } 148 147 149 void pcut_hook_before_test(pcut_item_t *test) 150 { 148 void pcut_hook_before_test(pcut_item_t *test) { 151 149 PCUT_UNUSED(test); 152 150
Note:
See TracChangeset
for help on using the changeset viewer.