struct pakfire_repo* repo = NULL;
char baseurl[1024];
int r = EXIT_FAILURE;
+ FILE* f = NULL;
pakfire_string_format(baseurl, "file://%s/data", TEST_SRC_PATH);
ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "test"));
ASSERT(repo);
+ // Set the base URL (where to scan for files)
ASSERT_SUCCESS(pakfire_repo_set_baseurl(repo, baseurl));
+ // Scan for all files in this directory
ASSERT_SUCCESS(pakfire_repo_scan(repo, 0));
// There should be one package in this repository now
ASSERT(pakfire_repo_count(repo) == 1);
+ // Allocate a temporary file
+ f = test_mktemp();
+ ASSERT(f);
+
+ // Write SOLV database
+ ASSERT_SUCCESS(pakfire_repo_write_solv(repo, f, 0));
+ rewind(f);
+
+ // Read SOLV database again
+ ASSERT_SUCCESS(pakfire_repo_read_solv(repo, f, 0));
+
+ // There should still be exactly one package be in this repository
+ ASSERT(pakfire_repo_count(repo) == 1);
+
// Everything passed
r = EXIT_SUCCESS;
FAIL:
if (repo)
pakfire_repo_unref(repo);
+ if (f)
+ fclose(f);
return r;
}