|
From: Tom H. <th...@cy...> - 2004-02-12 15:02:09
|
In message <Pin...@ye...>
Nicholas Nethercote <nj...@ca...> wrote:
> Tom, can you explain exactly what your insn_*.c tests do? AFAICT, they
> test every single instruction in some way, but I'd like to know exactly
> what is being tested.
Basically the idea is to test that the instructions have the same
effect under valgrind that they do when run normally.
The .def files have one line per test and specify the instruction to
execute, a set of values to be loaded into registers before executing
the instruction, a set of arguments to give to the instruction, and a
set of expected values to look for afterwards.
The perl script then turns that into the C files which can be compiled
and run outside of valgrind to produce the expected results which
should just be a list of ok's. It can then be run under valgrind to
make sure it produces the same result.
Currently they are only run under the none tool to check the basic
instruction translation but they should really be run under each tool
to check that the tools can all handle everything. I did run them all
under memcheck and fix any issues that came up but that isn't in the
regression tests yet. With helgrind there are still a number of
failures though.
> (Great idea, BTW, thanks for putting the effort into the scripts to
> generate the test cases... although I wonder if the C could be more
> succinct, eg. by using macros? The five generated .c files take up about
> 2MB :)
I know what you mean about the size, but most of the code is specific
to the test in terms of the initial values and expected results not to
mention the exact assembly code to use, so I'm not sure how much could
be commoned out.
> If it's really thorough, this seems like a reasonable replacement for the
> lost --stop-after flag... if we can plausibly test every instruction
> sufficiently(*), we can be certain the VCPU is correct.
Well the tests are generally as good as you make them. I tried to do a
basic test of each instruction but I didn't always poke that hard at
the edge cases. It isn't currently testing the flags with all the
instructions that can effect them either, although that would be easy
enough to add - the syntax supports it and they are already checked
for some instructions.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|