This makes it easier than bind-mounting the command.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
-DTEST_CONFIG_FILE=\"$(abs_top_srcdir)/contrib/config/pakfire.conf\" \
-DTEST_DATA_DIR=\"$(abs_top_srcdir)/tests/data\" \
-DTEST_ROOTFS=\"$(TEST_ROOTFS)\" \
- -DTEST_STUB_COMMAND=\"$(abs_top_builddir)/tests/stub/root/command\" \
-DTEST_STUB_ROOT=\"$(TEST_STUB_ROOT)\" \
-DPAKFIRE_PRIVATE
static int test_init(const struct test* t) {
LOG("Allocated at %p\n", t->pakfire);
- return EXIT_SUCCESS;
-}
-
-static int test_path(const struct test* t) {
- const char* path = pakfire_get_path(t->pakfire);
- ASSERT_STRING_STARTSWITH(path, TEST_ROOTFS);
+ // Check if the path matches
+ ASSERT_STRING_EQUALS(pakfire_get_path(t->pakfire), TEST_STUB_ROOT);
return EXIT_SUCCESS;
int main(int argc, const char* argv[]) {
testsuite_add_test(test_init, TEST_WANTS_PAKFIRE);
- testsuite_add_test(test_path, TEST_WANTS_PAKFIRE);
return testsuite_run(argc, argv);
}
// Create a pakfire instance (if requested)
if (t->flags & TEST_WANTS_PAKFIRE) {
- r = pakfire_create(&t->pakfire, t->ctx, NULL, NULL, c, 0);
+ r = pakfire_create(&t->pakfire, t->ctx, TEST_STUB_ROOT, NULL, c, 0);
if (r < 0) {
LOG("ERROR: Could not initialize pakfire: %s\n", strerror(-r));
goto ERROR;
LOG("ERROR: Pakfire was not initialized, but no error was raised: %m\n");
goto ERROR;
}
-
- // Copy command into environment
- r = pakfire_bind(t->pakfire, TEST_STUB_COMMAND, "/command", 0);
- if (r) {
- LOG("ERROR: Could not copy command: %m\n");
- goto ERROR;
- }
}
// Create a HTTP client (if requested)