Mesa (main): freedreno: Move afuc tests to meson unit tests.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 1 23:38:26 UTC 2021


Module: Mesa
Branch: main
Commit: 5209a0ae1629bc246592e7b3dfb6f25341c4a723
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5209a0ae1629bc246592e7b3dfb6f25341c4a723

Author: Emma Anholt <emma at anholt.net>
Date:   Thu Sep 23 11:25:58 2021 -0700

freedreno: Move afuc tests to meson unit tests.

Now they run automatically in parallel with other unit testing, rather
than needing a separate script and environment to run them.

Instead of doing shell script filtering afterwards, I just added a little
flag to suppress printing the path name.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6360>

---

 src/freedreno/.gitlab-ci/genoutput.sh            |  3 ---
 src/freedreno/.gitlab-ci/reference/afuc_test.asm |  1 -
 src/freedreno/afuc/disasm.c                      |  9 ++++++--
 src/freedreno/afuc/meson.build                   | 27 ++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/src/freedreno/.gitlab-ci/genoutput.sh b/src/freedreno/.gitlab-ci/genoutput.sh
index e97daa6e079..66f23dbda0b 100755
--- a/src/freedreno/.gitlab-ci/genoutput.sh
+++ b/src/freedreno/.gitlab-ci/genoutput.sh
@@ -53,6 +53,3 @@ $cffdump --frame 0 --once $traces/dEQP-VK.draw.indirect_draw.indexed.indirect_dr
 $cffdump --script $base/decode/scripts/parse-submits.lua $traces/shadow.rd.gz | filter $output/shadow.log
 
 $crashdec -sf $traces/crash.devcore | filter $output/crash.log
-
-$asm -g 6 $traces/afuc_test.asm $output/afuc_test.fw
-$disasm -g 630 $reference/afuc_test.fw | filter $output/afuc_test.asm
diff --git a/src/freedreno/.gitlab-ci/reference/afuc_test.asm b/src/freedreno/.gitlab-ci/reference/afuc_test.asm
index f4ad047977e..141559df3d2 100644
--- a/src/freedreno/.gitlab-ci/reference/afuc_test.asm
+++ b/src/freedreno/.gitlab-ci/reference/afuc_test.asm
@@ -1,5 +1,4 @@
 ; a6xx microcode
-; Disassembling microcode: src/freedreno/.gitlab-ci/reference/afuc_test.fw
 ; Version: 01000001
 
         [01000001]  ; nop
diff --git a/src/freedreno/afuc/disasm.c b/src/freedreno/afuc/disasm.c
index 0bf00ef8f4d..5be0670d908 100644
--- a/src/freedreno/afuc/disasm.c
+++ b/src/freedreno/afuc/disasm.c
@@ -893,9 +893,10 @@ main(int argc, char **argv)
    uint32_t gpu_id = 0;
    size_t sz;
    int c, ret;
+   bool unit_test = false;
 
    /* Argument parsing: */
-   while ((c = getopt(argc, argv, "g:vce")) != -1) {
+   while ((c = getopt(argc, argv, "g:vceu")) != -1) {
       switch (c) {
       case 'g':
          gpu_id = atoi(optarg);
@@ -910,6 +911,9 @@ main(int argc, char **argv)
          emulator = true;
          verbose  = true;
          break;
+      case 'u':
+         unit_test = true;
+         break;
       default:
          usage();
       }
@@ -956,7 +960,8 @@ main(int argc, char **argv)
 
    buf = (uint32_t *)os_read_file(file, &sz);
 
-   printf("; Disassembling microcode: %s\n", file);
+   if (!unit_test)
+      printf("; Disassembling microcode: %s\n", file);
    printf("; Version: %08x\n\n", buf[1]);
 
    if (gpuver < 6) {
diff --git a/src/freedreno/afuc/meson.build b/src/freedreno/afuc/meson.build
index 878d4e74d8b..247834dc7c1 100644
--- a/src/freedreno/afuc/meson.build
+++ b/src/freedreno/afuc/meson.build
@@ -83,3 +83,30 @@ disasm = executable(
   build_by_default : with_tools.contains('freedreno'),
   install: install_fd_decode_tools,
 )
+
+if with_tests
+  diff = find_program('diff')
+
+  disasm_fw = custom_target('afuc_test.asm',
+    output: 'afuc_test.asm',
+    command: [disasm, '-u', files('../.gitlab-ci/reference/afuc_test.fw'), '-g', '630'],
+    capture: true
+  )
+  test('afuc-disasm',
+    diff,
+    args: ['-u', files('../.gitlab-ci/reference/afuc_test.asm'), disasm_fw],
+    suite: 'freedreno',
+    workdir: meson.source_root()
+  )
+
+  asm_fw = custom_target('afuc_test.fw',
+    output: 'afuc_test.fw',
+    command: [asm, '-g', '6', files('../.gitlab-ci/traces/afuc_test.asm'), '@OUTPUT@'],
+  )
+  test('afuc-asm',
+    diff,
+    args: ['-u', files('../.gitlab-ci/reference/afuc_test.fw'), asm_fw],
+    suite: 'freedreno',
+    workdir: meson.source_root()
+  )
+endif



More information about the mesa-commit mailing list