diff options
Diffstat (limited to 'xdelta3/xdelta3-test.h')
-rw-r--r-- | xdelta3/xdelta3-test.h | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h index 7cb9419..63b7978 100644 --- a/xdelta3/xdelta3-test.h +++ b/xdelta3/xdelta3-test.h | |||
@@ -225,7 +225,7 @@ test_unlink (char* file) | |||
225 | { | 225 | { |
226 | break; | 226 | break; |
227 | } | 227 | } |
228 | snprintf (buf, sizeof(buf), "rm -f %s", file); | 228 | snprintf_func (buf, sizeof(buf), "rm -f %s", file); |
229 | system (buf); | 229 | system (buf); |
230 | } | 230 | } |
231 | } | 231 | } |
@@ -248,13 +248,13 @@ int test_setup (void) | |||
248 | { | 248 | { |
249 | static int x = 0; | 249 | static int x = 0; |
250 | x++; | 250 | x++; |
251 | snprintf (TEST_TARGET_FILE, TESTFILESIZE, "/tmp/xdtest.target.%d", x); | 251 | snprintf_func (TEST_TARGET_FILE, TESTFILESIZE, "/tmp/xdtest.target.%d", x); |
252 | snprintf (TEST_SOURCE_FILE, TESTFILESIZE, "/tmp/xdtest.source.%d", x); | 252 | snprintf_func (TEST_SOURCE_FILE, TESTFILESIZE, "/tmp/xdtest.source.%d", x); |
253 | snprintf (TEST_DELTA_FILE, TESTFILESIZE, "/tmp/xdtest.delta.%d", x); | 253 | snprintf_func (TEST_DELTA_FILE, TESTFILESIZE, "/tmp/xdtest.delta.%d", x); |
254 | snprintf (TEST_RECON_FILE, TESTFILESIZE, "/tmp/xdtest.recon.%d", x); | 254 | snprintf_func (TEST_RECON_FILE, TESTFILESIZE, "/tmp/xdtest.recon.%d", x); |
255 | snprintf (TEST_RECON2_FILE, TESTFILESIZE, "/tmp/xdtest.recon2.%d", x); | 255 | snprintf_func (TEST_RECON2_FILE, TESTFILESIZE, "/tmp/xdtest.recon2.%d", x); |
256 | snprintf (TEST_COPY_FILE, TESTFILESIZE, "/tmp/xdtest.copy.%d", x); | 256 | snprintf_func (TEST_COPY_FILE, TESTFILESIZE, "/tmp/xdtest.copy.%d", x); |
257 | snprintf (TEST_NOPERM_FILE, TESTFILESIZE, "/tmp/xdtest.noperm.%d", x); | 257 | snprintf_func (TEST_NOPERM_FILE, TESTFILESIZE, "/tmp/xdtest.noperm.%d", x); |
258 | test_cleanup(); | 258 | test_cleanup(); |
259 | return 0; | 259 | return 0; |
260 | } | 260 | } |
@@ -413,9 +413,9 @@ compare_files (const char* tgt, const char *rec) | |||
413 | for (i = 0; i < oc; i += 1) | 413 | for (i = 0; i < oc; i += 1) |
414 | { | 414 | { |
415 | if (obuf[i] != rbuf[i]) | 415 | if (obuf[i] != rbuf[i]) |
416 | { | 416 | { |
417 | XPR(NT "byte %lu (read %lu @ %"Q"u) %d != %d\n", | 417 | XPR(NT "byte %u (read %u @ %"Q"u) %d != %d\n", |
418 | i, oc, offset, obuf[i], rbuf[i]); | 418 | (int)i, (int)oc, offset, obuf[i], rbuf[i]); |
419 | diffs++; | 419 | diffs++; |
420 | return XD3_INTERNAL; | 420 | return XD3_INTERNAL; |
421 | } | 421 | } |
@@ -439,7 +439,7 @@ test_save_copy (const char *origname) | |||
439 | char buf[TESTBUFSIZE]; | 439 | char buf[TESTBUFSIZE]; |
440 | int ret; | 440 | int ret; |
441 | 441 | ||
442 | snprintf (buf, TESTBUFSIZE, "cp -f %s %s", origname, TEST_COPY_FILE); | 442 | snprintf_func (buf, TESTBUFSIZE, "cp -f %s %s", origname, TEST_COPY_FILE); |
443 | 443 | ||
444 | if ((ret = system (buf)) != 0) | 444 | if ((ret = system (buf)) != 0) |
445 | { | 445 | { |
@@ -982,7 +982,7 @@ test_decompress_single_bit_error (xd3_stream *stream, int expected_non_failures) | |||
982 | { | 982 | { |
983 | char buf[TESTBUFSIZE]; | 983 | char buf[TESTBUFSIZE]; |
984 | FILE *f; | 984 | FILE *f; |
985 | snprintf (buf, TESTBUFSIZE, "test_text"); | 985 | snprintf_func (buf, TESTBUFSIZE, "test_text"); |
986 | f = fopen (buf, "w"); | 986 | f = fopen (buf, "w"); |
987 | fwrite (test_text,1,sizeof (test_text),f); | 987 | fwrite (test_text,1,sizeof (test_text),f); |
988 | fclose (f); | 988 | fclose (f); |
@@ -991,7 +991,7 @@ test_decompress_single_bit_error (xd3_stream *stream, int expected_non_failures) | |||
991 | do { \ | 991 | do { \ |
992 | char buf[TESTBUFSIZE]; \ | 992 | char buf[TESTBUFSIZE]; \ |
993 | FILE *f; \ | 993 | FILE *f; \ |
994 | snprintf (buf, TESTBUFSIZE, "test_text.xz.%d", non_failures); \ | 994 | snprintf_func (buf, TESTBUFSIZE, "test_text.xz.%d", non_failures); \ |
995 | f = fopen (buf, "w"); \ | 995 | f = fopen (buf, "w"); \ |
996 | fwrite (encoded,1,encoded_size,f); \ | 996 | fwrite (encoded,1,encoded_size,f); \ |
997 | fclose (f); \ | 997 | fclose (f); \ |
@@ -1734,9 +1734,9 @@ test_command_line_arguments (xd3_stream *stream, int ignore) | |||
1734 | test_setup (); | 1734 | test_setup (); |
1735 | if ((ret = test_make_inputs (stream, NULL, & tsize))) { return ret; } | 1735 | if ((ret = test_make_inputs (stream, NULL, & tsize))) { return ret; } |
1736 | 1736 | ||
1737 | snprintf (ecmd, TESTBUFSIZE, cmdpairs[2*i], program_name, | 1737 | snprintf_func (ecmd, TESTBUFSIZE, cmdpairs[2*i], program_name, |
1738 | test_softcfg_str, TEST_TARGET_FILE, TEST_DELTA_FILE); | 1738 | test_softcfg_str, TEST_TARGET_FILE, TEST_DELTA_FILE); |
1739 | snprintf (dcmd, TESTBUFSIZE, cmdpairs[2*i+1], program_name, | 1739 | snprintf_func (dcmd, TESTBUFSIZE, cmdpairs[2*i+1], program_name, |
1740 | TEST_DELTA_FILE, TEST_RECON_FILE); | 1740 | TEST_DELTA_FILE, TEST_RECON_FILE); |
1741 | 1741 | ||
1742 | /* Encode and decode. */ | 1742 | /* Encode and decode. */ |
@@ -1812,7 +1812,7 @@ check_vcdiff_header (xd3_stream *stream, | |||
1812 | int ret; | 1812 | int ret; |
1813 | char vcmd[TESTBUFSIZE], gcmd[TESTBUFSIZE]; | 1813 | char vcmd[TESTBUFSIZE], gcmd[TESTBUFSIZE]; |
1814 | 1814 | ||
1815 | snprintf (vcmd, TESTBUFSIZE, "%s printhdr -f %s %s", | 1815 | snprintf_func (vcmd, TESTBUFSIZE, "%s printhdr -f %s %s", |
1816 | program_name, input, TEST_RECON2_FILE); | 1816 | program_name, input, TEST_RECON2_FILE); |
1817 | 1817 | ||
1818 | if ((ret = system (vcmd)) != 0) | 1818 | if ((ret = system (vcmd)) != 0) |
@@ -1822,7 +1822,7 @@ check_vcdiff_header (xd3_stream *stream, | |||
1822 | return XD3_INTERNAL; | 1822 | return XD3_INTERNAL; |
1823 | } | 1823 | } |
1824 | 1824 | ||
1825 | snprintf (gcmd, TESTBUFSIZE, "grep \"%s.*%s.*\" %s > /dev/null", | 1825 | snprintf_func (gcmd, TESTBUFSIZE, "grep \"%s.*%s.*\" %s > /dev/null", |
1826 | line_start, matches, TEST_RECON2_FILE); | 1826 | line_start, matches, TEST_RECON2_FILE); |
1827 | 1827 | ||
1828 | if (yes_or_no) | 1828 | if (yes_or_no) |
@@ -1873,7 +1873,7 @@ test_recode_command2 (xd3_stream *stream, int has_source, | |||
1873 | } | 1873 | } |
1874 | 1874 | ||
1875 | /* First encode */ | 1875 | /* First encode */ |
1876 | snprintf (ecmd, TESTBUFSIZE, "%s %s -f %s %s %s %s %s %s %s", | 1876 | snprintf_func (ecmd, TESTBUFSIZE, "%s %s -f %s %s %s %s %s %s %s", |
1877 | program_name, test_softcfg_str, | 1877 | program_name, test_softcfg_str, |
1878 | has_adler32 ? "" : "-n ", | 1878 | has_adler32 ? "" : "-n ", |
1879 | has_apphead ? "-A=encode_apphead " : "-A= ", | 1879 | has_apphead ? "-A=encode_apphead " : "-A= ", |
@@ -1891,7 +1891,7 @@ test_recode_command2 (xd3_stream *stream, int has_source, | |||
1891 | } | 1891 | } |
1892 | 1892 | ||
1893 | /* Now recode */ | 1893 | /* Now recode */ |
1894 | snprintf (recmd, TESTBUFSIZE, | 1894 | snprintf_func (recmd, TESTBUFSIZE, |
1895 | "%s recode %s -f %s %s %s %s %s", program_name, test_softcfg_str, | 1895 | "%s recode %s -f %s %s %s %s %s", program_name, test_softcfg_str, |
1896 | recoded_adler32 ? "" : "-n ", | 1896 | recoded_adler32 ? "" : "-n ", |
1897 | !change_apphead ? "" : | 1897 | !change_apphead ? "" : |
@@ -1974,7 +1974,7 @@ test_recode_command2 (xd3_stream *stream, int has_source, | |||
1974 | } | 1974 | } |
1975 | 1975 | ||
1976 | /* Now decode */ | 1976 | /* Now decode */ |
1977 | snprintf (dcmd, TESTBUFSIZE, "%s -fd %s %s %s %s ", program_name, | 1977 | snprintf_func (dcmd, TESTBUFSIZE, "%s -fd %s %s %s %s ", program_name, |
1978 | has_source ? "-s " : "", | 1978 | has_source ? "-s " : "", |
1979 | has_source ? TEST_SOURCE_FILE : "", | 1979 | has_source ? TEST_SOURCE_FILE : "", |
1980 | TEST_COPY_FILE, | 1980 | TEST_COPY_FILE, |
@@ -2051,7 +2051,7 @@ test_compressed_pipe (xd3_stream *stream, main_extcomp *ext, char* buf, | |||
2051 | 2051 | ||
2052 | if (do_ext_recomp) | 2052 | if (do_ext_recomp) |
2053 | { | 2053 | { |
2054 | snprintf (decomp_buf, TESTBUFSIZE, | 2054 | snprintf_func (decomp_buf, TESTBUFSIZE, |
2055 | " | %s %s", ext->decomp_cmdname, ext->decomp_options); | 2055 | " | %s %s", ext->decomp_cmdname, ext->decomp_options); |
2056 | } | 2056 | } |
2057 | else | 2057 | else |
@@ -2059,7 +2059,7 @@ test_compressed_pipe (xd3_stream *stream, main_extcomp *ext, char* buf, | |||
2059 | decomp_buf[0] = 0; | 2059 | decomp_buf[0] = 0; |
2060 | } | 2060 | } |
2061 | 2061 | ||
2062 | snprintf (buf, TESTBUFSIZE, "%s %s < %s | %s %s | %s %s%s > %s", | 2062 | snprintf_func (buf, TESTBUFSIZE, "%s %s < %s | %s %s | %s %s%s > %s", |
2063 | ext->recomp_cmdname, ext->recomp_options, | 2063 | ext->recomp_cmdname, ext->recomp_options, |
2064 | TEST_TARGET_FILE, | 2064 | TEST_TARGET_FILE, |
2065 | program_name, comp_options, | 2065 | program_name, comp_options, |
@@ -2115,7 +2115,7 @@ test_externally_compressed_io (xd3_stream *stream, int ignore) | |||
2115 | main_extcomp *ext = & extcomp_types[i]; | 2115 | main_extcomp *ext = & extcomp_types[i]; |
2116 | 2116 | ||
2117 | /* Test for the existence of the external command first, if not skip. */ | 2117 | /* Test for the existence of the external command first, if not skip. */ |
2118 | snprintf (buf, TESTBUFSIZE, "%s %s < /dev/null > /dev/null", ext->recomp_cmdname, ext->recomp_options); | 2118 | snprintf_func (buf, TESTBUFSIZE, "%s %s < /dev/null > /dev/null", ext->recomp_cmdname, ext->recomp_options); |
2119 | 2119 | ||
2120 | if ((ret = system (buf)) != 0) | 2120 | if ((ret = system (buf)) != 0) |
2121 | { | 2121 | { |
@@ -2173,17 +2173,17 @@ test_source_decompression (xd3_stream *stream, int ignore) | |||
2173 | if ((ret = test_save_copy (TEST_TARGET_FILE))) { return ret; } | 2173 | if ((ret = test_save_copy (TEST_TARGET_FILE))) { return ret; } |
2174 | 2174 | ||
2175 | /* Compress the source. */ | 2175 | /* Compress the source. */ |
2176 | snprintf (buf, TESTBUFSIZE, "%s -1 %s < %s > %s", ext->recomp_cmdname, | 2176 | snprintf_func (buf, TESTBUFSIZE, "%s -1 %s < %s > %s", ext->recomp_cmdname, |
2177 | ext->recomp_options, TEST_COPY_FILE, TEST_SOURCE_FILE); | 2177 | ext->recomp_options, TEST_COPY_FILE, TEST_SOURCE_FILE); |
2178 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2178 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2179 | /* Compress the target. */ | 2179 | /* Compress the target. */ |
2180 | snprintf (buf, TESTBUFSIZE, "%s -9 %s < %s > %s", ext->recomp_cmdname, | 2180 | snprintf_func (buf, TESTBUFSIZE, "%s -9 %s < %s > %s", ext->recomp_cmdname, |
2181 | ext->recomp_options, TEST_COPY_FILE, TEST_TARGET_FILE); | 2181 | ext->recomp_options, TEST_COPY_FILE, TEST_TARGET_FILE); |
2182 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2182 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2183 | 2183 | ||
2184 | /* Now the two identical files are compressed. Delta-encode the target, | 2184 | /* Now the two identical files are compressed. Delta-encode the target, |
2185 | * with decompression. */ | 2185 | * with decompression. */ |
2186 | snprintf (buf, TESTBUFSIZE, "%s -e -vfq -s%s %s %s", program_name, TEST_SOURCE_FILE, | 2186 | snprintf_func (buf, TESTBUFSIZE, "%s -e -vfq -s%s %s %s", program_name, TEST_SOURCE_FILE, |
2187 | TEST_TARGET_FILE, TEST_DELTA_FILE); | 2187 | TEST_TARGET_FILE, TEST_DELTA_FILE); |
2188 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2188 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2189 | 2189 | ||
@@ -2200,7 +2200,7 @@ test_source_decompression (xd3_stream *stream, int ignore) | |||
2200 | 2200 | ||
2201 | /* Decode the delta file with recompression disabled, should get an | 2201 | /* Decode the delta file with recompression disabled, should get an |
2202 | * uncompressed file out. */ | 2202 | * uncompressed file out. */ |
2203 | snprintf (buf, TESTBUFSIZE, "%s -v -dq -R -s%s %s %s", program_name, | 2203 | snprintf_func (buf, TESTBUFSIZE, "%s -v -dq -R -s%s %s %s", program_name, |
2204 | TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); | 2204 | TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); |
2205 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2205 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2206 | if ((ret = compare_files (TEST_COPY_FILE, | 2206 | if ((ret = compare_files (TEST_COPY_FILE, |
@@ -2208,23 +2208,23 @@ test_source_decompression (xd3_stream *stream, int ignore) | |||
2208 | 2208 | ||
2209 | /* Decode the delta file with recompression, should get a compressed file | 2209 | /* Decode the delta file with recompression, should get a compressed file |
2210 | * out. But we can't compare compressed files directly. */ | 2210 | * out. But we can't compare compressed files directly. */ |
2211 | snprintf (buf, TESTBUFSIZE, "%s -v -dqf -s%s %s %s", program_name, | 2211 | snprintf_func (buf, TESTBUFSIZE, "%s -v -dqf -s%s %s %s", program_name, |
2212 | TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); | 2212 | TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); |
2213 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2213 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2214 | snprintf (buf, TESTBUFSIZE, "%s %s < %s > %s", ext->decomp_cmdname, ext->decomp_options, | 2214 | snprintf_func (buf, TESTBUFSIZE, "%s %s < %s > %s", ext->decomp_cmdname, ext->decomp_options, |
2215 | TEST_RECON_FILE, TEST_RECON2_FILE); | 2215 | TEST_RECON_FILE, TEST_RECON2_FILE); |
2216 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2216 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2217 | if ((ret = compare_files (TEST_COPY_FILE, | 2217 | if ((ret = compare_files (TEST_COPY_FILE, |
2218 | TEST_RECON2_FILE))) { return ret; } | 2218 | TEST_RECON2_FILE))) { return ret; } |
2219 | 2219 | ||
2220 | /* Encode with decompression disabled */ | 2220 | /* Encode with decompression disabled */ |
2221 | snprintf (buf, TESTBUFSIZE, "%s -e -D -vfq -s%s %s %s", program_name, | 2221 | snprintf_func (buf, TESTBUFSIZE, "%s -e -D -vfq -s%s %s %s", program_name, |
2222 | TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); | 2222 | TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); |
2223 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2223 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2224 | 2224 | ||
2225 | /* Decode the delta file with decompression disabled, should get the | 2225 | /* Decode the delta file with decompression disabled, should get the |
2226 | * identical compressed file out. */ | 2226 | * identical compressed file out. */ |
2227 | snprintf (buf, TESTBUFSIZE, "%s -d -D -vfq -s%s %s %s", program_name, | 2227 | snprintf_func (buf, TESTBUFSIZE, "%s -d -D -vfq -s%s %s %s", program_name, |
2228 | TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); | 2228 | TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); |
2229 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2229 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2230 | if ((ret = compare_files (TEST_TARGET_FILE, | 2230 | if ((ret = compare_files (TEST_TARGET_FILE, |
@@ -2250,21 +2250,21 @@ test_force_behavior (xd3_stream *stream, int ignore) | |||
2250 | 2250 | ||
2251 | /* Create empty target file */ | 2251 | /* Create empty target file */ |
2252 | test_setup (); | 2252 | test_setup (); |
2253 | snprintf (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE); | 2253 | snprintf_func (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE); |
2254 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2254 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2255 | 2255 | ||
2256 | /* Encode to delta file */ | 2256 | /* Encode to delta file */ |
2257 | snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name, | 2257 | snprintf_func (buf, TESTBUFSIZE, "%s -e %s %s", program_name, |
2258 | TEST_TARGET_FILE, TEST_DELTA_FILE); | 2258 | TEST_TARGET_FILE, TEST_DELTA_FILE); |
2259 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2259 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2260 | 2260 | ||
2261 | /* Encode again, should fail. */ | 2261 | /* Encode again, should fail. */ |
2262 | snprintf (buf, TESTBUFSIZE, "%s -q -e %s %s ", program_name, | 2262 | snprintf_func (buf, TESTBUFSIZE, "%s -q -e %s %s ", program_name, |
2263 | TEST_TARGET_FILE, TEST_DELTA_FILE); | 2263 | TEST_TARGET_FILE, TEST_DELTA_FILE); |
2264 | if ((ret = do_fail (stream, buf))) { return ret; } | 2264 | if ((ret = do_fail (stream, buf))) { return ret; } |
2265 | 2265 | ||
2266 | /* Force it, should succeed. */ | 2266 | /* Force it, should succeed. */ |
2267 | snprintf (buf, TESTBUFSIZE, "%s -f -e %s %s", program_name, | 2267 | snprintf_func (buf, TESTBUFSIZE, "%s -f -e %s %s", program_name, |
2268 | TEST_TARGET_FILE, TEST_DELTA_FILE); | 2268 | TEST_TARGET_FILE, TEST_DELTA_FILE); |
2269 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2269 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2270 | test_cleanup(); | 2270 | test_cleanup(); |
@@ -2281,26 +2281,26 @@ test_stdout_behavior (xd3_stream *stream, int ignore) | |||
2281 | char buf[TESTBUFSIZE]; | 2281 | char buf[TESTBUFSIZE]; |
2282 | 2282 | ||
2283 | test_setup(); | 2283 | test_setup(); |
2284 | snprintf (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE); | 2284 | snprintf_func (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE); |
2285 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2285 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2286 | 2286 | ||
2287 | /* Without -c, encode writes to delta file */ | 2287 | /* Without -c, encode writes to delta file */ |
2288 | snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name, | 2288 | snprintf_func (buf, TESTBUFSIZE, "%s -e %s %s", program_name, |
2289 | TEST_TARGET_FILE, TEST_DELTA_FILE); | 2289 | TEST_TARGET_FILE, TEST_DELTA_FILE); |
2290 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2290 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2291 | 2291 | ||
2292 | /* With -c, encode writes to stdout */ | 2292 | /* With -c, encode writes to stdout */ |
2293 | snprintf (buf, TESTBUFSIZE, "%s -e -c %s > %s", program_name, | 2293 | snprintf_func (buf, TESTBUFSIZE, "%s -e -c %s > %s", program_name, |
2294 | TEST_TARGET_FILE, TEST_DELTA_FILE); | 2294 | TEST_TARGET_FILE, TEST_DELTA_FILE); |
2295 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2295 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2296 | 2296 | ||
2297 | /* Without -c, decode writes to target file name, but it fails because the | 2297 | /* Without -c, decode writes to target file name, but it fails because the |
2298 | * file exists. */ | 2298 | * file exists. */ |
2299 | snprintf (buf, TESTBUFSIZE, "%s -q -d %s ", program_name, TEST_DELTA_FILE); | 2299 | snprintf_func (buf, TESTBUFSIZE, "%s -q -d %s ", program_name, TEST_DELTA_FILE); |
2300 | if ((ret = do_fail (stream, buf))) { return ret; } | 2300 | if ((ret = do_fail (stream, buf))) { return ret; } |
2301 | 2301 | ||
2302 | /* With -c, decode writes to stdout */ | 2302 | /* With -c, decode writes to stdout */ |
2303 | snprintf (buf, TESTBUFSIZE, "%s -d -c %s > /dev/null", program_name, TEST_DELTA_FILE); | 2303 | snprintf_func (buf, TESTBUFSIZE, "%s -d -c %s > /dev/null", program_name, TEST_DELTA_FILE); |
2304 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2304 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2305 | test_cleanup(); | 2305 | test_cleanup(); |
2306 | 2306 | ||
@@ -2316,29 +2316,29 @@ test_no_output (xd3_stream *stream, int ignore) | |||
2316 | 2316 | ||
2317 | test_setup (); | 2317 | test_setup (); |
2318 | 2318 | ||
2319 | snprintf (buf, TESTBUFSIZE, "touch %s && chmod 0000 %s", | 2319 | snprintf_func (buf, TESTBUFSIZE, "touch %s && chmod 0000 %s", |
2320 | TEST_NOPERM_FILE, TEST_NOPERM_FILE); | 2320 | TEST_NOPERM_FILE, TEST_NOPERM_FILE); |
2321 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2321 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2322 | 2322 | ||
2323 | if ((ret = test_make_inputs (stream, NULL, NULL))) { return ret; } | 2323 | if ((ret = test_make_inputs (stream, NULL, NULL))) { return ret; } |
2324 | 2324 | ||
2325 | /* Try no_output encode w/out unwritable output file */ | 2325 | /* Try no_output encode w/out unwritable output file */ |
2326 | snprintf (buf, TESTBUFSIZE, "%s -q -f -e %s %s", program_name, | 2326 | snprintf_func (buf, TESTBUFSIZE, "%s -q -f -e %s %s", program_name, |
2327 | TEST_TARGET_FILE, TEST_NOPERM_FILE); | 2327 | TEST_TARGET_FILE, TEST_NOPERM_FILE); |
2328 | if ((ret = do_fail (stream, buf))) { return ret; } | 2328 | if ((ret = do_fail (stream, buf))) { return ret; } |
2329 | snprintf (buf, TESTBUFSIZE, "%s -J -e %s %s", program_name, | 2329 | snprintf_func (buf, TESTBUFSIZE, "%s -J -e %s %s", program_name, |
2330 | TEST_TARGET_FILE, TEST_NOPERM_FILE); | 2330 | TEST_TARGET_FILE, TEST_NOPERM_FILE); |
2331 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2331 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2332 | 2332 | ||
2333 | /* Now really write the delta to test decode no-output */ | 2333 | /* Now really write the delta to test decode no-output */ |
2334 | snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name, | 2334 | snprintf_func (buf, TESTBUFSIZE, "%s -e %s %s", program_name, |
2335 | TEST_TARGET_FILE, TEST_DELTA_FILE); | 2335 | TEST_TARGET_FILE, TEST_DELTA_FILE); |
2336 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2336 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2337 | 2337 | ||
2338 | snprintf (buf, TESTBUFSIZE, "%s -q -f -d %s %s", program_name, | 2338 | snprintf_func (buf, TESTBUFSIZE, "%s -q -f -d %s %s", program_name, |
2339 | TEST_DELTA_FILE, TEST_NOPERM_FILE); | 2339 | TEST_DELTA_FILE, TEST_NOPERM_FILE); |
2340 | if ((ret = do_fail (stream, buf))) { return ret; } | 2340 | if ((ret = do_fail (stream, buf))) { return ret; } |
2341 | snprintf (buf, TESTBUFSIZE, "%s -J -d %s %s", program_name, | 2341 | snprintf_func (buf, TESTBUFSIZE, "%s -J -d %s %s", program_name, |
2342 | TEST_DELTA_FILE, TEST_NOPERM_FILE); | 2342 | TEST_DELTA_FILE, TEST_NOPERM_FILE); |
2343 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2343 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2344 | test_cleanup (); | 2344 | test_cleanup (); |
@@ -2589,13 +2589,13 @@ test_string_matching (xd3_stream *stream, int ignore) | |||
2589 | default: CHECK(0); | 2589 | default: CHECK(0); |
2590 | } | 2590 | } |
2591 | 2591 | ||
2592 | snprintf (rptr, TESTBUFSIZE, "%d/%d", inst->pos, inst->size); | 2592 | snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%d/%d", inst->pos, inst->size); |
2593 | rptr += strlen (rptr); | 2593 | rptr += strlen (rptr); |
2594 | 2594 | ||
2595 | if (inst->type == XD3_CPY) | 2595 | if (inst->type == XD3_CPY) |
2596 | { | 2596 | { |
2597 | *rptr++ = '@'; | 2597 | *rptr++ = '@'; |
2598 | snprintf (rptr, TESTBUFSIZE, "%"Q"d", inst->addr); | 2598 | snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Q"d", inst->addr); |
2599 | rptr += strlen (rptr); | 2599 | rptr += strlen (rptr); |
2600 | } | 2600 | } |
2601 | 2601 | ||