freedreno: Move afuc tests to meson unit tests.
authorEmma Anholt <emma@anholt.net>
Thu, 23 Sep 2021 18:25:58 +0000 (11:25 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 1 Oct 2021 23:16:04 +0000 (23:16 +0000)
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
src/freedreno/.gitlab-ci/reference/afuc_test.asm
src/freedreno/afuc/disasm.c
src/freedreno/afuc/meson.build

index e97daa6..66f23db 100755 (executable)
@@ -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
index f4ad047..141559d 100644 (file)
@@ -1,5 +1,4 @@
 ; a6xx microcode
-; Disassembling microcode: src/freedreno/.gitlab-ci/reference/afuc_test.fw
 ; Version: 01000001
 
         [01000001]  ; nop
index 0bf00ef..5be0670 100644 (file)
@@ -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) {
index 878d4e7..247834d 100644 (file)
@@ -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