freedreno: Move crashdec/cffdec tests to be 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.  Also dropped the "Parsing
<file>" in addition to "Reading <file>" in the tested script, since it's
redundant and baked the path name into the reference.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6360>
This commit is contained in:
Emma Anholt 2021-09-23 11:36:40 -07:00 committed by Marge Bot
parent 5209a0ae16
commit 82b5c95265
12 changed files with 55 additions and 73 deletions

View File

@ -1,55 +0,0 @@
#!/bin/bash
# This file contains all of the cmdlines used to generate output
# for the test step in the CI pipeline. It can also be used to
# regenerate reference output
set -x
set -e
# input/output directories:
base=src/freedreno
traces=$base/.gitlab-ci/traces
reference=$base/.gitlab-ci/reference
output=$base/.gitlab-ci/out
# use the --update arg to update reference output:
if [ "$1" = "--update" ]; then
output=$reference
fi
mkdir -p $output
# binary locations:
cffdump=./install/bin/cffdump
crashdec=./install/bin/crashdec
asm=./install/bin/afuc-asm
disasm=./install/bin/afuc-disasm
# helper to filter out paths that can change depending on
# who is building and assert messages that can change
# depending on unrelated code changes:
basepath=`dirname $0`
basepath=`dirname $basepath`
basepath=`pwd $basepath`
filter() {
out=$1
grep -vF "$basepath" | sed "s/.*: Assertion /Assertion /" > $out
}
#
# The Tests:
#
# dump only a single frame, and single tile pass, to keep the
# reference output size managable
$cffdump --frame 0 --once $traces/fd-clouds.rd.gz | filter $output/fd-clouds.log
$cffdump --frame 0 --once $traces/es2gears-a320.rd.gz | filter $output/es2gears-a320.log
$cffdump --frame 1 --once $traces/glxgears-a420.rd.gz | filter $output/glxgears-a420.log
$cffdump --once $traces/dEQP-GLES2.functional.texture.specification.basic_teximage2d.rgba16f_2d.rd.gz | filter $output/dEQP-GLES2.functional.texture.specification.basic_teximage2d.rgba16f_2d.log
$cffdump --frame 0 --once $traces/dEQP-VK.draw.indirect_draw.indexed.indirect_draw_count.triangle_list.rd.gz | filter $output/dEQP-VK.draw.indirect_draw.indexed.indirect_draw_count.triangle_list.log
# test a lua script to ensure we don't break scripting API:
$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

View File

@ -1,4 +1,3 @@
Reading src/freedreno/.gitlab-ci/traces/dEQP-GLES2.functional.texture.specification.basic_teximage2d.rgba16f_2d.rd.gz...
gpu_id: 201
cmd: deqp-gles2/185: fence=1250
############################################################

View File

@ -1,4 +1,3 @@
Reading src/freedreno/.gitlab-ci/traces/dEQP-VK.draw.indirect_draw.indexed.indirect_draw_count.triangle_list.rd.gz...
gpu_id: 640
cmd: deqp-vk/74711: fence=247337
############################################################

View File

@ -1,4 +1,3 @@
Reading src/freedreno/.gitlab-ci/traces/es2gears-a320.rd.gz...
gpu_id: 330
cmd: es2gears/628: fence=276
############################################################

View File

@ -1,4 +1,3 @@
Reading src/freedreno/.gitlab-ci/traces/fd-clouds.rd.gz...
gpu_id: 630
cmd: null_platform_t/2995: fence=1855
############################################################

View File

@ -1,4 +1,3 @@
Reading src/freedreno/.gitlab-ci/traces/glxgears-a420.rd.gz...
gpu_id: 420
cmd: X/23360: fence=1029603
cmd: glxgears/23375: fence=1029604

View File

@ -1,6 +1,4 @@
Analyzing Data...
Reading src/freedreno/.gitlab-ci/traces/shadow.rd.gz...
Parsing src/freedreno/.gitlab-ci/traces/shadow.rd.gz
Blit:
-----

View File

@ -3,12 +3,6 @@
set -e
set -x
p=`dirname $0`
# Run cffdump/crashdec tests:
$p/genoutput.sh
diff -r $p/reference $p/out
# Also, while we are still using headergen2 for generating kernel
# headers, make sure that doesn't break:
headergen="_build/src/freedreno/rnn/headergen2"

View File

@ -64,6 +64,11 @@ struct cffdec_options {
*/
int once;
/* In unit_test mode, suppress pathnames in output so that we can have references
* independent of the build dir.
*/
int unit_test;
/* for crashdec, where we know CP_IBx_REM_SIZE, we can use this
* to highlight the cmdstream not parsed yet, to make it easier
* to see how far along the CP is.

View File

@ -106,6 +106,7 @@ print_usage(const char *name)
"\t which can be useful when looking at state that does\n"
"\t not change per tile\n"
"\t--not-once - decode cmdstream for each IB (default)\n"
"\t--unit-test - make reproducible output for unit testing\n"
"\t-h, --help - show this message\n"
, name);
/* clang-format on */
@ -128,6 +129,7 @@ static const struct option opts[] = {
{ "query-compare", no_argument, &options.query_compare, 1 },
{ "once", no_argument, &options.once, 1 },
{ "not-once", no_argument, &options.once, 0 },
{ "unit-test", no_argument, &options.unit_test, 1 },
/* Long opts with short alias: */
{ "verbose", no_argument, 0, 'v' },
@ -263,7 +265,8 @@ handle_file(const char *filename, int start, int end, int draw)
cffdec_init(&options);
printf("Reading %s...\n", filename);
if (!options.unit_test)
printf("Reading %s...\n", filename);
script_start_cmdstream(filename);

View File

@ -153,3 +153,49 @@ if dep_libarchive.found()
install: false,
)
endif
if with_tests
diff = find_program('diff')
crashdec_output = custom_target('crashdec.txt',
output: 'crashdec.txt',
command: [crashdec, '-sf', files('../.gitlab-ci/traces/crash.devcore')],
capture: true
)
test('crashdec',
diff,
args: ['-u', files('../.gitlab-ci/reference/crash.log'), crashdec_output],
suite: 'freedreno',
workdir: meson.source_root()
)
# dump only a single frame, and single tile pass, to keep the
# reference output size managable
cffdump_tests = [
['fd-clouds', ['--frame', '0', '--once']],
['es2gears-a320', ['--frame', '0', '--once']],
['glxgears-a420', ['--frame', '1', '--once']],
['dEQP-GLES2.functional.texture.specification.basic_teximage2d.rgba16f_2d', ['--once']],
['dEQP-VK.draw.indirect_draw.indexed.indirect_draw_count.triangle_list', ['--frame', '0', '--once']],
# Test a lua script to ensure we don't break scripting API
['shadow', ['--script', files(join_paths(meson.current_source_dir(), 'scripts', 'parse-submits.lua'))]],
]
foreach cffdump_test: cffdump_tests
name = cffdump_test[0]
args = cffdump_test[1]
log = custom_target(name + '.log',
output: name + '.log',
command: [cffdump, '--unit-test', args, files('../.gitlab-ci/traces/' + name + '.rd.gz')],
capture: true,
)
test('cffdump-' + name,
diff,
args: ['-u', files('../.gitlab-ci/reference/' + name + '.log'), log],
suite: 'freedreno',
workdir: meson.source_root()
)
endforeach
endif

View File

@ -64,10 +64,6 @@ local depthwrite
local stenciltest
local stencilwrite
function start_cmdstream(name)
printf("Parsing %s\n", name)
end
function reset()
dbg("reset\n")
mrts = {}