summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makemodule.am60
-rw-r--r--tests/tar_big_file.c7
-rw-r--r--tests/tar_fuzz.c14
-rw-r--r--tests/tar_simple.c9
-rw-r--r--tests/tar_sparse.c7
-rw-r--r--tests/tar_sparse_gnu.c7
-rw-r--r--tests/tar_target_filled.c11
-rw-r--r--tests/tar_xattr.c9
-rw-r--r--tests/tar_xattr_bin.c9
9 files changed, 69 insertions, 64 deletions
diff --git a/tests/Makemodule.am b/tests/Makemodule.am
index 809ff07..94bfd4b 100644
--- a/tests/Makemodule.am
+++ b/tests/Makemodule.am
@@ -62,164 +62,164 @@ test_filename_sane_w32_SOURCES += lib/fstree/filename_sane.c
test_filename_sane_w32_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_WIN32=1
test_tar_gnu0_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_gnu0_LDADD = libtar.a libcompat.a
+test_tar_gnu0_LDADD = libtar.a libfstream.a libcompat.a
test_tar_gnu0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_gnu0_CPPFLAGS += -DTESTFILE=format-acceptance/gnu.tar
test_tar_gnu1_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_gnu1_LDADD = libtar.a libcompat.a
+test_tar_gnu1_LDADD = libtar.a libfstream.a libcompat.a
test_tar_gnu1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_gnu1_CPPFLAGS += -DTESTFILE=format-acceptance/gnu-g.tar
test_tar_gnu2_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_gnu2_LDADD = libtar.a libcompat.a
+test_tar_gnu2_LDADD = libtar.a libfstream.a libcompat.a
test_tar_gnu2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_gnu2_CPPFLAGS += -DTESTFILE=user-group-largenum/gnu.tar
test_tar_gnu2_CPPFLAGS += -DTESTUID=0x80000000 -DTESTGID=0x80000000
test_tar_gnu2_CPPFLAGS += -DTESTTS=1542995392
test_tar_gnu3_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_gnu3_LDADD = libtar.a libcompat.a
+test_tar_gnu3_LDADD = libtar.a libfstream.a libcompat.a
test_tar_gnu3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_gnu3_CPPFLAGS += -DTESTFILE=negative-mtime/gnu.tar -DTESTTS=-315622800
test_tar_gnu4_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_gnu4_LDADD = libtar.a libcompat.a
+test_tar_gnu4_LDADD = libtar.a libfstream.a libcompat.a
test_tar_gnu4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_gnu4_CPPFLAGS += -DTESTFILE=long-paths/gnu.tar -DLONG_NAME_TEST
test_tar_gnu4_CPPFLAGS += -DTESTTS=1542909670
test_tar_gnu5_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_gnu5_LDADD = libtar.a libcompat.a
+test_tar_gnu5_LDADD = libtar.a libfstream.a libcompat.a
test_tar_gnu5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_gnu5_CPPFLAGS += -DTESTFILE=large-mtime/gnu.tar -DTESTTS=8589934592L
test_tar_gnu6_SOURCES = tests/tar_big_file.c tests/test.h tests/test_tar.h
-test_tar_gnu6_LDADD = libtar.a libcompat.a
+test_tar_gnu6_LDADD = libtar.a libfstream.a libcompat.a
test_tar_gnu6_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_gnu6_CPPFLAGS += -DTESTFILE=file-size/gnu.tar
test_tar_pax0_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_pax0_LDADD = libtar.a libcompat.a
+test_tar_pax0_LDADD = libtar.a libfstream.a libcompat.a
test_tar_pax0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_pax0_CPPFLAGS += -DTESTFILE=format-acceptance/pax.tar
test_tar_pax1_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_pax1_LDADD = libtar.a libcompat.a
+test_tar_pax1_LDADD = libtar.a libfstream.a libcompat.a
test_tar_pax1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_pax1_CPPFLAGS += -DTESTFILE=user-group-largenum/pax.tar
test_tar_pax1_CPPFLAGS += -DTESTUID=2147483648UL -DTESTGID=2147483648UL
test_tar_pax1_CPPFLAGS += -DTESTTS=1542995392
test_tar_pax2_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_pax2_LDADD = libtar.a libcompat.a
+test_tar_pax2_LDADD = libtar.a libfstream.a libcompat.a
test_tar_pax2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_pax2_CPPFLAGS += -DTESTFILE=large-mtime/pax.tar -DTESTTS=8589934592L
test_tar_pax3_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_pax3_LDADD = libtar.a libcompat.a
+test_tar_pax3_LDADD = libtar.a libfstream.a libcompat.a
test_tar_pax3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_pax3_CPPFLAGS += -DTESTFILE=negative-mtime/pax.tar -DTESTTS=-315622800
test_tar_pax4_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_pax4_LDADD = libtar.a libcompat.a
+test_tar_pax4_LDADD = libtar.a libfstream.a libcompat.a
test_tar_pax4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_pax4_CPPFLAGS += -DTESTFILE=long-paths/pax.tar
test_tar_pax4_CPPFLAGS += -DLONG_NAME_TEST -DTESTTS=1542909670
test_tar_pax5_SOURCES = tests/tar_big_file.c tests/test.h tests/test_tar.h
-test_tar_pax5_LDADD = libtar.a libcompat.a
+test_tar_pax5_LDADD = libtar.a libfstream.a libcompat.a
test_tar_pax5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_pax5_CPPFLAGS += -DTESTFILE=file-size/pax.tar
test_tar_ustar0_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_ustar0_LDADD = libtar.a libcompat.a
+test_tar_ustar0_LDADD = libtar.a libfstream.a libcompat.a
test_tar_ustar0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_ustar0_CPPFLAGS += -DTESTFILE=format-acceptance/ustar.tar
test_tar_ustar1_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_ustar1_LDADD = libtar.a libcompat.a
+test_tar_ustar1_LDADD = libtar.a libfstream.a libcompat.a
test_tar_ustar1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_ustar1_CPPFLAGS += -DTESTFILE=format-acceptance/ustar-pre-posix.tar
test_tar_ustar2_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_ustar2_LDADD = libtar.a libcompat.a
+test_tar_ustar2_LDADD = libtar.a libfstream.a libcompat.a
test_tar_ustar2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_ustar2_CPPFLAGS += -DTESTFILE=format-acceptance/v7.tar
test_tar_ustar3_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_ustar3_LDADD = libtar.a libcompat.a
+test_tar_ustar3_LDADD = libtar.a libfstream.a libcompat.a
test_tar_ustar3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_ustar3_CPPFLAGS += -DTESTFILE=user-group-largenum/8-digit.tar
test_tar_ustar3_CPPFLAGS += -DTESTUID=8388608 -DTESTGID=8388608
test_tar_ustar3_CPPFLAGS += -DTESTTS=1542995392
test_tar_ustar4_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_ustar4_LDADD = libtar.a libcompat.a
+test_tar_ustar4_LDADD = libtar.a libfstream.a libcompat.a
test_tar_ustar4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_ustar4_CPPFLAGS += -DTESTFILE=large-mtime/12-digit.tar
test_tar_ustar4_CPPFLAGS += -DTESTTS=8589934592L
test_tar_ustar5_SOURCES = tests/tar_simple.c tests/test.h tests/test_tar.h
-test_tar_ustar5_LDADD = libtar.a libcompat.a
+test_tar_ustar5_LDADD = libtar.a libfstream.a libcompat.a
test_tar_ustar5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_ustar5_CPPFLAGS += -DTESTFILE=long-paths/ustar.tar
test_tar_ustar5_CPPFLAGS += -DLONG_NAME_TEST -DTESTTS=1542909670
test_tar_ustar6_SOURCES = tests/tar_big_file.c tests/test.h tests/test_tar.h
-test_tar_ustar6_LDADD = libtar.a libcompat.a
+test_tar_ustar6_LDADD = libtar.a libfstream.a libcompat.a
test_tar_ustar6_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_ustar6_CPPFLAGS += -DTESTFILE=file-size/12-digit.tar
test_tar_target_filled_SOURCES = tests/tar_target_filled.c tests/test.h
test_tar_target_filled_SOURCES += tests/test_tar.h
-test_tar_target_filled_LDADD = libtar.a libcompat.a
+test_tar_target_filled_LDADD = libtar.a libfstream.a libcompat.a
test_tar_target_filled_CPPFLAGS = $(AM_CPPFLAGS)
test_tar_target_filled_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_sparse_gnu_SOURCES = tests/tar_sparse_gnu.c tests/test.h
test_tar_sparse_gnu_SOURCES += tests/test_tar.h
-test_tar_sparse_gnu_LDADD = libtar.a libcompat.a
+test_tar_sparse_gnu_LDADD = libtar.a libfstream.a libcompat.a
test_tar_sparse_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_sparse_gnu0_SOURCES = tests/tar_sparse.c tests/test.h tests/test_tar.h
-test_tar_sparse_gnu0_LDADD = libtar.a libcompat.a
+test_tar_sparse_gnu0_LDADD = libtar.a libfstream.a libcompat.a
test_tar_sparse_gnu0_CPPFLAGS = $(AM_CPPFLAGS)
test_tar_sparse_gnu0_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_sparse_gnu0_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu0-0.tar
test_tar_sparse_gnu1_SOURCES = tests/tar_sparse.c tests/test.h tests/test_tar.h
-test_tar_sparse_gnu1_LDADD = libtar.a libcompat.a
+test_tar_sparse_gnu1_LDADD = libtar.a libfstream.a libcompat.a
test_tar_sparse_gnu1_CPPFLAGS = $(AM_CPPFLAGS)
test_tar_sparse_gnu1_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_sparse_gnu1_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu0-1.tar
test_tar_sparse_gnu2_SOURCES = tests/tar_sparse.c tests/test.h tests/test_tar.h
-test_tar_sparse_gnu2_LDADD = libtar.a libcompat.a
+test_tar_sparse_gnu2_LDADD = libtar.a libfstream.a libcompat.a
test_tar_sparse_gnu2_CPPFLAGS = $(AM_CPPFLAGS)
test_tar_sparse_gnu2_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_sparse_gnu2_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu1-0.tar
test_tar_sparse_gnu3_SOURCES = tests/tar_sparse.c tests/test.h tests/test_tar.h
-test_tar_sparse_gnu3_LDADD = libtar.a libcompat.a
+test_tar_sparse_gnu3_LDADD = libtar.a libfstream.a libcompat.a
test_tar_sparse_gnu3_CPPFLAGS = $(AM_CPPFLAGS)
test_tar_sparse_gnu3_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_sparse_gnu3_CPPFLAGS += -DTESTFILE=sparse-files/gnu.tar
test_tar_xattr_bsd_SOURCES = tests/tar_xattr.c tests/test.h tests/test_tar.h
-test_tar_xattr_bsd_LDADD = libtar.a libcompat.a
+test_tar_xattr_bsd_LDADD = libtar.a libfstream.a libcompat.a
test_tar_xattr_bsd_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_xattr_bsd_CPPFLAGS += -DTESTFILE=xattr/xattr-libarchive.tar
test_tar_xattr_schily_SOURCES = tests/tar_xattr.c tests/test.h tests/test_tar.h
-test_tar_xattr_schily_LDADD = libtar.a libcompat.a
+test_tar_xattr_schily_LDADD = libtar.a libfstream.a libcompat.a
test_tar_xattr_schily_CPPFLAGS = $(AM_CPPFLAGS)
test_tar_xattr_schily_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_xattr_schily_CPPFLAGS += -DTESTFILE=xattr/xattr-schily.tar
test_tar_xattr_schily_bin_SOURCES = tests/tar_xattr_bin.c tests/test.h
test_tar_xattr_schily_bin_SOURCES += tests/test_tar.h
-test_tar_xattr_schily_bin_LDADD = libtar.a libcompat.a
+test_tar_xattr_schily_bin_LDADD = libtar.a libfstream.a libcompat.a
test_tar_xattr_schily_bin_CPPFLAGS = $(AM_CPPFLAGS)
test_tar_xattr_schily_bin_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar
test_tar_xattr_schily_bin_CPPFLAGS += -DTESTFILE=xattr/xattr-schily-binary.tar
@@ -228,7 +228,7 @@ fstree_fuzz_SOURCES = tests/fstree_fuzz.c
fstree_fuzz_LDADD = libfstree.a libcompat.a
tar_fuzz_SOURCES = tests/tar_fuzz.c
-tar_fuzz_LDADD = libtar.a libcompat.a
+tar_fuzz_LDADD = libtar.a libfstream.a libcompat.a
check_PROGRAMS += test_mknode_simple test_mknode_slink test_mknode_reg
check_PROGRAMS += test_mknode_dir test_gen_inode_numbers test_add_by_path
diff --git a/tests/tar_big_file.c b/tests/tar_big_file.c
index b949f60..66e4690 100644
--- a/tests/tar_big_file.c
+++ b/tests/tar_big_file.c
@@ -9,9 +9,10 @@
int main(void)
{
tar_header_decoded_t hdr;
- FILE *fp;
+ istream_t *fp;
- fp = test_open_read(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
TEST_EQUAL_UI(hdr.sb.st_mode, S_IFREG | 0644);
TEST_EQUAL_UI(hdr.sb.st_uid, 01750);
@@ -22,6 +23,6 @@ int main(void)
TEST_STR_EQUAL(hdr.name, "big-file.bin");
TEST_ASSERT(!hdr.unknown_record);
clear_header(&hdr);
- fclose(fp);
+ sqfs_destroy(fp);
return EXIT_SUCCESS;
}
diff --git a/tests/tar_fuzz.c b/tests/tar_fuzz.c
index f342e38..e5f5c0b 100644
--- a/tests/tar_fuzz.c
+++ b/tests/tar_fuzz.c
@@ -14,7 +14,7 @@
int main(int argc, char **argv)
{
tar_header_decoded_t hdr;
- FILE *fp;
+ istream_t *fp;
int ret;
if (argc != 2) {
@@ -22,11 +22,9 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- fp = fopen(argv[1], "rb");
- if (fp == NULL) {
- perror(argv[1]);
+ fp = istream_open_file(argv[1]);
+ if (fp == NULL)
return EXIT_FAILURE;
- }
for (;;) {
ret = read_header(fp, &hdr);
@@ -35,16 +33,16 @@ int main(int argc, char **argv)
if (ret < 0)
goto fail;
- ret = fseek(fp, hdr.sb.st_size, SEEK_CUR);
+ ret = istream_skip(fp, hdr.sb.st_size);
clear_header(&hdr);
if (ret < 0)
goto fail;
}
- fclose(fp);
+ sqfs_destroy(fp);
return EXIT_SUCCESS;
fail:
- fclose(fp);
+ sqfs_destroy(fp);
return EXIT_FAILURE;
}
diff --git a/tests/tar_simple.c b/tests/tar_simple.c
index 02bd521..6c5a47e 100644
--- a/tests/tar_simple.c
+++ b/tests/tar_simple.c
@@ -36,9 +36,10 @@ int main(void)
tar_header_decoded_t hdr;
char buffer[6];
sqfs_s64 ts;
- FILE *fp;
+ istream_t *fp;
- fp = test_open_read(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
TEST_EQUAL_UI(hdr.sb.st_mode, S_IFREG | 0644);
TEST_EQUAL_UI(hdr.sb.st_uid, TESTUID);
@@ -57,10 +58,10 @@ int main(void)
TEST_STR_EQUAL(hdr.name, fname);
TEST_ASSERT(!hdr.unknown_record);
- TEST_ASSERT(read_retry("tar data", fp, buffer, 5) == 0);
+ TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
clear_header(&hdr);
- fclose(fp);
+ sqfs_destroy(fp);
return EXIT_SUCCESS;
}
diff --git a/tests/tar_sparse.c b/tests/tar_sparse.c
index 50940d0..8e2976f 100644
--- a/tests/tar_sparse.c
+++ b/tests/tar_sparse.c
@@ -10,9 +10,10 @@ static void test_case_sparse(const char *path)
{
tar_header_decoded_t hdr;
sparse_map_t *sparse;
- FILE *fp;
+ istream_t *fp;
- fp = test_open_read(path);
+ fp = istream_open_file(path);
+ TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
TEST_EQUAL_UI(hdr.sb.st_mode, S_IFREG | 0644);
TEST_EQUAL_UI(hdr.sb.st_uid, 01750);
@@ -72,7 +73,7 @@ static void test_case_sparse(const char *path)
TEST_NULL(sparse);
clear_header(&hdr);
- fclose(fp);
+ sqfs_destroy(fp);
}
int main(void)
diff --git a/tests/tar_sparse_gnu.c b/tests/tar_sparse_gnu.c
index 216a54a..c1854a1 100644
--- a/tests/tar_sparse_gnu.c
+++ b/tests/tar_sparse_gnu.c
@@ -10,11 +10,12 @@ int main(void)
{
tar_header_decoded_t hdr;
sparse_map_t *sparse;
- FILE *fp;
+ istream_t *fp;
TEST_ASSERT(chdir(TEST_PATH) == 0);
- fp = test_open_read("sparse-files/gnu-small.tar");
+ fp = istream_open_file("sparse-files/gnu-small.tar");
+ TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
TEST_EQUAL_UI(hdr.sb.st_mode, S_IFREG | 0644);
TEST_EQUAL_UI(hdr.sb.st_uid, 01750);
@@ -43,6 +44,6 @@ int main(void)
TEST_NULL(sparse->next);
clear_header(&hdr);
- fclose(fp);
+ sqfs_destroy(fp);
return EXIT_SUCCESS;
}
diff --git a/tests/tar_target_filled.c b/tests/tar_target_filled.c
index 4098b39..7032239 100644
--- a/tests/tar_target_filled.c
+++ b/tests/tar_target_filled.c
@@ -10,11 +10,12 @@ int main(void)
{
tar_header_decoded_t hdr;
char buffer[16];
- FILE *fp;
+ istream_t *fp;
TEST_ASSERT(chdir(TEST_PATH) == 0);
- fp = test_open_read("format-acceptance/link_filled.tar");
+ fp = istream_open_file("format-acceptance/link_filled.tar");
+ TEST_NOT_NULL(fp);
/* "deep" directory hierarchy containg 2 files */
TEST_ASSERT(read_header(fp, &hdr) == 0);
@@ -45,7 +46,7 @@ int main(void)
"20_characters_here03/20_characters_here04/"
"errored_file_tst");
TEST_EQUAL_UI(hdr.sb.st_size, 5);
- TEST_ASSERT(read_retry("data0", fp, buffer, 5) == 0);
+ TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
TEST_ASSERT(skip_padding(fp, 5) == 0);
@@ -57,7 +58,7 @@ int main(void)
"20_characters_here03/20_characters_here04/"
"some_test_file");
TEST_EQUAL_UI(hdr.sb.st_size, 5);
- TEST_ASSERT(read_retry("data1", fp, buffer, 5) == 0);
+ TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
TEST_ASSERT(skip_padding(fp, 5) == 0);
@@ -99,7 +100,7 @@ int main(void)
/* end of file */
TEST_ASSERT(read_header(fp, &hdr) > 0);
- fclose(fp);
+ sqfs_destroy(fp);
return EXIT_SUCCESS;
}
diff --git a/tests/tar_xattr.c b/tests/tar_xattr.c
index 179af2e..e06b428 100644
--- a/tests/tar_xattr.c
+++ b/tests/tar_xattr.c
@@ -10,9 +10,10 @@ int main(void)
{
tar_header_decoded_t hdr;
char buffer[6];
- FILE *fp;
+ istream_t *fp;
- fp = test_open_read(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
TEST_EQUAL_UI(hdr.sb.st_mode, S_IFREG | 0644);
TEST_EQUAL_UI(hdr.sb.st_uid, 01750);
@@ -22,7 +23,7 @@ int main(void)
TEST_EQUAL_UI(hdr.mtime, 1543094477);
TEST_STR_EQUAL(hdr.name, "input.txt");
TEST_ASSERT(!hdr.unknown_record);
- TEST_ASSERT(read_retry("reading tar data", fp, buffer, 5) == 0);
+ TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
@@ -33,6 +34,6 @@ int main(void)
TEST_NULL(hdr.xattr->next);
clear_header(&hdr);
- fclose(fp);
+ sqfs_destroy(fp);
return EXIT_SUCCESS;
}
diff --git a/tests/tar_xattr_bin.c b/tests/tar_xattr_bin.c
index ca0f918..88bf3fd 100644
--- a/tests/tar_xattr_bin.c
+++ b/tests/tar_xattr_bin.c
@@ -18,9 +18,10 @@ int main(void)
{
tar_header_decoded_t hdr;
char buffer[6];
- FILE *fp;
+ istream_t *fp;
- fp = test_open_read(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
TEST_EQUAL_UI(hdr.sb.st_mode, S_IFREG | 0644);
TEST_EQUAL_UI(hdr.sb.st_uid, 01750);
@@ -30,7 +31,7 @@ int main(void)
TEST_EQUAL_UI(hdr.mtime, 1543094477);
TEST_STR_EQUAL(hdr.name, "input.txt");
TEST_ASSERT(!hdr.unknown_record);
- TEST_ASSERT(read_retry("data0", fp, buffer, 5) == 0);
+ TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
@@ -41,6 +42,6 @@ int main(void)
TEST_NULL(hdr.xattr->next);
clear_header(&hdr);
- fclose(fp);
+ sqfs_destroy(fp);
return EXIT_SUCCESS;
}