159
159
/* Check that a fatal message is also stored in the __nih_abort_msg
162
if (&__nih_abort_msg) {
163
TEST_FEATURE ("with fatal message");
165
__nih_abort_msg = NULL;
166
last_priority = NIH_LOG_UNKNOWN;
169
ret = nih_log_message (NIH_LOG_FATAL,
170
"message with %s %d formatting",
174
TEST_EQ (last_priority, NIH_LOG_FATAL);
175
TEST_EQ_STR (last_message, "message with some 20 formatting");
177
TEST_NE_P (__nih_abort_msg, NULL);
178
TEST_ALLOC_PARENT (__nih_abort_msg, NULL);
179
TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting");
185
/* Check that a fatal message can safely overwrite one already stored
186
* in the __nih_abort_msg variable.
188
TEST_FEATURE ("with second fatal message");
191
msg = nih_strdup (NULL, "test");
194
__nih_abort_msg = msg;
197
last_priority = NIH_LOG_UNKNOWN;
200
ret = nih_log_message (NIH_LOG_FATAL,
201
"message with %s %d formatting",
205
TEST_EQ (last_priority, NIH_LOG_FATAL);
206
TEST_EQ_STR (last_message, "message with some 20 formatting");
210
TEST_NE_P (__nih_abort_msg, NULL);
211
TEST_ALLOC_PARENT (__nih_abort_msg, NULL);
212
TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting");
217
printf ("SKIP: __nih_abort_msg not available\n");
162
TEST_FEATURE ("with fatal message");
164
__nih_abort_msg = NULL;
165
last_priority = NIH_LOG_UNKNOWN;
168
ret = nih_log_message (NIH_LOG_FATAL,
169
"message with %s %d formatting",
173
TEST_EQ (last_priority, NIH_LOG_FATAL);
174
TEST_EQ_STR (last_message, "message with some 20 formatting");
176
TEST_NE_P (__nih_abort_msg, NULL);
177
TEST_ALLOC_PARENT (__nih_abort_msg, NULL);
178
TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting");
184
/* Check that a fatal message can safely overwrite one already stored
185
* in the __nih_abort_msg variable.
187
TEST_FEATURE ("with second fatal message");
190
msg = nih_strdup (NULL, "test");
193
__nih_abort_msg = msg;
196
last_priority = NIH_LOG_UNKNOWN;
199
ret = nih_log_message (NIH_LOG_FATAL,
200
"message with %s %d formatting",
204
TEST_EQ (last_priority, NIH_LOG_FATAL);
205
TEST_EQ_STR (last_message, "message with some 20 formatting");
209
TEST_NE_P (__nih_abort_msg, NULL);
210
TEST_ALLOC_PARENT (__nih_abort_msg, NULL);
211
TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting");
221
216
/* Check that the nih_debug macro wraps the call properly and
222
217
* includes the function in which the message occurred.