Build the 6 per-opcode shift tests as a single executable,
test_mips64r6_shift.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

All Release 6 tests now emit TAP: select it in the meson setup.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 tests/tcg/mips64/test_mips64r6_shift.c | 62 ++++++++++++++++++++++++++
 tests/tcg/mips64/meson.build           |  9 +---
 2 files changed, 64 insertions(+), 7 deletions(-)
 create mode 100644 tests/tcg/mips64/test_mips64r6_shift.c

diff --git a/tests/tcg/mips64/test_mips64r6_shift.c 
b/tests/tcg/mips64/test_mips64r6_shift.c
new file mode 100644
index 000000000000..a8734bebfd16
--- /dev/null
+++ b/tests/tcg/mips64/test_mips64r6_shift.c
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* MIPS64R6 tests: variable shift */
+
+#define main test_mips64r6_sllv
+#include "test_mips64r6_sllv.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_srav
+#include "test_mips64r6_srav.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_srlv
+#include "test_mips64r6_srlv.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_dsllv
+#include "test_mips64r6_dsllv.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_dsrav
+#include "test_mips64r6_dsrav.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_dsrlv
+#include "test_mips64r6_dsrlv.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+static const struct {
+    const char *name;
+    int32_t (*fn)(void);
+} r6_tests[] = {
+    { "sllv", test_mips64r6_sllv },
+    { "srav", test_mips64r6_srav },
+    { "srlv", test_mips64r6_srlv },
+    { "dsllv", test_mips64r6_dsllv },
+    { "dsrav", test_mips64r6_dsrav },
+    { "dsrlv", test_mips64r6_dsrlv },
+};
+
+int main(void)
+{
+    unsigned count = sizeof(r6_tests) / sizeof(r6_tests[0]);
+    int fail = 0;
+    unsigned i;
+
+    printf("TAP version 14\n1..%u\n", count);
+    for (i = 0; i < count; i++) {
+        int r = r6_tests[i].fn();
+
+        printf("%s %u - MIPS64R6 variable shift %s\n", r ? "not ok" : "ok", i 
+ 1,
+               r6_tests[i].name);
+        fail |= r;
+    }
+
+    return fail ? 1 : 0;
+}
diff --git a/tests/tcg/mips64/meson.build b/tests/tcg/mips64/meson.build
index d356689e54bf..894f8e9e23e1 100644
--- a/tests/tcg/mips64/meson.build
+++ b/tests/tcg/mips64/meson.build
@@ -32,16 +32,11 @@ tests_mips64r6 = [
   '../mips64/test_mips64r6_crc.c',
   '../mips64/test_mips64r6_logic.c',
   '../mips64/test_mips64r6_multiply.c',
-  '../mips64/test_mips64r6_dsllv.c',
-  '../mips64/test_mips64r6_dsrav.c',
-  '../mips64/test_mips64r6_dsrlv.c',
-  '../mips64/test_mips64r6_sllv.c',
-  '../mips64/test_mips64r6_srav.c',
-  '../mips64/test_mips64r6_srlv.c',
+  '../mips64/test_mips64r6_shift.c',
 ]
 
 foreach src: tests_mips64r6
-  tests += {src: {'cflags': '-march=mips64r6'}}
+  tests += {src: {'cflags': '-march=mips64r6', 'protocol': 'tap'}}
 endforeach
 
 foreach src: tests_mips_msa
-- 
2.55.0


Reply via email to