diff options
author | sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2006-01-22 16:44:35 +0000 |
---|---|---|
committer | sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2006-01-22 16:44:35 +0000 |
commit | 46712cd593e0c9ddf48431635e5b3e84a4eb1f42 (patch) | |
tree | 3feddb6d3d8f13639d464f120affe602607305d5 | |
parent | 7541cac4d5551ed38061374a567ce0ed49acc186 (diff) | |
download | valgrind-46712cd593e0c9ddf48431635e5b3e84a4eb1f42.tar.gz |
Use the bz2 test in perf/ as a regression-test, just as a moderately
complex integer program which exercises Vex a bit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5585 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r-- | memcheck/tests/Makefile.am | 3 | ||||
l--------- | memcheck/tests/vcpu_bz2.c | 1 | ||||
-rw-r--r-- | memcheck/tests/vcpu_bz2.stderr.exp | 0 | ||||
-rw-r--r-- | memcheck/tests/vcpu_bz2.stdout.exp | 70 | ||||
-rw-r--r-- | memcheck/tests/vcpu_bz2.vgtest | 3 | ||||
-rw-r--r-- | perf/bz2.c | 46 |
6 files changed, 117 insertions, 6 deletions
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 77e998a53..6a20d9017 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -107,6 +107,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \ toobig-allocs.stderr.exp toobig-allocs.vgtest \ trivialleak.stderr.exp trivialleak.vgtest \ metadata.stderr.exp metadata.stdout.exp metadata.vgtest-HIDING \ + vcpu_bz2.stdout.exp vcpu_bz2.stderr.exp vcpu_bz2.vgtest \ vgtest_ume.stderr.exp vgtest_ume.disabled \ wrap1.vgtest wrap1.stdout.exp wrap1.stderr.exp \ wrap2.vgtest wrap2.stdout.exp wrap2.stderr.exp \ @@ -149,6 +150,7 @@ check_PROGRAMS = \ supp_unknown supp1 supp2 suppfree \ trivialleak \ mismatches new_override metadata \ + vcpu_bz2 \ xml1 \ wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \ writev zeropage @@ -165,6 +167,7 @@ memcmptest_CFLAGS = $(AM_FLAG_M3264_PRI) $(AM_CFLAGS) -fno-builtin-memcmp oset_test_CFLAGS = $(AM_FLAG_M3264_PRI) \ -DVGA_$(VG_ARCH)=1 -DVGO_$(VG_OS)=1 \ -DVGP_$(VG_ARCH)_$(VG_OS)=1 +vcpu_bz2_CFLAGS = $(AM_FLAG_M3264_PRI) $(AM_CFLAGS) -O2 -g # Don't allow GCC to inline memcpy(), because then we can't intercept it overlap_CFLAGS = $(AM_CFLAGS) -fno-builtin-memcpy diff --git a/memcheck/tests/vcpu_bz2.c b/memcheck/tests/vcpu_bz2.c new file mode 120000 index 000000000..0137af4b7 --- /dev/null +++ b/memcheck/tests/vcpu_bz2.c @@ -0,0 +1 @@ +../../perf/bz2.c
\ No newline at end of file diff --git a/memcheck/tests/vcpu_bz2.stderr.exp b/memcheck/tests/vcpu_bz2.stderr.exp new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/memcheck/tests/vcpu_bz2.stderr.exp diff --git a/memcheck/tests/vcpu_bz2.stdout.exp b/memcheck/tests/vcpu_bz2.stdout.exp new file mode 100644 index 000000000..3bfc54ec5 --- /dev/null +++ b/memcheck/tests/vcpu_bz2.stdout.exp @@ -0,0 +1,70 @@ +22323 bytes read + block 1: crc = 0xA212ABF8, combined CRC = 0xA212ABF8, size = 22373 + too repetitive; using fallback sorting algorithm + 22373 in block, 13504 after MTF & 1-2 coding, 79+2 syms in use + pass 1: size is 17143, grp uses are 38 62 2 92 6 71 + pass 2: size is 6506, grp uses are 28 71 0 86 9 77 + pass 3: size is 6479, grp uses are 26 70 0 81 11 83 + pass 4: size is 6469, grp uses are 26 69 0 74 17 85 + bytes: mapping 19, selectors 66, code lengths 134, codes 6465 + final combined CRC = 0xA212ABF8 + 6710 after compression +bit 0 -5 DATA_ERROR_MAGIC +bit 1 -5 DATA_ERROR_MAGIC +bit 2 -5 DATA_ERROR_MAGIC +bit 3 -5 DATA_ERROR_MAGIC +bit 4 -5 DATA_ERROR_MAGIC +bit 5 -5 DATA_ERROR_MAGIC +bit 6 -5 DATA_ERROR_MAGIC +bit 7 -5 DATA_ERROR_MAGIC +bit 8 -5 DATA_ERROR_MAGIC +bit 9 -5 DATA_ERROR_MAGIC +bit 10 -5 DATA_ERROR_MAGIC +bit 11 -5 DATA_ERROR_MAGIC +bit 12 -5 DATA_ERROR_MAGIC +bit 13 -5 DATA_ERROR_MAGIC +bit 14 -5 DATA_ERROR_MAGIC +bit 15 -5 DATA_ERROR_MAGIC +bit 16 -5 DATA_ERROR_MAGIC +bit 17 -5 DATA_ERROR_MAGIC +bit 18 -5 DATA_ERROR_MAGIC +bit 19 -5 DATA_ERROR_MAGIC +bit 20 -5 DATA_ERROR_MAGIC +bit 21 -5 DATA_ERROR_MAGIC +bit 22 -5 DATA_ERROR_MAGIC +bit 23 -5 DATA_ERROR_MAGIC +bit 24 0 OK really ok! +bit 25 -5 DATA_ERROR_MAGIC +bit 26 -5 DATA_ERROR_MAGIC +bit 27 0 OK really ok! +bit 28 -5 DATA_ERROR_MAGIC +bit 29 -5 DATA_ERROR_MAGIC +bit 30 -5 DATA_ERROR_MAGIC +bit 31 -5 DATA_ERROR_MAGIC +bit 32 -4 DATA_ERROR +bit 33 -4 DATA_ERROR +bit 34 -4 DATA_ERROR +bit 35 -4 DATA_ERROR +bit 2412 -4 DATA_ERROR +bit 4789 -4 DATA_ERROR +bit 7166 -4 DATA_ERROR +bit 9543 -4 DATA_ERROR +bit 11920 -4 DATA_ERROR +bit 14297 -4 DATA_ERROR +bit 16674 -4 DATA_ERROR +bit 19051 -4 DATA_ERROR +bit 21428 -4 DATA_ERROR +bit 23805 -4 DATA_ERROR +bit 26182 -4 DATA_ERROR +bit 28559 -4 DATA_ERROR +bit 30936 -4 DATA_ERROR +bit 33313 -4 DATA_ERROR +bit 35690 -4 DATA_ERROR +bit 38067 -4 DATA_ERROR +bit 40444 -4 DATA_ERROR +bit 42821 -4 DATA_ERROR +bit 45198 -4 DATA_ERROR +bit 47575 -4 DATA_ERROR +bit 49952 -4 DATA_ERROR +bit 52329 -4 DATA_ERROR +all ok diff --git a/memcheck/tests/vcpu_bz2.vgtest b/memcheck/tests/vcpu_bz2.vgtest new file mode 100644 index 000000000..546133d8f --- /dev/null +++ b/memcheck/tests/vcpu_bz2.vgtest @@ -0,0 +1,3 @@ +prog: vcpu_bz2 +args: x +vgopts: -q diff --git a/perf/bz2.c b/perf/bz2.c index a0f089094..d1c58ef7a 100644 --- a/perf/bz2.c +++ b/perf/bz2.c @@ -5,6 +5,12 @@ // --profile-flags indicates that to get to the top 90%th percentile of // dynamic BB counts requires considering the top 51 basic blocks +// This program can be used both as part of the performance test +// suite, in which case we want it to run for quite a while, +// and as part of the regression (correctness) test suite, in +// which case we want it to run quickly and be verbose. +// So it does the latter iff given a command line arg. + // Licensing: the code within is mostly taken from bzip2, which has a BSD // license. There is a little code from Vex, which is GPL for // non-commercial use. And it's all written by Julian Seward. @@ -6429,13 +6435,38 @@ static HWord g_serviceFn ( HWord arg1, HWord arg2 ) } } -//void entry ( HWord(*service)(HWord,HWord) ) -int main ( void ) +static char *bzerrorstrings[] = { + "OK" + ,"SEQUENCE_ERROR" + ,"PARAM_ERROR" + ,"MEM_ERROR" + ,"DATA_ERROR" + ,"DATA_ERROR_MAGIC" + ,"IO_ERROR" + ,"UNEXPECTED_EOF" + ,"OUTBUFF_FULL" + ,"CONFIG_ERROR" + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ +}; + +// If given a cmd line arg, behave as a correctness regtest +// (run fast and be verbose). If not, run for a long time +// which is what is needed for the performance suite. +int main ( int argc, char** argv ) { int r; int bit; int i; + int regtest; + assert(argc == 1 || argc == 2); + regtest = argc==2; + serviceFn = g_serviceFn; set_inbuf(); @@ -6452,16 +6483,19 @@ int main ( void ) } vex_printf( "%d after compression\n", nZ ); - for (bit = 0; bit < nZ*8; bit += (bit < 35 ? 1 : 137)) { - //vex_printf( "bit %d ", bit ); + for (bit = 0; bit < nZ*8; bit += (bit < 35 ? 1 : (regtest?2377:137))) { + if (regtest) + vex_printf( "bit %d ", bit ); flip_bit ( bit ); nOut = M_BLOCK_OUT; r = BZ2_bzBuffToBuffDecompress ( outbuf, &nOut, zbuf, nZ, 1/*small*/, 0 ); - //vex_printf( " %d %s ", r, bzerrorstrings[-r] ); + if (regtest) + vex_printf( " %d %s ", r, bzerrorstrings[-r] ); if (r != BZ_OK) { - //vex_printf( "\n" ); + if (regtest) + vex_printf( "\n" ); } else { if (nOut != nIn) { vex_printf( "nIn/nOut mismatch %d %d\n", nIn, nOut ); |