diff --git a/cpio/test/test_extract_cpio_lzo.c b/cpio/test/test_extract_cpio_lzo.c index f351ba7..99476af 100644 --- a/cpio/test/test_extract_cpio_lzo.c +++ b/cpio/test/test_extract_cpio_lzo.c @@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_extract_cpio_lzo) { - const char *reffile = "test_extract.cpio.lrz"; + const char *reffile = "test_extract.cpio.lzo"; int f; extract_reference_file(reffile); diff --git a/libarchive/test/test_write_filter_lzop.c b/libarchive/test/test_write_filter_lzop.c index 9e840bd..a32932c 100644 --- a/libarchive/test/test_write_filter_lzop.c +++ b/libarchive/test/test_write_filter_lzop.c @@ -39,7 +39,7 @@ DEFINE_TEST(test_write_filter_lzop) size_t buffsize, datasize; char path[16]; size_t used1, used2; - int i, r, use_prog = 0; + int i, r, use_prog = 0, filecount; assert((a = archive_write_new()) != NULL); r = archive_write_add_filter_lzop(a); @@ -58,9 +58,10 @@ DEFINE_TEST(test_write_filter_lzop) datasize = 10000; assert(NULL != (data = (char *)calloc(1, datasize))); + filecount = 10; /* - * Write a 100 files and read them all back. + * Write a filecount files and read them all back. */ assert((a = archive_write_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); @@ -77,7 +78,7 @@ DEFINE_TEST(test_write_filter_lzop) assert((ae = archive_entry_new()) != NULL); archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); @@ -97,7 +98,7 @@ DEFINE_TEST(test_write_filter_lzop) } else { assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) @@ -133,7 +134,7 @@ DEFINE_TEST(test_write_filter_lzop) archive_write_set_options(a, "lzop:compression-level=9")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); @@ -161,7 +162,7 @@ DEFINE_TEST(test_write_filter_lzop) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) @@ -186,7 +187,7 @@ DEFINE_TEST(test_write_filter_lzop) archive_write_set_filter_option(a, NULL, "compression-level", "1")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); @@ -216,7 +217,7 @@ DEFINE_TEST(test_write_filter_lzop) } else { assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) diff --git a/tar/test/test_option_b.c b/tar/test/test_option_b.c index be2ae65..7164d4c 100644 --- a/tar/test/test_option_b.c +++ b/tar/test/test_option_b.c @@ -25,8 +25,14 @@ #include "test.h" __FBSDID("$FreeBSD$"); +static char *ustar_opt = " --format=ustar"; + DEFINE_TEST(test_option_b) { + char *testprog_ustar = malloc(strlen(testprog) + strlen(ustar_opt) + 2); + strcpy(testprog_ustar, testprog); + strcat(testprog_ustar, ustar_opt); + assertMakeFile("file1", 0644, "file1"); if (systemf("cat file1 > test_cat.out 2> test_cat.err") != 0) { skipping("Platform doesn't have cat"); @@ -36,7 +42,7 @@ DEFINE_TEST(test_option_b) /* * Bsdtar does not pad if the output is going directly to a disk file. */ - assertEqualInt(0, systemf("%s -cf archive1.tar file1 >test1.out 2>test1.err", testprog)); + assertEqualInt(0, systemf("%s -cf archive1.tar file1 >test1.out 2>test1.err", testprog_ustar)); failure("bsdtar does not pad archives written directly to regular files"); assertFileSize("archive1.tar", 2048); assertEmptyFile("test1.out"); @@ -46,24 +52,24 @@ DEFINE_TEST(test_option_b) * Bsdtar does pad to the block size if the output is going to a socket. */ /* Default is -b 20 */ - assertEqualInt(0, systemf("%s -cf - file1 2>test2.err | cat >archive2.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - file1 2>test2.err | cat >archive2.tar ", testprog_ustar)); failure("bsdtar does pad archives written to pipes"); assertFileSize("archive2.tar", 10240); assertEmptyFile("test2.err"); - assertEqualInt(0, systemf("%s -cf - -b 20 file1 2>test3.err | cat >archive3.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - -b 20 file1 2>test3.err | cat >archive3.tar ", testprog_ustar)); assertFileSize("archive3.tar", 10240); assertEmptyFile("test3.err"); - assertEqualInt(0, systemf("%s -cf - -b 10 file1 2>test4.err | cat >archive4.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - -b 10 file1 2>test4.err | cat >archive4.tar ", testprog_ustar)); assertFileSize("archive4.tar", 5120); assertEmptyFile("test4.err"); - assertEqualInt(0, systemf("%s -cf - -b 1 file1 2>test5.err | cat >archive5.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - -b 1 file1 2>test5.err | cat >archive5.tar ", testprog_ustar)); assertFileSize("archive5.tar", 2048); assertEmptyFile("test5.err"); - assertEqualInt(0, systemf("%s -cf - -b 8192 file1 2>test6.err | cat >archive6.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - -b 8192 file1 2>test6.err | cat >archive6.tar ", testprog_ustar)); assertFileSize("archive6.tar", 4194304); assertEmptyFile("test6.err");