intel-decode regression testing
I tried to make this as easy as possible for updating the decode output -- it should be a matter of looking at the diff produced by make check, approving of it, and copying the -new.txt over the -ref.txt.
Tested with make check and make distcheck, including with corrupting a ref file.
PATCH 1/3 intel: Add an interface for setting the output file for decode.
Consumers often want to choose stdout vs stderr, and for testing I want to output to an open_memstream file.
--- intel/intel_bufmgr.h | 2 ++ intel/intel_decode.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
intel/intel_bufmgr.h +2 -0
@@ -34,6 +34,7 @@#ifndef INTEL_BUFMGR_H #define INTEL_BUFMGR_H +#include <stdio.h> #include <stdint.h> struct drm_clip_rect ;
@@ -199,6 +200,7 @@ void drm_intel_decode_set_dump_past_end(struct drm_intel_decode *ctx, int dump_past_end);void drm_intel_decode_set_head_tail (struct drm_intel_decode *ctx,uint32_t head,uint32_t tail); +void drm_intel_decode_set_output_file (struct drm_intel_decode *ctx,FILE *out);void drm_intel_decode (struct drm_intel_decode *ctx);
intel/intel_decode.c +12 -2
@@ -33,6 +33,9 @@/* Struct for tracking drm_intel_decode state. */ struct drm_intel_decode { +/** stdio file where the output should land. Defaults to stdout. */ +FILE *out; +/** PCI device ID. */ uint32_t devid;
@@ -3558,6 +3561,7 @@ drm_intel_decode_context_alloc(uint32_t devid)return NULL ; ctx->devid = devid; + ctx->out = stdout;return ctx; }
@@ -3592,6 +3596,13 @@ drm_intel_decode_set_head_tail(struct drm_intel_decode *ctx, ctx->tail = tail; } +void +drm_intel_decode_set_output_file (struct drm_intel_decode *ctx, +FILE *out) +{ + ctx->out = out; +} +/** * Decodes an i830-i915 batch buffer, writing the output to stdout. *
@@ -3618,12 +3629,11 @@ drm_intel_decode(struct drm_intel_decode *ctx) devid = ctx->devid; head_offset = ctx->head; tail_offset = ctx->tail; + out = ctx->out; saved_s2_set =0 ; saved_s4_set =1 ; - out = stdout; -while (index < count) {switch ((data[index] &0xe0000000 ) >>29 ) {case 0x0 :
Signature · 1 line
1.7.7.3
PATCH 2/3 intel: Add a regression test program for intel_decode.c.
In reply to Eric Anholt--- configure.ac | 2 + intel/.gitignore | 1 + intel/Makefile.am | 5 ++ intel/test_decode.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 198 insertions(+), 0 deletions(-) create mode 100644 intel/.gitignore create mode 100644 intel/test_decode.c
configure.ac +2 -0
@@ -114,6 +114,8 @@ AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=], [AC_MSG_ERROR([Couldn't find clock_gettime])])]) AC_SUBST([CLOCK_LIB]) +AC_CHECK_FUNCS([open_memstream], [HAVE_OPEN_MEMSTREAM=yes]) + dnl Use lots of warning flags with with gcc and compatible compilers dnl Note: if you change the following variable, the cache is automatically
intel/.gitignore new file +1 -0
@@ -0,0 +1 @@ +test_decode
intel/Makefile.am +5 -0
@@ -54,4 +54,9 @@ libdrm_intelincludedir = ${includedir}/libdrm libdrm_intelinclude_HEADERS = intel_bufmgr.h \ intel_debug.h +# This may be interesting even outside of "make check", due to the -dump option. +noinst_PROGRAMS = test_decode + +test_decode_LDADD = libdrm_intel.la + pkgconfig_DATA = libdrm_intel.pc
intel/test_decode.c new file +190 -0
190 lines not on this page · raw message
Signature · 6 lines
1.7.7.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 intel: Add regression tests for batch decode.
In reply to Eric AnholtThe .batch was generated using the dump-a-batch branch of
git://people.freedesktop.org/~anholt/mesa
using glxgears on gen7 hardware, using INTEL_DEVID_OVERRIDE for non-gen7 (this means that offsets in the buffers for non-gen7 are 0!). The .ref was generated by:
./test_decode tests/gen7-3d.batch -dump.
The .sh exists because you can't supply arguments to tests using the simple automake tests driver. Something reasonable could be done using automake's parallel-tests driver (in fact, a previous version of the patch did that), but I was concerned that:
1) The parallel-tests driver is documented to be unstable -- they may change interfaces on us later.
2) The parallel-tests driver hides the output of tests in .log files scattered all over the tree, which was ugly and more painful to work with.
--- intel/Makefile.am | 17 + intel/tests/gen7-3d.batch | Bin 0 -> 4504 bytes intel/tests/gen7-3d.batch-ref.txt | 1350 +++++++++++++++++++++++++++++++++++++ intel/tests/test-batch.sh | 20 + 4 files changed, 1387 insertions(+), 0 deletions(-) create mode 100644 intel/tests/gen7-3d.batch create mode 100644 intel/tests/gen7-3d.batch-ref.txt create mode 100755 intel/tests/test-batch.sh
intel/Makefile.am +17 -0
@@ -57,6 +57,23 @@ libdrm_intelinclude_HEADERS = intel_bufmgr.h \ # This may be interesting even outside of "make check", due to the -dump option. noinst_PROGRAMS = test_decode +BATCHES = \ + tests/gen4-3d.batch \ + tests/gm45-3d.batch \ + tests/gen5-3d.batch \ + tests/gen6-3d.batch \ + tests/gen7-3d.batch + +TESTS = \ + $(BATCHES:.batch=.batch.sh) + +EXTRA_DIST = \ + $(BATCHES) \ + $(BATCHES:.batch=.batch.sh) \ + $(BATCHES:.batch=.batch-ref.txt) \ + $(BATCHES:.batch=.batch-ref.txt) \ + tests/test-batch.sh + test_decode_LDADD = libdrm_intel.la pkgconfig_DATA = libdrm_intel.pc
intel/tests/gen7-3d.batch new file binary +0 -0
intel/tests/gen7-3d.batch-ref.txt new file +1350 -0
1,350 lines not on this page · raw message
intel/tests/test-batch.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh + +TEST_FILENAME=`echo "$0" | sed 's|.sh||'` +./test_decode $TEST_FILENAME + +ret=$? + +# pretty-print a diff showing what happened, and leave the dumped +# around for possibly moving over the ref. +if test $ret = 1; then + REF_FILENAME="$TEST_FILENAME-ref.txt" + NEW_FILENAME="$TEST_FILENAME-new.txt" + ./test_decode $TEST_FILENAME -dump > $NEW_FILENAME + if test $? = 0; then + echo "Differences:" + diff -u $REF_FILENAME $NEW_FILENAME + fi +fi + +exit $ret
Signature · 1 line
1.7.7.3
Re: [PATCH 3/3] intel: Add regression tests for batch decode.
Quoted 20 lines · Eric Anholt
The .batch was generated using the dump-a-batch branch of
git://people.freedesktop.org/~anholt/mesausing glxgears on gen7 hardware, using
INTEL_DEVID_OVERRIDEfor non-gen7 (this means that offsets in the buffers for non-gen7 are 0!). The .ref was generated by:./test_decode tests/gen7-3d.batch -dump.
The .sh exists because you can't supply arguments to tests using the simple automake tests driver. Something reasonable could be done using automake's parallel-tests driver (in fact, a previous version of the patch did that), but I was concerned that:
1) The parallel-tests driver is documented to be unstable -- they may change interfaces on us later.
2) The parallel-tests driver hides the output of tests in .log files scattered all over the tree, which was ugly and more painful to work with.
Quoted 4 lines
--- intel/Makefile.am | 17 + intel/tests/gen7-3d.batch | Bin 0 -> 4504 bytes intel/tests/gen7-3d.batch-ref.txt | 1350 +++++++++++++++++++++++++++++++++++++
I'm missing the *.batch* stuff for gen4-gen6 mentioned in the Makefile.am.
Quoted 1 line
From looking throught the code I've also expected the *.batch to be a
symlink to test-batch.sh.
Otherwise this looks nice. I'm not really sold on this catching bugs, but it certainly helps in self-documenting patches to the decoder by including the relevant output changes in the diff.
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Re: [PATCH 3/3] intel: Add regression tests for batch decode.
Quoted 26 lines · Daniel Vetter
Quoted 20 lines · Eric Anholt
The .batch was generated using the dump-a-batch branch of
git://people.freedesktop.org/~anholt/mesausing glxgears on gen7 hardware, using
INTEL_DEVID_OVERRIDEfor non-gen7 (this means that offsets in the buffers for non-gen7 are 0!). The .ref was generated by:./test_decode tests/gen7-3d.batch -dump.
The .sh exists because you can't supply arguments to tests using the simple automake tests driver. Something reasonable could be done using automake's parallel-tests driver (in fact, a previous version of the patch did that), but I was concerned that:
1) The parallel-tests driver is documented to be unstable -- they may change interfaces on us later.
2) The parallel-tests driver hides the output of tests in .log files scattered all over the tree, which was ugly and more painful to work with.Quoted 4 lines
--- intel/Makefile.am | 17 + intel/tests/gen7-3d.batch | Bin 0 -> 4504 bytes intel/tests/gen7-3d.batch-ref.txt | 1350 +++++++++++++++++++++++++++++++++++++
Quoted 3 lines
I'm missing the *.batch* stuff for gen4-gen6 mentioned in the Makefile.am. From looking throught the code I've also expected the *.batch to be a symlink to
test-batch.sh.
Failure to git add. Fixed locally.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
Reviewed-byRe: [PATCH 3/3] intel: Add regression tests for batch decode.
Quoted 27 lines · Eric Anholt
Quoted 26 lines · Daniel Vetter
Quoted 24 lines · Eric Anholt
The .batch was generated using the dump-a-batch branch of
git://people.freedesktop.org/~anholt/mesausing glxgears on gen7 hardware, using
INTEL_DEVID_OVERRIDEfor non-gen7 (this means that offsets in the buffers for non-gen7 are 0!). The .ref was generated by:./test_decode tests/gen7-3d.batch -dump.
The .sh exists because you can't supply arguments to tests using the simple automake tests driver. Something reasonable could be done using automake's parallel-tests driver (in fact, a previous version of the patch did that), but I was concerned that:
1) The parallel-tests driver is documented to be unstable -- they may change interfaces on us later.
2) The parallel-tests driver hides the output of tests in .log files scattered all over the tree, which was ugly and more painful to work with.--- intel/Makefile.am | 17 + intel/tests/gen7-3d.batch | Bin 0 -> 4504 bytes intel/tests/gen7-3d.batch-ref.txt | 1350 +++++++++++++++++++++++++++++++++++++
Quoted 5 lines
Quoted 3 lines
I'm missing the *.batch* stuff for gen4-gen6 mentioned in the Makefile.am. From looking throught the code I've also expected the *.batch to be a symlink to
test-batch.sh.Failure to git add. Fixed locally.
In that case, for the series:
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48