Update unit test framework to build with libtool and show test name in debug log.

This commit is contained in:
brectanus
2008-02-08 21:33:21 +00:00
parent 45e85e4c89
commit 96b3ea6f21
3 changed files with 32 additions and 14 deletions

View File

@@ -25,6 +25,7 @@
#define RESULT_WRONGRET -4
/* Globals */
static char *test_name = NULL;
static apr_pool_t *g_mp = NULL;
static modsec_rec *g_msr = NULL;
msc_engine *modsecurity = NULL;
@@ -66,7 +67,7 @@ void msr_log(modsec_rec *msr, int level, const char *text, ...) {
if (msr->txcfg->debuglog_fd != NULL) {
apr_size_t nbytes_written = 0;
apr_vsnprintf(str1, sizeof(str1), text, ap);
apr_snprintf(str2, sizeof(str2), "[%d] %s\n", level, str1);
apr_snprintf(str2, sizeof(str2), "[%d] [%s] %s\n", level, test_name, str1);
apr_file_write_full(msr->txcfg->debuglog_fd, str2, strlen(str2), &nbytes_written);
}
@@ -366,6 +367,8 @@ int main(int argc, const char * const argv[])
returnval = argv[4];
}
test_name = apr_psprintf(g_mp, "%s/%s", type, name);
if (apr_file_open_stdin(&fd, g_mp) != APR_SUCCESS) {
fprintf(stderr, "Failed to open stdin\n");
exit(1);