43#if defined (_SC_CLK_TCK)
46static const float TICKS_PER_SEC = float (sysconf (_SC_CLK_TCK));
48#elif defined CLOCKS_PER_SEC
56static const float TICKS_PER_SEC = CLK_TCK;
61static const float TICKS_PER_SEC = 1000000UL;
69static const char*
const
92static const char*
const
95 "Program failed to compile.",
96 "Program failed to link.",
97 "Program executable not found.",
98 "Program not executable.",
99 "Program failed to execute.",
100 "Program generated no output.",
101 "Program reference output missing.",
103 "Program produced unexpected output.",
104 "Program produced output in unexpected format.",
105 "Arithmetic overflow.",
106 "System error occurred.",
107 "Process killed after a timeout.",
108 "Failed to kill process after a timeout."
116print_argv (
const char*
const argv[],
int newline)
120 const char*
const* parg = argv;
124 for (parg = argv; *parg; ++parg) {
126 const char *fmt =
"%s ";
128 if (strchr (*parg,
' '))
145print_header_plain (
const char*
const argv[])
149 puts (
"NAME STATUS WARN ASSERTS "
150 "FAILED PERCNT USER SYS REAL");
158print_header_verbose (
const char*
const argv[])
160 print_argv (argv, 1 );
169print_target_plain (
const struct target_opts *defaults)
171 const char*
const target_name =
get_target ();
175 printf (
"%-40.40s ", target_name);
186print_target_verbose (
const struct target_opts *defaults)
190 printf (
"%s ",
"Executing \"");
191 print_argv (defaults->
argv, 0 );
211static void print_status_plain (
const struct target_status* status)
213 unsigned valid_timing;
217 valid_timing = status->
usr_time != (clock_t)-1
225 else if (status->
exit)
233 if ( (
unsigned)-1 != status->
assert
235 && 0 == status->
exit) {
237 const int percnt = int ( 100.0
246 else if (valid_timing || status->
wall_time != (clock_t)-1)
252 (
float)status->
sys_time / TICKS_PER_SEC);
253 else if (status->
wall_time != (clock_t)-1)
269 unsigned valid_timing;
274 valid_timing = status->
usr_time != (clock_t)-1
279 printf (
" Status: %s\n", verbose_st_name [status->
status]);
283 printf (
" Exit status: %6d%s\n"
284 " Compiler warnings: %6u\n"
285 " Linker warnings: %6u\n"
286 " Runtime warnings: %6u\n",
287 status->
exit, 0 == status->
exit ?
" (success)" :
"",
294 printf (
" Failed assertions: %6u\n"
295 " Total assertions: %6u\n",
302 const float wall = (float)status->
wall_time / TICKS_PER_SEC;
303 const float user = (float)status->
usr_time / TICKS_PER_SEC;
304 const float sys = (float)status->
sys_time / TICKS_PER_SEC;
325 const float wall = (float)summary->
wall_time / TICKS_PER_SEC;
326 const float user = (float)summary->usr_time / TICKS_PER_SEC;
327 const float sys = (float)summary->sys_time / TICKS_PER_SEC;
329 printf (
"PROGRAM SUMMARY:\n"
331 " Non-zero exit status: %9d\n"
333 " Compiler warnings: %9u\n"
334 " Linker warnings: %9u\n"
335 " Runtime warnings: %9u\n",
343 if ((
unsigned)-1 != summary->assert) {
345 printf (
" Assertions: %9u\n"
346 " Failed assertions: %9u\n",
351 printf (
" Cumulative times:\n"
364 print_footer_plain (
count, summary);
void count(T, T, const U &,...)
IMPORT_C SInt32 printf(const Char *,...)
const char * get_target()
void(* print_status)(const struct target_status *)
void(* print_header)(const char *const[])
void(* print_footer)(int, const struct target_status *)
void set_output_format(enum OutputFmt format)
void(* print_target)(const struct target_opts *)
const char * get_signame(int signo)
enum ProcessStatus status