summaryrefslogtreecommitdiff
path: root/tests/tar_target_filled.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-13 13:37:42 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-16 09:34:35 +0200
commitf757737060d4daebb24a32e90d912661428708a8 (patch)
treea6e96145d4fc540e435c13a69c924329db2edb6d /tests/tar_target_filled.c
parentc1a2cb729bd5bb5fdadf00cb3968bbc541f79750 (diff)
Remodel libtar/tar2sqfs to read data from an istream_t
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/tar_target_filled.c')
-rw-r--r--tests/tar_target_filled.c11
1 files changed, 6 insertions, 5 deletions
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;
}