aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-07-27 11:57:16 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-27 12:27:12 +0200
commitb940145c67dbb2114bc231a36a4549de315504a9 (patch)
tree5b2efd7a51b6faf896ea784a4b7da80fb49b4f1a /tests
parentd12be9ed70f55e918ec852d2d4097a8fbdd36cb9 (diff)
parent65c14801527068fcaf729eeffc142ffd4682a21a (diff)
downloadffmpeg-b940145c67dbb2114bc231a36a4549de315504a9.tar.gz
Merge commit '65c14801527068fcaf729eeffc142ffd4682a21a'
* commit '65c14801527068fcaf729eeffc142ffd4682a21a': checkasm: Modify report format Merged-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'tests')
-rw-r--r--tests/checkasm/checkasm.c57
-rw-r--r--tests/checkasm/checkasm.h2
-rw-r--r--tests/checkasm/h264qpel.c2
3 files changed, 30 insertions, 31 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index a54a75ea55..8b90fa5a3c 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -53,17 +53,20 @@
#endif
/* List of tests to invoke */
-static void (* const tests[])(void) = {
+static const struct {
+ const char *name;
+ void (*func)(void);
+} tests[] = {
#if CONFIG_BSWAPDSP
- checkasm_check_bswapdsp,
+ { "bswapdsp", checkasm_check_bswapdsp },
#endif
#if CONFIG_H264PRED
- checkasm_check_h264pred,
+ { "h264pred", checkasm_check_h264pred },
#endif
#if CONFIG_H264QPEL
- checkasm_check_h264qpel,
+ { "h264qpel", checkasm_check_h264qpel },
#endif
- NULL
+ { NULL }
};
/* List of cpu flags to check */
@@ -127,6 +130,7 @@ static struct {
CheckasmFunc *funcs;
CheckasmFunc *current_func;
CheckasmFuncVersion *current_func_ver;
+ const char *current_test_name;
const char *bench_pattern;
int bench_pattern_len;
int num_checked;
@@ -314,8 +318,10 @@ static void check_cpu_flag(const char *name, int flag)
int i;
state.cpu_flag_name = name;
- for (i = 0; tests[i]; i++)
- tests[i]();
+ for (i = 0; tests[i].func; i++) {
+ state.current_test_name = tests[i].name;
+ tests[i].func();
+ }
}
}
@@ -332,7 +338,7 @@ int main(int argc, char *argv[])
{
int i, seed, ret = 0;
- if (!tests[0] || !cpus[0].flag) {
+ if (!tests[0].func || !cpus[0].flag) {
fprintf(stderr, "checkasm: no tests to perform\n");
return 0;
}
@@ -464,19 +470,15 @@ void checkasm_report(const char *name, ...)
static int prev_checked, prev_failed, max_length;
if (state.num_checked > prev_checked) {
- print_cpu_name();
-
- if (*name) {
- int pad_length = max_length;
- va_list arg;
+ int pad_length = max_length + 4;
+ va_list arg;
- fprintf(stderr, " - ");
- va_start(arg, name);
- pad_length -= vfprintf(stderr, name, arg);
- va_end(arg);
- fprintf(stderr, "%*c", FFMAX(pad_length, 0) + 2, '[');
- } else
- fprintf(stderr, " - %-*s [", max_length, state.current_func->name);
+ print_cpu_name();
+ pad_length -= fprintf(stderr, " - %s.", state.current_test_name);
+ va_start(arg, name);
+ pad_length -= vfprintf(stderr, name, arg);
+ va_end(arg);
+ fprintf(stderr, "%*c", FFMAX(pad_length, 0) + 2, '[');
if (state.num_failed == prev_failed)
color_printf(COLOR_GREEN, "OK");
@@ -487,16 +489,13 @@ void checkasm_report(const char *name, ...)
prev_checked = state.num_checked;
prev_failed = state.num_failed;
} else if (!state.cpu_flag) {
- int length;
-
/* Calculate the amount of padding required to make the output vertically aligned */
- if (*name) {
- va_list arg;
- va_start(arg, name);
- length = vsnprintf(NULL, 0, name, arg);
- va_end(arg);
- } else
- length = strlen(state.current_func->name);
+ int length = strlen(state.current_test_name);
+ va_list arg;
+
+ va_start(arg, name);
+ length += vsnprintf(NULL, 0, name, arg);
+ va_end(arg);
if (length > max_length)
max_length = length;
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index aa81b44e94..fdec55e1c0 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -55,7 +55,7 @@ static av_unused intptr_t (*func_new)();
#define fail() checkasm_fail_func("%s:%d", av_basename(__FILE__), __LINE__)
/* Print the test outcome */
-#define report(...) checkasm_report("" __VA_ARGS__)
+#define report checkasm_report
/* Call the reference function */
#define call_ref(...) func_ref(__VA_ARGS__)
diff --git a/tests/checkasm/h264qpel.c b/tests/checkasm/h264qpel.c
index ec015a6a52..63b9a517a8 100644
--- a/tests/checkasm/h264qpel.c
+++ b/tests/checkasm/h264qpel.c
@@ -75,6 +75,6 @@ void checkasm_check_h264qpel(void)
}
}
}
- report("%s_h264_qpel", op_name);
+ report("%s", op_name);
}
}