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

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 tests/tcg/mips64/test_mips64r6_logic.c | 50 ++++++++++++++++++++++++++
 tests/tcg/mips64/meson.build           |  5 +--
 2 files changed, 51 insertions(+), 4 deletions(-)
 create mode 100644 tests/tcg/mips64/test_mips64r6_logic.c

diff --git a/tests/tcg/mips64/test_mips64r6_logic.c 
b/tests/tcg/mips64/test_mips64r6_logic.c
new file mode 100644
index 000000000000..7b8784f42430
--- /dev/null
+++ b/tests/tcg/mips64/test_mips64r6_logic.c
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* MIPS64R6 tests: logical */
+
+#define main test_mips64r6_and
+#include "test_mips64r6_and.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_nor
+#include "test_mips64r6_nor.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_or
+#include "test_mips64r6_or.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_xor
+#include "test_mips64r6_xor.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+static const struct {
+    const char *name;
+    int32_t (*fn)(void);
+} r6_tests[] = {
+    { "and", test_mips64r6_and },
+    { "nor", test_mips64r6_nor },
+    { "or", test_mips64r6_or },
+    { "xor", test_mips64r6_xor },
+};
+
+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 logical %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 0601ed52ab21..657a1c4d5cc9 100644
--- a/tests/tcg/mips64/meson.build
+++ b/tests/tcg/mips64/meson.build
@@ -30,7 +30,7 @@ tests = []
 tests_mips64r6 = [
   '../mips64/test_mips64r6_bitops.c',
   '../mips64/test_mips64r6_crc.c',
-  '../mips64/test_mips64r6_and.c',
+  '../mips64/test_mips64r6_logic.c',
   '../mips64/test_mips64r6_dmuh.c',
   '../mips64/test_mips64r6_dmuhu.c',
   '../mips64/test_mips64r6_dmul.c',
@@ -42,12 +42,9 @@ tests_mips64r6 = [
   '../mips64/test_mips64r6_muhu.c',
   '../mips64/test_mips64r6_mul.c',
   '../mips64/test_mips64r6_mulu.c',
-  '../mips64/test_mips64r6_nor.c',
-  '../mips64/test_mips64r6_or.c',
   '../mips64/test_mips64r6_sllv.c',
   '../mips64/test_mips64r6_srav.c',
   '../mips64/test_mips64r6_srlv.c',
-  '../mips64/test_mips64r6_xor.c',
 ]
 
 foreach src: tests_mips64r6
-- 
2.55.0


Reply via email to