summaryrefslogtreecommitdiff
path: root/tests/tar_simple.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_simple.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_simple.c')
-rw-r--r--tests/tar_simple.c9
1 files changed, 5 insertions, 4 deletions
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;
}