struct testsuite ts;
static int test_run(int i, struct test* t) {
- struct pakfire_ctx* ctx = NULL;
struct pakfire* p = NULL;
FILE* c = NULL;
LOG("running %s (%s)\n", t->name, root);
// Create a new context
- r = pakfire_ctx_create(&ctx, NULL);
+ r = pakfire_ctx_create(&t->ctx, NULL);
if (r) {
LOG("Could not create context: %m\n");
goto ERROR;
}
// Set the log level to DEBUG
- pakfire_ctx_set_log_level(ctx, LOG_DEBUG);
+ pakfire_ctx_set_log_level(t->ctx, LOG_DEBUG);
// Log everything to the console
- pakfire_ctx_set_log_callback(ctx, pakfire_log_stderr, NULL);
+ pakfire_ctx_set_log_callback(t->ctx, pakfire_log_stderr, NULL);
// Open the configuration file
c = fopen(TEST_SRC_PATH "/pakfire.conf", "r");
}
// Create a pakfire instance
- r = pakfire_create(&t->pakfire, ctx, root, NULL, c, 0);
+ r = pakfire_create(&t->pakfire, t->ctx, root, NULL, c, 0);
if (r) {
LOG("ERROR: Could not initialize pakfire: %m\n");
goto ERROR;
t->pakfire = NULL;
}
- if (ctx)
- pakfire_ctx_unref(ctx);
+ if (t->ctx)
+ pakfire_ctx_unref(t->ctx);
// Close the configuration file
if (c)