[Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests

Bastian Koppelmann posted 12 patches 7 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180501142222.19154-1-kbastian@mail.uni-paderborn.de
Test checkpatch failed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test s390x passed
There is a newer version of this series
hw/tricore/Makefile.objs                |   1 +
hw/tricore/tricore_testboard.c          |   8 ++
hw/tricore/tricore_testdevice.c         |  81 ++++++++++++++++++++
include/hw/tricore/tricore_testdevice.h |  38 ++++++++++
tests/tcg/tricore/Makefile              |  41 ++++++++++
tests/tcg/tricore/link.ld               |  60 +++++++++++++++
tests/tcg/tricore/macros.h              | 129 ++++++++++++++++++++++++++++++++
tests/tcg/tricore/test_abs.S            |   8 ++
tests/tcg/tricore/test_bmerge.S         |   8 ++
tests/tcg/tricore/test_clz.S            |   9 +++
tests/tcg/tricore/test_dvstep.S         |  15 ++++
tests/tcg/tricore/test_fadd.S           |  16 ++++
tests/tcg/tricore/test_fmul.S           |   8 ++
tests/tcg/tricore/test_ftoi.S           |  10 +++
tests/tcg/tricore/test_madd.S           |  11 +++
tests/tcg/tricore/test_msub.S           |   9 +++
tests/tcg/tricore/test_muls.S           |   9 +++
17 files changed, 461 insertions(+)
create mode 100644 hw/tricore/tricore_testdevice.c
create mode 100644 include/hw/tricore/tricore_testdevice.h
create mode 100644 tests/tcg/tricore/Makefile
create mode 100644 tests/tcg/tricore/link.ld
create mode 100644 tests/tcg/tricore/macros.h
create mode 100644 tests/tcg/tricore/test_abs.S
create mode 100644 tests/tcg/tricore/test_bmerge.S
create mode 100644 tests/tcg/tricore/test_clz.S
create mode 100644 tests/tcg/tricore/test_dvstep.S
create mode 100644 tests/tcg/tricore/test_fadd.S
create mode 100644 tests/tcg/tricore/test_fmul.S
create mode 100644 tests/tcg/tricore/test_ftoi.S
create mode 100644 tests/tcg/tricore/test_madd.S
create mode 100644 tests/tcg/tricore/test_msub.S
create mode 100644 tests/tcg/tricore/test_muls.S
[Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests
Posted by Bastian Koppelmann 7 years, 6 months ago
Hi Alex,

I finally came around converting some of my TriCore regression tests into actual
tests, that don't require the proprietary Infineon simulator.

These tests are heavily inspired by the riscv-tests [1]. I add macros that
allow easy testing of single asm instructions.

e.g. for add %d1, %d2, %d3 this looks like
          insn test_num res  rs1  rs2
           v      v      v    v    v
TEST_D_DD(add,    1,    0x3, 0x1, 0x2)

Each of the macros generates code that loads the operands into registers,
executes the instruction, and finally checks if the result is as expected.
If the expected result does not match, a guest fail handler is called, that
writes the test_num to a testdev. This testdev takes the test_num and returns it
as an status code using exit(). If all tests pass, we jump to a pass handler,
that writes 0 to the testdev.

Unfortunately, I didn't add any switch to run this automatically on 'make check'
or similar, since there is no obvious way to integrate the tricore-binutils [2].

You can find the full tree here:
https://github.com/bkoppelmann/qemu/tree/tcg-tests-tricore

Cheers,
Bastian

[1] https://github.com/riscv/riscv-tests
[2] https://github.com/bkoppelmann/tricore-binutils

Bastian Koppelmann (12):
  hw/tricore: Add testdevice for tests in tests/tcg/
  tests/tcg/tricore: Add build infrastructure
  tests/tcg/tricore: Add macros to easily create tests and first test
    'abs'
  tests/tcg/tricore: Add bmerge test
  tests/tcg/tricore: Add clz test
  tests/tcg/tricore: Add dvstep test
  tests/tcg/tricore: Add fadd test
  tests/tcg/tricore: Add fmul test
  tests/tcg/tricore: Add ftoi test
  tests/tcg/tricore: Add madd test
  tests/tcg/tricore: Add msub test
  tests/tcg/tricore: Add muls test

 hw/tricore/Makefile.objs                |   1 +
 hw/tricore/tricore_testboard.c          |   8 ++
 hw/tricore/tricore_testdevice.c         |  81 ++++++++++++++++++++
 include/hw/tricore/tricore_testdevice.h |  38 ++++++++++
 tests/tcg/tricore/Makefile              |  41 ++++++++++
 tests/tcg/tricore/link.ld               |  60 +++++++++++++++
 tests/tcg/tricore/macros.h              | 129 ++++++++++++++++++++++++++++++++
 tests/tcg/tricore/test_abs.S            |   8 ++
 tests/tcg/tricore/test_bmerge.S         |   8 ++
 tests/tcg/tricore/test_clz.S            |   9 +++
 tests/tcg/tricore/test_dvstep.S         |  15 ++++
 tests/tcg/tricore/test_fadd.S           |  16 ++++
 tests/tcg/tricore/test_fmul.S           |   8 ++
 tests/tcg/tricore/test_ftoi.S           |  10 +++
 tests/tcg/tricore/test_madd.S           |  11 +++
 tests/tcg/tricore/test_msub.S           |   9 +++
 tests/tcg/tricore/test_muls.S           |   9 +++
 17 files changed, 461 insertions(+)
 create mode 100644 hw/tricore/tricore_testdevice.c
 create mode 100644 include/hw/tricore/tricore_testdevice.h
 create mode 100644 tests/tcg/tricore/Makefile
 create mode 100644 tests/tcg/tricore/link.ld
 create mode 100644 tests/tcg/tricore/macros.h
 create mode 100644 tests/tcg/tricore/test_abs.S
 create mode 100644 tests/tcg/tricore/test_bmerge.S
 create mode 100644 tests/tcg/tricore/test_clz.S
 create mode 100644 tests/tcg/tricore/test_dvstep.S
 create mode 100644 tests/tcg/tricore/test_fadd.S
 create mode 100644 tests/tcg/tricore/test_fmul.S
 create mode 100644 tests/tcg/tricore/test_ftoi.S
 create mode 100644 tests/tcg/tricore/test_madd.S
 create mode 100644 tests/tcg/tricore/test_msub.S
 create mode 100644 tests/tcg/tricore/test_muls.S

--
2.11.0


Re: [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests
Posted by no-reply@patchew.org 7 years, 6 months ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180501142222.19154-1-kbastian@mail.uni-paderborn.de
Subject: [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20180501142222.19154-1-kbastian@mail.uni-paderborn.de -> patchew/20180501142222.19154-1-kbastian@mail.uni-paderborn.de
Switched to a new branch 'test'
aeec842144 tests/tcg/tricore: Add muls test
6d9e6882a0 tests/tcg/tricore: Add msub test
0569179058 tests/tcg/tricore: Add madd test
90620430a7 tests/tcg/tricore: Add ftoi test
c215189a5a tests/tcg/tricore: Add fmul test
81b70bf1cb tests/tcg/tricore: Add fadd test
588937f8e2 tests/tcg/tricore: Add dvstep test
396fef25f9 tests/tcg/tricore: Add clz test
fca4381f18 tests/tcg/tricore: Add bmerge test
0fe50ea8b1 tests/tcg/tricore: Add macros to easily create tests and first test 'abs'
bc19b6ac7f tests/tcg/tricore: Add build infrastructure
cdca3a5537 hw/tricore: Add testdevice for tests in tests/tcg/

=== OUTPUT BEGIN ===
Checking PATCH 1/12: hw/tricore: Add testdevice for tests in tests/tcg/...
Checking PATCH 2/12: tests/tcg/tricore: Add build infrastructure...
Checking PATCH 3/12: tests/tcg/tricore: Add macros to easily create tests and first test 'abs'...
ERROR: Macros with multiple statements should be enclosed in a do - while loop
#40: FILE: tests/tcg/tricore/macros.h:2:
+#define LI(reg, val)           \
+    mov.u reg, lo:val;         \
+    movh DREG_TEMP_LI, up:val; \
+    or reg, reg, DREG_TEMP_LI; \
+

ERROR: spaces required around that ':' (ctx:VxV)
#41: FILE: tests/tcg/tricore/macros.h:3:
+    mov.u reg, lo:val;         \
                  ^

ERROR: spaces required around that ':' (ctx:VxV)
#42: FILE: tests/tcg/tricore/macros.h:4:
+    movh DREG_TEMP_LI, up:val; \
                          ^

ERROR: spaces required around that '%' (ctx:WxV)
#48: FILE: tests/tcg/tricore/macros.h:10:
+#define DREG_RS1 %d0
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#48: FILE: tests/tcg/tricore/macros.h:10:
+#define DREG_RS1 %d0

ERROR: spaces required around that '%' (ctx:WxV)
#49: FILE: tests/tcg/tricore/macros.h:11:
+#define DREG_CALC_RESULT %d1
                          ^

ERROR: Macros with complex values should be enclosed in parenthesis
#49: FILE: tests/tcg/tricore/macros.h:11:
+#define DREG_CALC_RESULT %d1

ERROR: spaces required around that '%' (ctx:WxV)
#50: FILE: tests/tcg/tricore/macros.h:12:
+#define DREG_TEMP_LI %d10
                      ^

ERROR: Macros with complex values should be enclosed in parenthesis
#50: FILE: tests/tcg/tricore/macros.h:12:
+#define DREG_TEMP_LI %d10

ERROR: spaces required around that '%' (ctx:WxV)
#51: FILE: tests/tcg/tricore/macros.h:13:
+#define DREG_TEMP %d11
                   ^

ERROR: Macros with complex values should be enclosed in parenthesis
#51: FILE: tests/tcg/tricore/macros.h:13:
+#define DREG_TEMP %d11

ERROR: spaces required around that '%' (ctx:WxV)
#52: FILE: tests/tcg/tricore/macros.h:14:
+#define DREG_TEST_NUM %d14
                       ^

ERROR: Macros with complex values should be enclosed in parenthesis
#52: FILE: tests/tcg/tricore/macros.h:14:
+#define DREG_TEST_NUM %d14

ERROR: spaces required around that '%' (ctx:WxV)
#53: FILE: tests/tcg/tricore/macros.h:15:
+#define DREG_CORRECT_RESULT %d15
                             ^

ERROR: Macros with complex values should be enclosed in parenthesis
#53: FILE: tests/tcg/tricore/macros.h:15:
+#define DREG_CORRECT_RESULT %d15

ERROR: spaces required around that '%' (ctx:WxV)
#55: FILE: tests/tcg/tricore/macros.h:17:
+#define DREG_DEV_ADDR %a15
                       ^

ERROR: Macros with complex values should be enclosed in parenthesis
#55: FILE: tests/tcg/tricore/macros.h:17:
+#define DREG_DEV_ADDR %a15

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#58: FILE: tests/tcg/tricore/macros.h:20:
+#define TEST_CASE(num, testreg, correct, code...) \
+test_ ## num:                                     \
+    code;                                         \
+    LI(DREG_CORRECT_RESULT, correct)              \
+    mov DREG_TEST_NUM, num;                       \
+    jne testreg, DREG_CORRECT_RESULT, fail        \
+

ERROR: spaces required around that ':' (ctx:VxE)
#59: FILE: tests/tcg/tricore/macros.h:21:
+test_ ## num:                                     \
             ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#77: FILE: tests/tcg/tricore/macros.h:39:
+#define TEST_PASSFAIL                       \
+        j pass;                             \
+fail:                                       \
+        LI(DREG_TEMP, TESTDEV_ADDR)         \
+        mov.a DREG_DEV_ADDR, DREG_TEMP;     \
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\
+        debug;                              \
+        j fail;                             \
+pass:                                       \
+        LI(DREG_TEMP, TESTDEV_ADDR)         \
+        mov.a DREG_DEV_ADDR, DREG_TEMP;     \
+        mov DREG_TEST_NUM, 0;               \
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\
+        debug;                              \
+        j pass;

ERROR: space prohibited before open square bracket '['
#82: FILE: tests/tcg/tricore/macros.h:44:
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\

ERROR: space prohibited before open square bracket '['
#89: FILE: tests/tcg/tricore/macros.h:51:
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\

total: 22 errors, 0 warnings, 69 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 4/12: tests/tcg/tricore: Add bmerge test...
ERROR: spaces required around that '%' (ctx:WxV)
#29: FILE: tests/tcg/tricore/macros.h:11:
+#define DREG_RS2 %d1
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#29: FILE: tests/tcg/tricore/macros.h:11:
+#define DREG_RS2 %d1

ERROR: spaces required around that '%' (ctx:WxV)
#31: FILE: tests/tcg/tricore/macros.h:13:
+#define DREG_CALC_PSW %d2
                       ^

ERROR: Macros with complex values should be enclosed in parenthesis
#31: FILE: tests/tcg/tricore/macros.h:13:
+#define DREG_CALC_PSW %d2

ERROR: spaces required around that '%' (ctx:WxV)
#32: FILE: tests/tcg/tricore/macros.h:14:
+#define DREG_CORRECT_PSW %d3
                          ^

ERROR: Macros with complex values should be enclosed in parenthesis
#32: FILE: tests/tcg/tricore/macros.h:14:
+#define DREG_CORRECT_PSW %d3

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#40: FILE: tests/tcg/tricore/macros.h:30:
+#define TEST_CASE_PSW(num, testreg, correct, correct_psw, code...) \
+test_ ## num:                                                      \
+    code;                                                          \
+    LI(DREG_CORRECT_RESULT, correct)                               \
+    mov DREG_TEST_NUM, num;                                        \
+    jne testreg, DREG_CORRECT_RESULT, fail;                        \
+    mfcr DREG_CALC_PSW, $psw;                                      \
+    LI(DREG_CORRECT_PSW, correct_psw)                              \
+    mov DREG_TEST_NUM, num;                                        \
+    jne DREG_CALC_PSW, DREG_CORRECT_PSW, fail;

ERROR: spaces required around that ':' (ctx:VxE)
#41: FILE: tests/tcg/tricore/macros.h:31:
+test_ ## num:                                                      \
             ^

total: 8 errors, 0 warnings, 58 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 5/12: tests/tcg/tricore: Add clz test...
Checking PATCH 6/12: tests/tcg/tricore: Add dvstep test...
ERROR: spaces required around that '%' (ctx:WxV)
#29: FILE: tests/tcg/tricore/macros.h:22:
+#define EREG_RS1 %e6
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#29: FILE: tests/tcg/tricore/macros.h:22:
+#define EREG_RS1 %e6

ERROR: spaces required around that '%' (ctx:WxV)
#30: FILE: tests/tcg/tricore/macros.h:23:
+#define EREG_RS1_LO %d6
                     ^

ERROR: Macros with complex values should be enclosed in parenthesis
#30: FILE: tests/tcg/tricore/macros.h:23:
+#define EREG_RS1_LO %d6

ERROR: spaces required around that '%' (ctx:WxV)
#31: FILE: tests/tcg/tricore/macros.h:24:
+#define EREG_RS1_HI %d7
                     ^

ERROR: Macros with complex values should be enclosed in parenthesis
#31: FILE: tests/tcg/tricore/macros.h:24:
+#define EREG_RS1_HI %d7

ERROR: spaces required around that '%' (ctx:WxV)
#32: FILE: tests/tcg/tricore/macros.h:25:
+#define EREG_RS2 %e8
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#32: FILE: tests/tcg/tricore/macros.h:25:
+#define EREG_RS2 %e8

ERROR: spaces required around that '%' (ctx:WxV)
#33: FILE: tests/tcg/tricore/macros.h:26:
+#define EREG_RS2_LO %d8
                     ^

ERROR: Macros with complex values should be enclosed in parenthesis
#33: FILE: tests/tcg/tricore/macros.h:26:
+#define EREG_RS2_LO %d8

ERROR: spaces required around that '%' (ctx:WxV)
#34: FILE: tests/tcg/tricore/macros.h:27:
+#define EREG_RS2_HI %d9
                     ^

ERROR: Macros with complex values should be enclosed in parenthesis
#34: FILE: tests/tcg/tricore/macros.h:27:
+#define EREG_RS2_HI %d9

ERROR: spaces required around that '%' (ctx:WxV)
#35: FILE: tests/tcg/tricore/macros.h:28:
+#define EREG_CALC_RESULT %e8
                          ^

ERROR: Macros with complex values should be enclosed in parenthesis
#35: FILE: tests/tcg/tricore/macros.h:28:
+#define EREG_CALC_RESULT %e8

ERROR: spaces required around that '%' (ctx:WxV)
#36: FILE: tests/tcg/tricore/macros.h:29:
+#define EREG_CALC_RESULT_HI %d9
                             ^

ERROR: Macros with complex values should be enclosed in parenthesis
#36: FILE: tests/tcg/tricore/macros.h:29:
+#define EREG_CALC_RESULT_HI %d9

ERROR: spaces required around that '%' (ctx:WxV)
#37: FILE: tests/tcg/tricore/macros.h:30:
+#define EREG_CALC_RESULT_LO %d8
                             ^

ERROR: Macros with complex values should be enclosed in parenthesis
#37: FILE: tests/tcg/tricore/macros.h:30:
+#define EREG_CALC_RESULT_LO %d8

ERROR: spaces required around that '%' (ctx:WxV)
#38: FILE: tests/tcg/tricore/macros.h:31:
+#define EREG_CORRECT_RESULT_LO %d0
                                ^

ERROR: Macros with complex values should be enclosed in parenthesis
#38: FILE: tests/tcg/tricore/macros.h:31:
+#define EREG_CORRECT_RESULT_LO %d0

ERROR: spaces required around that '%' (ctx:WxV)
#39: FILE: tests/tcg/tricore/macros.h:32:
+#define EREG_CORRECT_RESULT_HI %d1
                                ^

ERROR: Macros with complex values should be enclosed in parenthesis
#39: FILE: tests/tcg/tricore/macros.h:32:
+#define EREG_CORRECT_RESULT_HI %d1

ERROR: spaces required around that ':' (ctx:VxE)
#49: FILE: tests/tcg/tricore/macros.h:43:
+test_ ## num:                                              \
             ^

total: 23 errors, 0 warnings, 69 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 7/12: tests/tcg/tricore: Add fadd test...
Checking PATCH 8/12: tests/tcg/tricore: Add fmul test...
Checking PATCH 9/12: tests/tcg/tricore: Add ftoi test...
Checking PATCH 10/12: tests/tcg/tricore: Add madd test...
ERROR: spaces required around that '%' (ctx:WxV)
#29: FILE: tests/tcg/tricore/macros.h:12:
+#define DREG_RS3 %d4
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#29: FILE: tests/tcg/tricore/macros.h:12:
+#define DREG_RS3 %d4

total: 2 errors, 0 warnings, 48 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 11/12: tests/tcg/tricore: Add msub test...
Checking PATCH 12/12: tests/tcg/tricore: Add muls test...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com