diff options
Diffstat (limited to 'xdelta3-test.h')
-rw-r--r-- | xdelta3-test.h | 342 |
1 files changed, 94 insertions, 248 deletions
diff --git a/xdelta3-test.h b/xdelta3-test.h index 7ecaaaf..e9848b6 100644 --- a/xdelta3-test.h +++ b/xdelta3-test.h @@ -1,5 +1,5 @@ /* xdelta 3 - delta compression tools and library Copyright (C) 2001, - * 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012. + * 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012. * Joshua P. MacDonald * * This program is free software; you can redistribute it and/or modify @@ -54,7 +54,7 @@ void mt_init(mtrand *mt, uint32_t seed) { /* only MSBs of the array mt[]. */ /* 2002/01/09 modified by Makoto Matsumoto */ mt->mt_buffer_[i] = - (1812433253UL * (mt->mt_buffer_[i-1] ^ + (1812433253UL * (mt->mt_buffer_[i-1] ^ (mt->mt_buffer_[i-1] >> 30)) + i); } } @@ -69,20 +69,20 @@ uint32_t mt_random (mtrand *mt) { int kk; for (kk = 0; kk < MT_LEN - MT_IA; kk++) { - y = (mt->mt_buffer_[kk] & UPPER_MASK) | + y = (mt->mt_buffer_[kk] & UPPER_MASK) | (mt->mt_buffer_[kk + 1] & LOWER_MASK); - mt->mt_buffer_[kk] = mt->mt_buffer_[kk + MT_IA] ^ + mt->mt_buffer_[kk] = mt->mt_buffer_[kk + MT_IA] ^ (y >> 1) ^ mag01[y & 0x1UL]; } for (;kk < MT_LEN - 1; kk++) { - y = (mt->mt_buffer_[kk] & UPPER_MASK) | + y = (mt->mt_buffer_[kk] & UPPER_MASK) | (mt->mt_buffer_[kk + 1] & LOWER_MASK); - mt->mt_buffer_[kk] = mt->mt_buffer_[kk + (MT_IA - MT_LEN)] ^ + mt->mt_buffer_[kk] = mt->mt_buffer_[kk + (MT_IA - MT_LEN)] ^ (y >> 1) ^ mag01[y & 0x1UL]; } - y = (mt->mt_buffer_[MT_LEN - 1] & UPPER_MASK) | + y = (mt->mt_buffer_[MT_LEN - 1] & UPPER_MASK) | (mt->mt_buffer_[0] & LOWER_MASK); - mt->mt_buffer_[MT_LEN - 1] = mt->mt_buffer_[MT_IA - 1] ^ + mt->mt_buffer_[MT_LEN - 1] = mt->mt_buffer_[MT_IA - 1] ^ (y >> 1) ^ mag01[y & 0x1UL]; mt->mt_index_ = 0; } @@ -109,7 +109,7 @@ mt_exp_rand (uint32_t mean, uint32_t max_value) (double)UINT32_MAX)); uint32_t x = (uint32_t) (mean_d * erand + 0.5); - return xd3_min (x, max_value); + return min (x, max_value); } #if SHELL_TESTS @@ -139,10 +139,7 @@ static char TEST_RECON2_FILE[TESTFILESIZE]; static char TEST_COPY_FILE[TESTFILESIZE]; static char TEST_NOPERM_FILE[TESTFILESIZE]; -#define CHECK(cond) \ - if (!(cond)) { \ - XPR(NT __FILE__":%d: check failure: " #cond, __LINE__); \ - abort(); } +#define CHECK(cond) if (!(cond)) { XPR(NT "check failure: " #cond); abort(); } #if SHELL_TESTS /* Use a fixed soft config so that test values are fixed. See also @@ -169,7 +166,7 @@ static int do_cmd (xd3_stream *stream, const char *buf) { stream->msg = "abnormal command termination"; } - return ret; + return XD3_INTERNAL; } return 0; } @@ -202,7 +199,7 @@ test_random_numbers (xd3_stream *stream, int ignore) for (i = 0; i < n_rounds; i += 1) { - sum += mt_exp_rand (mean, UINT32_MAX); + sum += mt_exp_rand (mean, USIZE_T_MAX); } average = (double) sum / (double) n_rounds; @@ -218,26 +215,11 @@ test_random_numbers (xd3_stream *stream, int ignore) return XD3_INTERNAL; } -static int -test_printf_xoff (xd3_stream *stream, int ignore) -{ - char buf[64]; - xoff_t x = XOFF_T_MAX; - snprintf_func (buf, sizeof(buf), "%"Q"u", x); - const char *expect = XD3_USE_LARGEFILE64 ? - "18446744073709551615" : "4294967295"; - if (strcmp (buf, expect) == 0) { - return 0; - } - return XD3_INTERNAL; -} - static void test_unlink (char* file) { int ret; - if (file != NULL && *file != 0 && - (ret = unlink (file)) != 0 && errno != ENOENT) + if ((ret = unlink (file)) != 0 && errno != ENOENT) { XPR(NT "unlink %s failed: %s\n", file, strerror(ret)); } @@ -260,26 +242,14 @@ test_cleanup (void) int test_setup (void) { static int x = 0; - pid_t pid = getpid(); x++; - - test_cleanup(); - - snprintf_func (TEST_TARGET_FILE, TESTFILESIZE, - "/tmp/xdtest.%d.target.%d", pid, x); - snprintf_func (TEST_SOURCE_FILE, TESTFILESIZE, - "/tmp/xdtest.%d.source.%d", pid, x); - snprintf_func (TEST_DELTA_FILE, TESTFILESIZE, - "/tmp/xdtest.%d.delta.%d", pid, x); - snprintf_func (TEST_RECON_FILE, TESTFILESIZE, - "/tmp/xdtest.%d.recon.%d", pid, x); - snprintf_func (TEST_RECON2_FILE, TESTFILESIZE, - "/tmp/xdtest.%d.recon2.%d", pid, x); - snprintf_func (TEST_COPY_FILE, TESTFILESIZE, - "/tmp/xdtest.%d.copy.%d", pid, x); - snprintf_func (TEST_NOPERM_FILE, TESTFILESIZE, - "/tmp/xdtest.%d.noperm.%d", pid, x); - + snprintf_func (TEST_TARGET_FILE, TESTFILESIZE, "/tmp/xdtest.target.%d", x); + snprintf_func (TEST_SOURCE_FILE, TESTFILESIZE, "/tmp/xdtest.source.%d", x); + snprintf_func (TEST_DELTA_FILE, TESTFILESIZE, "/tmp/xdtest.delta.%d", x); + snprintf_func (TEST_RECON_FILE, TESTFILESIZE, "/tmp/xdtest.recon.%d", x); + snprintf_func (TEST_RECON2_FILE, TESTFILESIZE, "/tmp/xdtest.recon2.%d", x); + snprintf_func (TEST_COPY_FILE, TESTFILESIZE, "/tmp/xdtest.copy.%d", x); + snprintf_func (TEST_NOPERM_FILE, TESTFILESIZE, "/tmp/xdtest.noperm.%d", x); test_cleanup(); return 0; } @@ -287,10 +257,8 @@ int test_setup (void) static int test_make_inputs (xd3_stream *stream, xoff_t *ss_out, xoff_t *ts_out) { - usize_t ts = (mt_random (&static_mtrand) % TEST_FILE_MEAN) + - TEST_FILE_MEAN / 2; - usize_t ss = (mt_random (&static_mtrand) % TEST_FILE_MEAN) + - TEST_FILE_MEAN / 2; + usize_t ts = (mt_random (&static_mtrand) % TEST_FILE_MEAN) + TEST_FILE_MEAN / 2; + usize_t ss = (mt_random (&static_mtrand) % TEST_FILE_MEAN) + TEST_FILE_MEAN / 2; uint8_t *buf = (uint8_t*) malloc (ts + ss), *sbuf = buf, *tbuf = buf + ss; usize_t sadd = 0, sadd_max = (usize_t)(ss * TEST_ADD_RATIO); FILE *tf = NULL, *sf = NULL; @@ -330,7 +298,7 @@ test_make_inputs (xd3_stream *stream, xoff_t *ss_out, xoff_t *ts_out) double add_prob = (left == 0) ? 0 : (add_left / (double) left); int do_copy; - next = xd3_min (left, next); + next = min (left, next); do_copy = (next > add_left || (mt_random (&static_mtrand) / \ (double)USIZE_T_MAX) >= add_prob); @@ -441,7 +409,7 @@ test_compare_files (const char* tgt, const char *rec) { if (obuf[i] != rbuf[i]) { - XPR(NT "byte %u (read %u @ %"Q"u) %d != %d\n", + XPR(NT "byte %u (read %u @ %"Q"u) %d != %d\n", (int)i, (int)oc, offset, obuf[i], rbuf[i]); diffs++; return XD3_INTERNAL; @@ -453,7 +421,7 @@ test_compare_files (const char* tgt, const char *rec) fclose (orig); fclose (recons); - if (diffs != 0) + if (diffs != 0) { return XD3_INTERNAL; } @@ -461,12 +429,12 @@ test_compare_files (const char* tgt, const char *rec) } static int -test_copy_to (const char *from, const char *to) +test_save_copy (const char *origname) { char buf[TESTBUFSIZE]; int ret; - snprintf_func (buf, TESTBUFSIZE, "cp -f %s %s", from, to); + snprintf_func (buf, TESTBUFSIZE, "cp -f %s %s", origname, TEST_COPY_FILE); if ((ret = system (buf)) != 0) { @@ -477,12 +445,6 @@ test_copy_to (const char *from, const char *to) } static int -test_save_copy (const char *origname) -{ - return test_copy_to(origname, TEST_COPY_FILE); -} - -static int test_file_size (const char* file, xoff_t *size) { struct stat sbuf; @@ -537,7 +499,7 @@ test_read_integer_error (xd3_stream *stream, usize_t trunto, const char *msg) inp = buf->base; max = buf->base + buf->next - trunto; - if ((ret = xd3_read_uint32_t (stream, & inp, max, & rval)) != + if ((ret = xd3_read_uint32_t (stream, & inp, max, & rval)) != XD3_INVALID_INPUT || !MSG_IS (msg)) { @@ -707,13 +669,13 @@ test_forward_match (xd3_stream *stream, int unused) for (i = 0; i < 256; i++) { - CHECK(xd3_forward_match(buf1, buf2, i) == i); + CHECK(xd3_forward_match(buf1, buf2, i) == (int)i); } for (i = 0; i < 255; i++) { buf2[i] = 1; - CHECK(xd3_forward_match(buf1, buf2, 256) == i); + CHECK(xd3_forward_match(buf1, buf2, 256) == (int)i); buf2[i] = 0; } @@ -762,13 +724,13 @@ test_address_cache (xd3_stream *stream, int unused) usize_t prev_i; usize_t nearby; - p = (mt_random (&static_mtrand) / (double)UINT32_MAX); + p = (mt_random (&static_mtrand) / (double)USIZE_T_MAX); prev_i = mt_random (&static_mtrand) % offset; nearby = (mt_random (&static_mtrand) % 256) % offset; - nearby = xd3_max (1U, nearby); + nearby = max (1U, nearby); if (p < 0.1) { addr = addrs[offset-nearby]; } - else if (p < 0.4) { addr = xd3_min (addrs[prev_i] + nearby, offset-1); } + else if (p < 0.4) { addr = min (addrs[prev_i] + nearby, offset-1); } else { addr = prev_i; } if ((ret = xd3_encode_address (stream, addr, offset, & modes[offset]))) { return ret; } @@ -793,13 +755,9 @@ test_address_cache (xd3_stream *stream, int unused) for (offset = 1; offset < ADDR_CACHE_ROUNDS; offset += 1) { - usize_t addr; + uint32_t addr; - if ((ret = xd3_decode_address (stream, offset, modes[offset], - & buf, buf_max, & addr))) - { - return ret; - } + if ((ret = xd3_decode_address (stream, offset, modes[offset], & buf, buf_max, & addr))) { return ret; } if (addr != addrs[offset]) { @@ -918,7 +876,7 @@ test_decompress_text (xd3_stream *stream, uint8_t *enc, usize_t enc_size, usize_ input: /* Test decoding test_desize input bytes at a time */ - take = xd3_min (enc_size - pos, test_desize); + take = min (enc_size - pos, test_desize); CHECK(take > 0); xd3_avail_input (stream, enc + pos, take); @@ -1095,9 +1053,9 @@ test_decompress_single_bit_error (xd3_stream *stream, int expected_non_failures) } /* Check expected non-failures */ - if (non_failures > expected_non_failures) + if (non_failures != expected_non_failures) { - XPR(NT "non-failures %u > expected %u", + XPR(NT "non-failures %u; expected %u", non_failures, expected_non_failures); stream->msg = "incorrect"; return XD3_INTERNAL; @@ -1425,7 +1383,7 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, usize_t groups) if ((ret = sec->encode (stream, enc_stream, in_head, out_head, & cfg))) { - XPR(NT "test %"W"u: encode: %s", test_i, stream->msg); + XPR(NT "test %u: encode: %s", test_i, stream->msg); goto fail; } @@ -1464,7 +1422,7 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, usize_t groups) compress_size, dec_input, dec_correct, dec_output))) { - XPR(NT "test %"W"u: decode: %s", test_i, stream->msg); + XPR(NT "test %u: decode: %s", test_i, stream->msg); goto fail; } @@ -1474,7 +1432,7 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, usize_t groups) * decoding. Really looking for faults here. */ { int i; - int bytes = xd3_min (compress_size, 10U); + int bytes = min (compress_size, 10U); for (i = 0; i < bytes * 8; i += 1) { dec_input[i/8] ^= 1 << (i%8); @@ -1521,8 +1479,7 @@ IF_DJW (static int test_secondary_huff (xd3_stream *stream, usize_t gp) { return test_secondary (stream, & djw_sec_type, gp); }) IF_LZMA (static int test_secondary_lzma (xd3_stream *stream, usize_t gp) { return test_secondary (stream, & lzma_sec_type, gp); }) - -#endif /* SECONDARY_ANY */ +#endif /*********************************************************************** TEST INSTRUCTION TABLE @@ -1584,44 +1541,41 @@ test_choose_instruction (xd3_stream *stream, int ignore) return 0; } +/*********************************************************************** + TEST INSTRUCTION TABLE CODING + ***********************************************************************/ + +#if GENERIC_ENCODE_TABLES +/* Test that encoding and decoding a code table works */ static int -test_checksum_step (xd3_stream *stream, int ignore) +test_encode_code_table (xd3_stream *stream, int ignore) { - const int bufsize = 128; - uint8_t buf[128]; - for (int i = 0; i < bufsize; i++) - { - buf[i] = mt_random (&static_mtrand) & 0xff; - } + int ret; + const uint8_t *comp_data; + usize_t comp_size; - for (usize_t cksize = 4; cksize <= 32; cksize += 3) + if ((ret = xd3_compute_alternate_table_encoding (stream, & comp_data, & comp_size))) { - xd3_hash_cfg h1; - usize_t x; - int ret; + return ret; + } - if ((ret = xd3_size_hashtable (stream, XD3_ALLOCSIZE, cksize, &h1)) != 0) - { - return ret; - } + stream->acache.s_near = __alternate_code_table_desc.near_modes; + stream->acache.s_same = __alternate_code_table_desc.same_modes; - x = xd3_large_cksum (&h1, buf, cksize); - for (usize_t pos = 0; pos <= (bufsize - cksize); pos++) - { - usize_t y = xd3_large_cksum (&h1, buf + pos, cksize); - if (x != y) - { - stream->msg = "checksum != incremental checksum"; - return XD3_INTERNAL; - } - x = xd3_large_cksum_update (&h1, x, buf + pos, cksize); - } + if ((ret = xd3_apply_table_encoding (stream, comp_data, comp_size))) + { + return ret; + } - xd3_free (stream, h1.powers); + if (memcmp (stream->code_table, xd3_alternate_code_table (), sizeof (xd3_dinst) * 256) != 0) + { + stream->msg = "wrong code table reconstruction"; + return XD3_INTERNAL; } return 0; } +#endif /*********************************************************************** 64BIT STREAMING @@ -1700,11 +1654,11 @@ test_compressed_stream_overflow (xd3_stream *stream, int ignore) if ((buf = (uint8_t*) malloc (TWO_MEGS_AND_DELTA)) == NULL) { return ENOMEM; } memset (buf, 0, TWO_MEGS_AND_DELTA); - for (i = 0; i < (2 << 20); i += 256) + for (i = 0; i < (2 << 20); i += 256) { int j; int off = mt_random(& static_mtrand) % 10; - for (j = 0; j < 256; j++) + for (j = 0; j < 256; j++) { buf[i + j] = j + off; } @@ -1729,11 +1683,11 @@ test_compressed_stream_overflow (xd3_stream *stream, int ignore) } /* Test transfer of exactly 32bits worth of data. */ - if ((ret = test_streaming (stream, - buf, - buf + (1 << 20), - buf + (2 << 20), - 1 << 12))) + if ((ret = test_streaming (stream, + buf, + buf + (1 << 20), + buf + (2 << 20), + 1 << 12))) { goto fail; } @@ -1935,7 +1889,7 @@ test_recode_command2 (xd3_stream *stream, int has_source, } /* First encode */ - snprintf_func (ecmd, TESTBUFSIZE, "%s %s -f %s %s %s %s %s %s %s", + snprintf_func (ecmd, TESTBUFSIZE, "%s %s -f %s %s %s %s %s %s %s", program_name, test_softcfg_str, has_adler32 ? "" : "-n ", has_apphead ? "-A=encode_apphead " : "-A= ", @@ -1956,9 +1910,9 @@ test_recode_command2 (xd3_stream *stream, int has_source, snprintf_func (recmd, TESTBUFSIZE, "%s recode %s -f %s %s %s %s %s", program_name, test_softcfg_str, recoded_adler32 ? "" : "-n ", - !change_apphead ? "" : + !change_apphead ? "" : (recoded_apphead ? "-A=recode_apphead " : "-A= "), - recoded_secondary ? "-S djw " : "-S= ", + recoded_secondary ? "-S djw " : "-S none ", TEST_DELTA_FILE, TEST_COPY_FILE); @@ -2054,7 +2008,6 @@ test_recode_command2 (xd3_stream *stream, int has_source, { return ret; } - test_cleanup (); return 0; } @@ -2093,46 +2046,7 @@ test_recode_command (xd3_stream *stream, int ignore) return 0; } - -#if SECONDARY_LZMA -static int test_secondary_lzma_default (xd3_stream *stream, int ignore) -{ - char ecmd[TESTBUFSIZE]; - int ret; - - test_setup (); - - if ((ret = test_make_inputs (stream, NULL, NULL))) - { - return ret; - } - - /* First encode */ - snprintf_func (ecmd, TESTBUFSIZE, "%s -e %s %s", - program_name, - TEST_TARGET_FILE, - TEST_DELTA_FILE); - - if ((ret = system (ecmd)) != 0) - { - return XD3_INTERNAL; - } - - if ((ret = check_vcdiff_header (stream, - TEST_DELTA_FILE, - "VCDIFF secondary compressor", - "lzma", - 1))) - { - return ret; - } - - test_cleanup (); - return 0; -} - -#endif /* SECONDARY_LZMA */ -#endif /* SHELL_TESTS */ +#endif /*********************************************************************** EXTERNAL I/O DECOMPRESSION/RECOMPRESSION @@ -2447,77 +2361,6 @@ test_no_output (xd3_stream *stream, int ignore) return 0; } -/* This tests that the default appheader works */ -static int -test_appheader (xd3_stream *stream, int ignore) -{ - int i; - int ret; - char buf[TESTBUFSIZE]; - char bogus[TESTBUFSIZE]; - xoff_t ssize, tsize; - test_setup (); - - if ((ret = test_make_inputs (stream, &ssize, &tsize))) { return ret; } - - snprintf_func (buf, TESTBUFSIZE, "%s -q -f -e -s %s %s %s", program_name, - TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); - if ((ret = do_cmd (stream, buf))) { return ret; } - - if ((ret = test_copy_to (program_name, TEST_RECON2_FILE))) { return ret; } - - snprintf_func (buf, TESTBUFSIZE, "chmod 0700 %s", TEST_RECON2_FILE); - if ((ret = do_cmd (stream, buf))) { return ret; } - - if ((ret = test_save_copy (TEST_TARGET_FILE))) { return ret; } - if ((ret = test_copy_to (TEST_SOURCE_FILE, TEST_TARGET_FILE))) { return ret; } - - if ((ret = test_compare_files (TEST_TARGET_FILE, TEST_COPY_FILE)) == 0) - { - return XD3_INVALID; // I.e., files are different! - } - - // Test that the target file is restored. - snprintf_func (buf, TESTBUFSIZE, "(cd /tmp && %s -q -f -d %s)", - TEST_RECON2_FILE, - TEST_DELTA_FILE); - if ((ret = do_cmd (stream, buf))) { return ret; } - - if ((ret = test_compare_files (TEST_TARGET_FILE, TEST_COPY_FILE)) != 0) - { - return ret; - } - - // Test a malicious string w/ entries > 4 in the appheader by having - // the encoder write it: - for (i = 0; i < TESTBUFSIZE / 4; ++i) - { - bogus[2*i] = 'G'; - bogus[2*i+1] = '/'; - } - bogus[TESTBUFSIZE/2-1] = 0; - - snprintf_func (buf, TESTBUFSIZE, - "%s -q -f -A=%s -e -s %s %s %s", program_name, bogus, - TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); - if ((ret = do_cmd (stream, buf))) { return ret; } - // Then read it: - snprintf_func (buf, TESTBUFSIZE, "(cd /tmp && %s -q -f -d %s)", - TEST_RECON2_FILE, - TEST_DELTA_FILE); - if ((ret = do_cmd (stream, buf)) == 0) - { - return XD3_INVALID; // Impossible - } - if (!WIFEXITED(ret)) - { - return XD3_INVALID; // Must have crashed! - } - - test_cleanup (); - return 0; -} - /*********************************************************************** Source identical optimization ***********************************************************************/ @@ -2760,14 +2603,14 @@ test_string_matching (xd3_stream *stream, int ignore) default: CHECK(0); } - snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"W"u/%"W"u", + snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%d/%d", inst->pos, inst->size); rptr += strlen (rptr); if (inst->type == XD3_CPY) { *rptr++ = '@'; - snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Q"u", inst->addr); + snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Q"d", inst->addr); rptr += strlen (rptr); } @@ -2783,7 +2626,7 @@ test_string_matching (xd3_stream *stream, int ignore) if (strcmp (rbuf, test->result) != 0) { - XPR(NT "test %"W"u: expected %s: got %s", i, test->result, rbuf); + XPR(NT "test %u: expected %s: got %s", i, test->result, rbuf); stream->msg = "wrong result"; return XD3_INTERNAL; } @@ -2858,10 +2701,9 @@ test_iopt_flush_instructions (xd3_stream *stream, int ignore) /* * This tests the 32/64bit ambiguity for source-window matching. */ -#if !XD3_USE_LARGESIZET static int test_source_cksum_offset (xd3_stream *stream, int ignore) - { +{ xd3_source source; // Inputs are: @@ -2895,7 +2737,7 @@ test_source_cksum_offset (xd3_stream *stream, int ignore) stream->src = &source; for (test_ptr = cksum_test; test_ptr->cpos; test_ptr++) { - xoff_t r; + xoff_t r; stream->srcwin_cksum_pos = test_ptr->cpos; stream->total_in = test_ptr->ipos; @@ -2904,7 +2746,6 @@ test_source_cksum_offset (xd3_stream *stream, int ignore) } return 0; } -#endif /* !XD3_USE_LARGESIZET */ static int test_in_memory (xd3_stream *stream, int ignore) @@ -2947,7 +2788,8 @@ test_in_memory (xd3_stream *stream, int ignore) TEST MAIN ***********************************************************************/ -int xd3_selftest (void) +static int +xd3_selftest (void) { #define DO_TEST(fn,flags,arg) \ do { \ @@ -2968,26 +2810,27 @@ int xd3_selftest (void) int ret; DO_TEST (random_numbers, 0, 0); - DO_TEST (printf_xoff, 0, 0); DO_TEST (decode_integer_end_of_input, 0, 0); DO_TEST (decode_integer_overflow, 0, 0); DO_TEST (encode_decode_uint32_t, 0, 0); DO_TEST (encode_decode_uint64_t, 0, 0); DO_TEST (usize_t_overflow, 0, 0); - DO_TEST (checksum_step, 0, 0); DO_TEST (forward_match, 0, 0); + DO_TEST (address_cache, 0, 0); + IF_GENCODETBL (DO_TEST (address_cache, XD3_ALT_CODE_TABLE, 0)); DO_TEST (string_matching, 0, 0); DO_TEST (choose_instruction, 0, 0); DO_TEST (identical_behavior, 0, 0); DO_TEST (in_memory, 0, 0); + IF_GENCODETBL (DO_TEST (choose_instruction, XD3_ALT_CODE_TABLE, 0)); + IF_GENCODETBL (DO_TEST (encode_code_table, 0, 0)); + DO_TEST (iopt_flush_instructions, 0, 0); -#if !XD3_USE_LARGESIZET DO_TEST (source_cksum_offset, 0, 0); -#endif DO_TEST (decompress_single_bit_error, 0, 3); DO_TEST (decompress_single_bit_error, XD3_ADLER32, 3); @@ -2996,11 +2839,15 @@ int xd3_selftest (void) IF_FGK (DO_TEST (decompress_single_bit_error, XD3_SEC_FGK, 3)); IF_DJW (DO_TEST (decompress_single_bit_error, XD3_SEC_DJW, 8)); + /* There are many expected non-failures for ALT_CODE_TABLE because + * not all of the instruction codes are used. */ + IF_GENCODETBL ( + DO_TEST (decompress_single_bit_error, XD3_ALT_CODE_TABLE, 224)); + #if SHELL_TESTS DO_TEST (force_behavior, 0, 0); DO_TEST (stdout_behavior, 0, 0); DO_TEST (no_output, 0, 0); - DO_TEST (appheader, 0, 0); DO_TEST (command_line_arguments, 0, 0); #if EXTERNAL_COMPRESSION @@ -3009,7 +2856,6 @@ int xd3_selftest (void) #endif DO_TEST (recode_command, 0, 0); - IF_LZMA (DO_TEST (secondary_lzma_default, 0, 0)); #endif IF_LZMA (DO_TEST (secondary_lzma, 0, 1)); |