void Test::__run() { LOG("[ RUN ] %s.%s", name(), method()); SetUp(); TestContext &ctx = TestContext::getInstance(); ctx.setTest(name(), method()); StopWatch stopwatch; stopwatch.start(); __test(); stopwatch.stop(); int ms = stopwatch.getTimeMillisecond(); passCount_ = ctx.successCount(); failCount_ = ctx.failCount(); if(fail() == 0) { LOG("[ OK ] %s.%s (%d ms)", name(), method(), ms); } else { LOG("[ FAILED ] %s.%s (%d ms)", name(), method(), ms); } TearDown(); }
static void __init test_basic(void) { /* Work around annoying "warning: zero-length gnu_printf format string". */ char nul = '\0'; test("", &nul); test("100%", "100%%"); test("xxx%yyy", "xxx%cyyy", '%'); __test("xxx\0yyy", 7, "xxx%cyyy", '\0'); }
void test( void ) { __test(); }
static void select_procs(void) { static size_t size = 0; PROCTAB* ptp; proc_t* task; size_t match; char* cmd_arg0; char* cmd_arg0_base; char* cmd_arg1; char* cmd_arg1_base; char* program_base; char* root_link; char* exe_link; char* exe_link_base; program_base = basename(program); /* get the input base name */ ptp = openproc(PROC_FILLCOM | PROC_FILLSTAT); while ((task = readproc(ptp, NULL))) { if (epidof_root) { /* get the /proc/<pid>/root symlink value */ root_link = pid_link(task->XXXID, "root"); match = !strcmp(epidof_root, root_link); xfree(root_link); if (!match) /* root check failed */ { freeproc(task); continue; } } if (!is_omitted(task->XXXID) && task->cmdline) { cmd_arg0 = task->cmdline[0]; /* processes starting with '-' are login shells */ if (*cmd_arg0 == '-') cmd_arg0++; cmd_arg0_base = basename(cmd_arg0); /* get the argv0 basename */ exe_link = pid_link(task->XXXID, "exe"); /* get the /proc/<pid>/exe symlink value */ exe_link_base = basename(exe_link); /* get the exe_link basename */ match = 0; #define __test(p, c) (!strcmp(p, c##_base) || !strcmp(p, c) || !strcmp(p##_base, c)) if (__test(program, cmd_arg0) || __test(program, exe_link)) match = 1; else if (opt_scripts_too && task->cmdline[1]) { cmd_arg1 = task->cmdline[1]; cmd_arg1_base = basename(cmd_arg1); /* if script, then task->cmd = argv1, otherwise task->cmd = argv0 */ if (task->cmd && !strncmp(task->cmd, cmd_arg1_base, strlen(task->cmd)) && __test(program, cmd_arg1)) match = 1; } #undef __test xfree(exe_link); if (match && environment_test(task->XXXID, *argv)) { if (proc_count == size) procs = xrealloc(procs, __grow(size) * sizeof(*procs)); procs[proc_count++] = task->XXXID; } } freeproc(task); } closeproc(ptp); }
void mymod_init() { __test(); }