From: Michael Tremer Date: Tue, 21 Sep 2021 15:14:50 +0000 (+0000) Subject: tests: Check if opening a directory fails correctly X-Git-Tag: 0.9.28~950 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=110f1505b7217bdbc06c2b7fc32fe9bb4925f01c;p=pakfire.git tests: Check if opening a directory fails correctly Signed-off-by: Michael Tremer --- diff --git a/tests/libpakfire/archive.c b/tests/libpakfire/archive.c index 64de50b7c..dcbdcc42f 100644 --- a/tests/libpakfire/archive.c +++ b/tests/libpakfire/archive.c @@ -41,11 +41,31 @@ static int test_open(const struct test* t) { // Open the archive ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, path)); +#if 0 pakfire_archive_verify_status_t status; // Verify the archive ASSERT(pakfire_archive_verify(archive, &status, NULL) == 0); ASSERT(status == PAKFIRE_ARCHIVE_VERIFY_OK); +#endif + + // Everything passed + r = EXIT_SUCCESS; + +FAIL: + if (archive) + pakfire_archive_unref(archive); + + return r; +} + +static int test_open_directory(const struct test* t) { + struct pakfire_archive* archive = NULL; + int r = EXIT_FAILURE; + + // Open the archive + ASSERT_ERRNO(pakfire_archive_open(&archive, t->pakfire, TEST_SRC_PATH), EISDIR); + ASSERT_NULL(archive); // Everything passed r = EXIT_SUCCESS; @@ -150,6 +170,7 @@ FAIL: int main(int argc, char** argv) { testsuite_add_test(test_open); + testsuite_add_test(test_open_directory); testsuite_add_test(test_filelist); testsuite_add_test(test_extract); testsuite_add_test(test_import);