diff options
Diffstat (limited to 'xdelta3/xdelta3-test.h')
-rw-r--r-- | xdelta3/xdelta3-test.h | 213 |
1 files changed, 124 insertions, 89 deletions
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h index 0739e2d..a2d762a 100644 --- a/xdelta3/xdelta3-test.h +++ b/xdelta3/xdelta3-test.h | |||
@@ -49,12 +49,13 @@ static int test_exponential_dist (usize_t mean, usize_t max); | |||
49 | 49 | ||
50 | #define CHECK(cond) if (!(cond)) { DP(RINT "check failure: " #cond); abort(); } | 50 | #define CHECK(cond) if (!(cond)) { DP(RINT "check failure: " #cond); abort(); } |
51 | 51 | ||
52 | /* Use a fixed soft config so that test values are fixed. See also test_compress_text(). */ | 52 | /* Use a fixed soft config so that test values are fixed. See also |
53 | test_compress_text(). */ | ||
53 | static const char* test_softcfg_str = "-C64,64,4,128,16,8,128"; | 54 | static const char* test_softcfg_str = "-C64,64,4,128,16,8,128"; |
54 | 55 | ||
55 | /****************************************************************************************** | 56 | /*********************************************************************** |
56 | TEST HELPERS | 57 | TEST HELPERS |
57 | ******************************************************************************************/ | 58 | ***********************************************************************/ |
58 | 59 | ||
59 | static void DOT (void) { DP(RINT "."); } | 60 | static void DOT (void) { DP(RINT "."); } |
60 | static int do_cmd (xd3_stream *stream, const char *buf) | 61 | static int do_cmd (xd3_stream *stream, const char *buf) |
@@ -193,9 +194,10 @@ test_make_inputs (xd3_stream *stream, xoff_t *ss_out, xoff_t *ts_out) | |||
193 | goto failure; | 194 | goto failure; |
194 | } | 195 | } |
195 | 196 | ||
196 | /* Then modify the data to produce copies, everything not copied is an add. The | 197 | /* Then modify the data to produce copies, everything not copied is |
197 | * following logic produces the TEST_ADD_RATIO. The variable SADD contains the number | 198 | * an add. The following logic produces the TEST_ADD_RATIO. The |
198 | * of adds so far, which should not exceed SADD_MAX. */ | 199 | * variable SADD contains the number of adds so far, which should |
200 | * not exceed SADD_MAX. */ | ||
199 | for (i = 0; i < ss; ) | 201 | for (i = 0; i < ss; ) |
200 | { | 202 | { |
201 | usize_t left = ss - i; | 203 | usize_t left = ss - i; |
@@ -350,13 +352,14 @@ test_file_size (const char* file, xoff_t *size) | |||
350 | return 0; | 352 | return 0; |
351 | } | 353 | } |
352 | 354 | ||
353 | /****************************************************************************************** | 355 | /*********************************************************************** |
354 | READ OFFSET | 356 | READ OFFSET |
355 | ******************************************************************************************/ | 357 | ***********************************************************************/ |
356 | 358 | ||
357 | /* Common test for read_integer errors: encodes a 64-bit value and then attempts to read | 359 | /* Common test for read_integer errors: encodes a 64-bit value and |
358 | * as a 32-bit value. If TRUNC is non-zero, attempts to get errors by shortening the | 360 | * then attempts to read as a 32-bit value. If TRUNC is non-zero, |
359 | * input, otherwise it should overflow. Expects XD3_INTERNAL and MSG. */ | 361 | * attempts to get errors by shortening the input, otherwise it should |
362 | * overflow. Expects XD3_INTERNAL and MSG. */ | ||
360 | static int | 363 | static int |
361 | test_read_integer_error (xd3_stream *stream, int trunto, const char *msg) | 364 | test_read_integer_error (xd3_stream *stream, int trunto, const char *msg) |
362 | { | 365 | { |
@@ -538,9 +541,9 @@ test_usize_t_overflow (xd3_stream *stream, int unused) | |||
538 | return XD3_INTERNAL; | 541 | return XD3_INTERNAL; |
539 | } | 542 | } |
540 | 543 | ||
541 | /****************************************************************************************** | 544 | /*********************************************************************** |
542 | Address cache | 545 | Address cache |
543 | ******************************************************************************************/ | 546 | ***********************************************************************/ |
544 | 547 | ||
545 | static int | 548 | static int |
546 | test_address_cache (xd3_stream *stream, int unused) | 549 | test_address_cache (xd3_stream *stream, int unused) |
@@ -644,9 +647,9 @@ test_address_cache (xd3_stream *stream, int unused) | |||
644 | return 0; | 647 | return 0; |
645 | } | 648 | } |
646 | 649 | ||
647 | /****************************************************************************************** | 650 | /*********************************************************************** |
648 | Encode and decode with single bit error | 651 | Encode and decode with single bit error |
649 | ******************************************************************************************/ | 652 | ***********************************************************************/ |
650 | 653 | ||
651 | /* It compresses from 256 to around 185 bytes. | 654 | /* It compresses from 256 to around 185 bytes. |
652 | * Avoids matching addresses that are a single-bit difference. | 655 | * Avoids matching addresses that are a single-bit difference. |
@@ -814,9 +817,10 @@ test_decompress_single_bit_error (xd3_stream *stream, int expected_non_failures) | |||
814 | #if 1 | 817 | #if 1 |
815 | #define TEST_FAILURES() | 818 | #define TEST_FAILURES() |
816 | #else | 819 | #else |
817 | /* For checking non-failure cases by hand, enable this macro and run xdelta printdelta | 820 | /* For checking non-failure cases by hand, enable this macro and run |
818 | * with print_cpymode enabled. Every non-failure should change a copy address mode, | 821 | * xdelta printdelta with print_cpymode enabled. Every non-failure |
819 | * which doesn't cause a failure because the address cache starts out with all zeros. | 822 | * should change a copy address mode, which doesn't cause a failure |
823 | * because the address cache starts out with all zeros. | ||
820 | 824 | ||
821 | ./xdelta3 test | 825 | ./xdelta3 test |
822 | for i in test_text.xz.*; do ./xdelta3 printdelta $i > $i.out; diff $i.out test_text.xz.0.out; done | 826 | for i in test_text.xz.*; do ./xdelta3 printdelta $i > $i.out; diff $i.out test_text.xz.0.out; done |
@@ -909,9 +913,9 @@ test_decompress_single_bit_error (xd3_stream *stream, int expected_non_failures) | |||
909 | return 0; | 913 | return 0; |
910 | } | 914 | } |
911 | 915 | ||
912 | /****************************************************************************************** | 916 | /*********************************************************************** |
913 | Secondary compression tests | 917 | Secondary compression tests |
914 | ******************************************************************************************/ | 918 | ***********************************************************************/ |
915 | 919 | ||
916 | #if SECONDARY_ANY | 920 | #if SECONDARY_ANY |
917 | typedef int (*sec_dist_func) (xd3_stream *stream, xd3_output *data); | 921 | typedef int (*sec_dist_func) (xd3_stream *stream, xd3_output *data); |
@@ -1031,8 +1035,8 @@ sec_dist_func7 (xd3_stream *stream, xd3_output *data) | |||
1031 | return 0; | 1035 | return 0; |
1032 | } | 1036 | } |
1033 | 1037 | ||
1034 | /* Test distribution: A small number of frequent characters, difficult to divide into many | 1038 | /* Test distribution: A small number of frequent characters, difficult |
1035 | * groups */ | 1039 | * to divide into many groups */ |
1036 | static int | 1040 | static int |
1037 | sec_dist_func8 (xd3_stream *stream, xd3_output *data) | 1041 | sec_dist_func8 (xd3_stream *stream, xd3_output *data) |
1038 | { | 1042 | { |
@@ -1058,9 +1062,9 @@ sec_dist_func9 (xd3_stream *stream, xd3_output *data) | |||
1058 | int prom = 0; | 1062 | int prom = 0; |
1059 | int pcount = 0; | 1063 | int pcount = 0; |
1060 | 1064 | ||
1061 | /* 200 was long enough to trigger it--only when stricter checking that counted all | 1065 | /* 200 was long enough to trigger it--only when stricter checking |
1062 | * blocks was turned on, but it seems I deleted this code. (missing fgk_free_block on | 1066 | * that counted all blocks was turned on, but it seems I deleted |
1063 | * line 398). */ | 1067 | * this code. (missing fgk_free_block on line 398). */ |
1064 | for (i = 0; i < ALPHABET_SIZE*200; i += 1) | 1068 | for (i = 0; i < ALPHABET_SIZE*200; i += 1) |
1065 | { | 1069 | { |
1066 | repeat: | 1070 | repeat: |
@@ -1259,9 +1263,10 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, int groups) | |||
1259 | goto fail; | 1263 | goto fail; |
1260 | } | 1264 | } |
1261 | 1265 | ||
1262 | /* Single-bit error test, only cover the first 10 bytes. Some non-failures are | 1266 | /* Single-bit error test, only cover the first 10 bytes. |
1263 | * expected in the Huffman case: Changing the clclen array, for example, may not | 1267 | * Some non-failures are expected in the Huffman case: |
1264 | * harm the decoding. Really looking for faults here. */ | 1268 | * Changing the clclen array, for example, may not harm the |
1269 | * decoding. Really looking for faults here. */ | ||
1265 | { | 1270 | { |
1266 | int i; | 1271 | int i; |
1267 | int bytes = min (compress_size, 10U); | 1272 | int bytes = min (compress_size, 10U); |
@@ -1310,9 +1315,9 @@ IF_DJW (static int test_secondary_huff (xd3_stream *stream, int gp) | |||
1310 | { return test_secondary (stream, & djw_sec_type, gp); }) | 1315 | { return test_secondary (stream, & djw_sec_type, gp); }) |
1311 | #endif | 1316 | #endif |
1312 | 1317 | ||
1313 | /****************************************************************************************** | 1318 | /*********************************************************************** |
1314 | TEST INSTRUCTION TABLE | 1319 | TEST INSTRUCTION TABLE |
1315 | ******************************************************************************************/ | 1320 | ***********************************************************************/ |
1316 | 1321 | ||
1317 | /* Test that xd3_choose_instruction() does the right thing for its code table. */ | 1322 | /* Test that xd3_choose_instruction() does the right thing for its code table. */ |
1318 | static int | 1323 | static int |
@@ -1369,9 +1374,9 @@ test_choose_instruction (xd3_stream *stream, int ignore) | |||
1369 | return 0; | 1374 | return 0; |
1370 | } | 1375 | } |
1371 | 1376 | ||
1372 | /****************************************************************************************** | 1377 | /*********************************************************************** |
1373 | TEST INSTRUCTION TABLE CODING | 1378 | TEST INSTRUCTION TABLE CODING |
1374 | ******************************************************************************************/ | 1379 | ***********************************************************************/ |
1375 | 1380 | ||
1376 | #if GENERIC_ENCODE_TABLES | 1381 | #if GENERIC_ENCODE_TABLES |
1377 | /* Test that encoding and decoding a code table works */ | 1382 | /* Test that encoding and decoding a code table works */ |
@@ -1405,12 +1410,13 @@ test_encode_code_table (xd3_stream *stream, int ignore) | |||
1405 | } | 1410 | } |
1406 | #endif | 1411 | #endif |
1407 | 1412 | ||
1408 | /****************************************************************************************** | 1413 | /*********************************************************************** |
1409 | 64BIT STREAMING | 1414 | 64BIT STREAMING |
1410 | ******************************************************************************************/ | 1415 | ***********************************************************************/ |
1411 | 1416 | ||
1412 | /* This test encodes and decodes a series of 1 megabyte windows, each containing a long | 1417 | /* This test encodes and decodes a series of 1 megabyte windows, each |
1413 | * run of zeros along with a single xoff_t size record to indicate the sequence. */ | 1418 | * containing a long run of zeros along with a single xoff_t size |
1419 | * record to indicate the sequence. */ | ||
1414 | static int | 1420 | static int |
1415 | test_streaming (xd3_stream *in_stream, uint8_t *encbuf, uint8_t *decbuf, uint8_t *delbuf, usize_t megs) | 1421 | test_streaming (xd3_stream *in_stream, uint8_t *encbuf, uint8_t *decbuf, uint8_t *delbuf, usize_t megs) |
1416 | { | 1422 | { |
@@ -1503,14 +1509,16 @@ test_compressed_stream_overflow (xd3_stream *stream, int ignore) | |||
1503 | return ret; | 1509 | return ret; |
1504 | } | 1510 | } |
1505 | 1511 | ||
1506 | /****************************************************************************************** | 1512 | /*********************************************************************** |
1507 | COMMAND LINE | 1513 | COMMAND LINE |
1508 | ******************************************************************************************/ | 1514 | ***********************************************************************/ |
1509 | 1515 | ||
1510 | /* For each pair of command templates in the array below, test that encoding and decoding | 1516 | /* For each pair of command templates in the array below, test that |
1511 | * commands work. Also check for the expected size delta, which should be approximately | 1517 | * encoding and decoding commands work. Also check for the expected |
1512 | * TEST_ADD_RATIO times the file size created by test_make_inputs. Due to differences in | 1518 | * size delta, which should be approximately TEST_ADD_RATIO times the |
1513 | * the application header, it is suppressed (-A) so that all delta files are the same. */ | 1519 | * file size created by test_make_inputs. Due to differences in the |
1520 | * application header, it is suppressed (-A) so that all delta files | ||
1521 | * are the same. */ | ||
1514 | static int | 1522 | static int |
1515 | test_command_line_arguments (xd3_stream *stream, int ignore) | 1523 | test_command_line_arguments (xd3_stream *stream, int ignore) |
1516 | { | 1524 | { |
@@ -1616,14 +1624,15 @@ test_command_line_arguments (xd3_stream *stream, int ignore) | |||
1616 | return 0; | 1624 | return 0; |
1617 | } | 1625 | } |
1618 | 1626 | ||
1619 | /****************************************************************************************** | 1627 | /*********************************************************************** |
1620 | EXTERNAL I/O DECOMPRESSION/RECOMPRESSION | 1628 | EXTERNAL I/O DECOMPRESSION/RECOMPRESSION |
1621 | ******************************************************************************************/ | 1629 | ***********************************************************************/ |
1622 | 1630 | ||
1623 | #if EXTERNAL_COMPRESSION | 1631 | #if EXTERNAL_COMPRESSION |
1624 | /* This performs one step of the test_externally_compressed_io function described below. | 1632 | /* This performs one step of the test_externally_compressed_io |
1625 | * It builds a pipe containing both Xdelta and external compression/decompression that | 1633 | * function described below. It builds a pipe containing both Xdelta |
1626 | * should not modify the data passing through. */ | 1634 | * and external compression/decompression that should not modify the |
1635 | * data passing through. */ | ||
1627 | static int | 1636 | static int |
1628 | test_compressed_pipe (xd3_stream *stream, main_extcomp *ext, char* buf, | 1637 | test_compressed_pipe (xd3_stream *stream, main_extcomp *ext, char* buf, |
1629 | const char* comp_options, const char* decomp_options, | 1638 | const char* comp_options, const char* decomp_options, |
@@ -1668,11 +1677,12 @@ test_compressed_pipe (xd3_stream *stream, main_extcomp *ext, char* buf, | |||
1668 | * | 1677 | * |
1669 | * --> | gzip -cf | xdelta3 -cf | xdelta3 -dcf | gzip -dcf | --> | 1678 | * --> | gzip -cf | xdelta3 -cf | xdelta3 -dcf | gzip -dcf | --> |
1670 | * | 1679 | * |
1671 | * is transparent, i.e., does not modify the stream of data. However, we also want to | 1680 | * is transparent, i.e., does not modify the stream of data. However, |
1672 | * verify that at the center the data is properly compressed, i.e., that we do not just | 1681 | * we also want to verify that at the center the data is properly |
1673 | * have a re-compressed gzip format, that we have an VCDIFF format. We do this in two | 1682 | * compressed, i.e., that we do not just have a re-compressed gzip |
1674 | * steps. First test the above pipe, then test with suppressed output recompression | 1683 | * format, that we have an VCDIFF format. We do this in two steps. |
1675 | * (-D). The result should be the original input: | 1684 | * First test the above pipe, then test with suppressed output |
1685 | * recompression (-D). The result should be the original input: | ||
1676 | * | 1686 | * |
1677 | * --> | gzip -cf | xdelta3 -cf | xdelta3 -Ddcf | --> | 1687 | * --> | gzip -cf | xdelta3 -cf | xdelta3 -Ddcf | --> |
1678 | * | 1688 | * |
@@ -1717,14 +1727,17 @@ test_externally_compressed_io (xd3_stream *stream, int ignore) | |||
1717 | return 0; | 1727 | return 0; |
1718 | } | 1728 | } |
1719 | 1729 | ||
1720 | /* This tests the proper functioning of external decompression for source files. The | 1730 | /* This tests the proper functioning of external decompression for |
1721 | * source and target files are identical and compressed by gzip. Decoding such a delta | 1731 | * source files. The source and target files are identical and |
1722 | * with recompression disbaled (-R) should produce the original, uncompressed | 1732 | * compressed by gzip. Decoding such a delta with recompression |
1723 | * source/target file. Then it checks with output recompression enabled--in this case the | 1733 | * disbaled (-R) should produce the original, uncompressed |
1724 | * output should be a compressed copy of the original source/target file. Then it checks | 1734 | * source/target file. Then it checks with output recompression |
1725 | * that encoding with decompression disabled works--the compressed files are identical and | 1735 | * enabled--in this case the output should be a compressed copy of the |
1726 | * decoding them should always produce a compressed output, regardless of -R since the | 1736 | * original source/target file. Then it checks that encoding with |
1727 | * encoded delta file had decompression disabled.. | 1737 | * decompression disabled works--the compressed files are identical |
1738 | * and decoding them should always produce a compressed output, | ||
1739 | * regardless of -R since the encoded delta file had decompression | ||
1740 | * disabled.. | ||
1728 | */ | 1741 | */ |
1729 | static int | 1742 | static int |
1730 | test_source_decompression (xd3_stream *stream, int ignore) | 1743 | test_source_decompression (xd3_stream *stream, int ignore) |
@@ -1789,12 +1802,13 @@ test_source_decompression (xd3_stream *stream, int ignore) | |||
1789 | } | 1802 | } |
1790 | #endif | 1803 | #endif |
1791 | 1804 | ||
1792 | /****************************************************************************************** | 1805 | /*********************************************************************** |
1793 | FORCE, STDOUT | 1806 | FORCE, STDOUT |
1794 | ******************************************************************************************/ | 1807 | ***********************************************************************/ |
1795 | 1808 | ||
1796 | /* This tests that output will not overwrite an existing file unless -f was specified. | 1809 | /* This tests that output will not overwrite an existing file unless |
1797 | * The test is for encoding (the same code handles it for decoding). */ | 1810 | * -f was specified. The test is for encoding (the same code handles |
1811 | * it for decoding). */ | ||
1798 | static int | 1812 | static int |
1799 | test_force_behavior (xd3_stream *stream, int ignore) | 1813 | test_force_behavior (xd3_stream *stream, int ignore) |
1800 | { | 1814 | { |
@@ -1821,9 +1835,9 @@ test_force_behavior (xd3_stream *stream, int ignore) | |||
1821 | return 0; | 1835 | return 0; |
1822 | } | 1836 | } |
1823 | 1837 | ||
1824 | /* This checks the proper operation of the -c flag. When specified the default output | 1838 | /* This checks the proper operation of the -c flag. When specified |
1825 | * becomes stdout, otherwise the input must be provided (encode) or it may be defaulted | 1839 | * the default output becomes stdout, otherwise the input must be |
1826 | * (decode w/ app header). */ | 1840 | * provided (encode) or it may be defaulted (decode w/ app header). */ |
1827 | static int | 1841 | static int |
1828 | test_stdout_behavior (xd3_stream *stream, int ignore) | 1842 | test_stdout_behavior (xd3_stream *stream, int ignore) |
1829 | { | 1843 | { |
@@ -1886,13 +1900,14 @@ test_no_output (xd3_stream *stream, int ignore) | |||
1886 | return 0; | 1900 | return 0; |
1887 | } | 1901 | } |
1888 | 1902 | ||
1889 | /****************************************************************************************** | 1903 | /*********************************************************************** |
1890 | Source identical optimization | 1904 | Source identical optimization |
1891 | ******************************************************************************************/ | 1905 | ***********************************************************************/ |
1892 | 1906 | ||
1893 | /* Computing a delta should be fastest when the two inputs are identical, this checks it. | 1907 | /* Computing a delta should be fastest when the two inputs are |
1894 | * The library is called to compute a delta between a 10000 byte file, 1000 byte winsize, | 1908 | * identical, this checks it. The library is called to compute a |
1895 | * 500 byte source blocksize. The same buffer is used for both source and target. */ | 1909 | * delta between a 10000 byte file, 1000 byte winsize, 500 byte source |
1910 | * blocksize. The same buffer is used for both source and target. */ | ||
1896 | static int | 1911 | static int |
1897 | test_identical_behavior (xd3_stream *stream, int ignore) | 1912 | test_identical_behavior (xd3_stream *stream, int ignore) |
1898 | { | 1913 | { |
@@ -1907,7 +1922,9 @@ test_identical_behavior (xd3_stream *stream, int ignore) | |||
1907 | uint8_t del[IDB_DELSZ]; | 1922 | uint8_t del[IDB_DELSZ]; |
1908 | uint8_t rec[IDB_TGTSZ]; | 1923 | uint8_t rec[IDB_TGTSZ]; |
1909 | xd3_source source; | 1924 | xd3_source source; |
1910 | int encwin = 0; | 1925 | int nextencwin = 0; |
1926 | int winstarts = 0, winfinishes = 0; | ||
1927 | xoff_t srcwin = -1; | ||
1911 | usize_t delpos = 0, recsize; | 1928 | usize_t delpos = 0, recsize; |
1912 | xd3_config config; | 1929 | xd3_config config; |
1913 | 1930 | ||
@@ -1930,9 +1947,8 @@ test_identical_behavior (xd3_stream *stream, int ignore) | |||
1930 | 1947 | ||
1931 | if (ret == XD3_INPUT) | 1948 | if (ret == XD3_INPUT) |
1932 | { | 1949 | { |
1933 | if (encwin == IDB_WINCNT-1) { break; } | 1950 | xd3_avail_input (stream, buf + (IDB_WINSZ * nextencwin), IDB_WINSZ); |
1934 | xd3_avail_input (stream, buf + (IDB_WINSZ * encwin), IDB_WINSZ); | 1951 | nextencwin += 1; |
1935 | encwin += 1; | ||
1936 | continue; | 1952 | continue; |
1937 | } | 1953 | } |
1938 | 1954 | ||
@@ -1941,11 +1957,24 @@ test_identical_behavior (xd3_stream *stream, int ignore) | |||
1941 | source.curblkno = source.getblkno; | 1957 | source.curblkno = source.getblkno; |
1942 | source.onblk = IDB_BLKSZ; | 1958 | source.onblk = IDB_BLKSZ; |
1943 | source.curblk = buf + source.getblkno * IDB_BLKSZ; | 1959 | source.curblk = buf + source.getblkno * IDB_BLKSZ; |
1960 | srcwin = source.getblkno; | ||
1944 | continue; | 1961 | continue; |
1945 | } | 1962 | } |
1946 | 1963 | ||
1947 | if (ret == XD3_WINSTART) { continue; } | 1964 | if (ret == XD3_WINSTART) |
1948 | if (ret == XD3_WINFINISH) { continue; } | 1965 | { |
1966 | winstarts++; | ||
1967 | continue; | ||
1968 | } | ||
1969 | if (ret == XD3_WINFINISH) | ||
1970 | { | ||
1971 | winfinishes++; | ||
1972 | if (winfinishes == IDB_WINCNT) | ||
1973 | { | ||
1974 | break; | ||
1975 | } | ||
1976 | continue; | ||
1977 | } | ||
1949 | 1978 | ||
1950 | if (ret != XD3_OUTPUT) { goto fail; } | 1979 | if (ret != XD3_OUTPUT) { goto fail; } |
1951 | 1980 | ||
@@ -1958,6 +1987,11 @@ test_identical_behavior (xd3_stream *stream, int ignore) | |||
1958 | xd3_consume_output (stream); | 1987 | xd3_consume_output (stream); |
1959 | } | 1988 | } |
1960 | 1989 | ||
1990 | XD3_ASSERT(srcwin == source.blocks - 1); | ||
1991 | XD3_ASSERT(winfinishes == IDB_WINCNT); | ||
1992 | XD3_ASSERT(winstarts == IDB_WINCNT); | ||
1993 | XD3_ASSERT(nextencwin == IDB_WINCNT); | ||
1994 | |||
1961 | /* Reset. */ | 1995 | /* Reset. */ |
1962 | source.blksize = IDB_TGTSZ; | 1996 | source.blksize = IDB_TGTSZ; |
1963 | source.onblk = IDB_TGTSZ; | 1997 | source.onblk = IDB_TGTSZ; |
@@ -1982,7 +2016,8 @@ test_identical_behavior (xd3_stream *stream, int ignore) | |||
1982 | stream->n_add != 0 || | 2016 | stream->n_add != 0 || |
1983 | stream->n_run != 0) { stream->msg = "wrong copy count"; goto fail; }); | 2017 | stream->n_run != 0) { stream->msg = "wrong copy count"; goto fail; }); |
1984 | 2018 | ||
1985 | /* Check that no checksums were computed because the initial match was presumed. */ | 2019 | /* Check that no checksums were computed because the initial match |
2020 | was presumed. */ | ||
1986 | IF_DEBUG (if (stream->large_ckcnt != 0) { stream->msg = "wrong checksum behavior"; goto fail; }); | 2021 | IF_DEBUG (if (stream->large_ckcnt != 0) { stream->msg = "wrong checksum behavior"; goto fail; }); |
1987 | 2022 | ||
1988 | ret = 0; | 2023 | ret = 0; |
@@ -1990,12 +2025,12 @@ test_identical_behavior (xd3_stream *stream, int ignore) | |||
1990 | return ret; | 2025 | return ret; |
1991 | } | 2026 | } |
1992 | 2027 | ||
1993 | /****************************************************************************************** | 2028 | /*********************************************************************** |
1994 | String matching test | 2029 | String matching test |
1995 | ******************************************************************************************/ | 2030 | ***********************************************************************/ |
1996 | 2031 | ||
1997 | /* Check particular matching behaviors by calling xd3_string_match_soft directly with | 2032 | /* Check particular matching behaviors by calling |
1998 | * specific arguments. */ | 2033 | * xd3_string_match_soft directly with specific arguments. */ |
1999 | typedef struct _string_match_test string_match_test; | 2034 | typedef struct _string_match_test string_match_test; |
2000 | 2035 | ||
2001 | typedef enum | 2036 | typedef enum |
@@ -2285,9 +2320,9 @@ test_in_memory (xd3_stream *stream, int ignore) | |||
2285 | return 0; | 2320 | return 0; |
2286 | } | 2321 | } |
2287 | 2322 | ||
2288 | /****************************************************************************************** | 2323 | /*********************************************************************** |
2289 | TEST MAIN | 2324 | TEST MAIN |
2290 | ******************************************************************************************/ | 2325 | ***********************************************************************/ |
2291 | 2326 | ||
2292 | static int | 2327 | static int |
2293 | xd3_selftest (void) | 2328 | xd3_selftest (void) |
@@ -2322,13 +2357,13 @@ xd3_selftest (void) | |||
2322 | IF_GENCODETBL (DO_TEST (address_cache, XD3_ALT_CODE_TABLE, 0)); | 2357 | IF_GENCODETBL (DO_TEST (address_cache, XD3_ALT_CODE_TABLE, 0)); |
2323 | 2358 | ||
2324 | DO_TEST (string_matching, 0, 0); | 2359 | DO_TEST (string_matching, 0, 0); |
2325 | |||
2326 | DO_TEST (choose_instruction, 0, 0); | 2360 | DO_TEST (choose_instruction, 0, 0); |
2361 | DO_TEST (identical_behavior, 0, 0); | ||
2362 | DO_TEST (in_memory, 0, 0); | ||
2363 | |||
2327 | IF_GENCODETBL (DO_TEST (choose_instruction, XD3_ALT_CODE_TABLE, 0)); | 2364 | IF_GENCODETBL (DO_TEST (choose_instruction, XD3_ALT_CODE_TABLE, 0)); |
2328 | IF_GENCODETBL (DO_TEST (encode_code_table, 0, 0)); | 2365 | IF_GENCODETBL (DO_TEST (encode_code_table, 0, 0)); |
2329 | 2366 | ||
2330 | DO_TEST (in_memory, 0, 0); | ||
2331 | DO_TEST (identical_behavior, 0, 0); | ||
2332 | DO_TEST (iopt_flush_instructions, 0, 0); | 2367 | DO_TEST (iopt_flush_instructions, 0, 0); |
2333 | DO_TEST (source_cksum_offset, 0, 0); | 2368 | DO_TEST (source_cksum_offset, 0, 0); |
2334 | 2369 | ||