$(AM_CPPFLAGS) \
-I$(top_srcdir)/src \
-DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" \
- -DTEST_CONFIG_FILE=\"$(abs_top_srcdir)/contrib/config/pakfire.conf\" \
+ -DTEST_CONFIG_FILE=\"$(abs_top_srcdir)/tests/pakfire.conf\" \
-DTEST_DATA_DIR=\"$(abs_top_srcdir)/tests/data\" \
-DTEST_ROOTFS=\"$(TEST_ROOTFS)\" \
-DTEST_STUB_ROOT=\"$(TEST_STUB_ROOT)\"
struct testsuite ts;
static int test_run(int i, struct test* t) {
- struct pakfire_config* config = NULL;
struct pakfire_ctx* ctx = NULL;
struct pakfire* p = NULL;
int r;
// Log everything to the console
pakfire_ctx_set_log_callback(t->ctx, pakfire_log_stderr, NULL);
- // Create a pakfire instance (if requested)
- if (t->flags & TEST_WANTS_PAKFIRE) {
- // Create a configuration object
- r = pakfire_config_create(&config);
- if (r < 0) {
- LOG("Could not create configuration object: %s\n", strerror(-r));
- goto ERROR;
- }
+ // Create a configuration object
+ r = pakfire_config_create(&t->config);
+ if (r < 0) {
+ LOG("Could not create configuration object: %s\n", strerror(-r));
+ goto ERROR;
+ }
- // Read the configuration file
- r = pakfire_config_read_path(config, TEST_SRC_PATH "/pakfire.conf");
- if (r < 0) {
- LOG("Could not read the configuration: %s\n", strerror(-r));
- goto ERROR;
- }
+ // Read the configuration file
+ r = pakfire_config_read_path(t->config, TEST_CONFIG_FILE);
+ if (r < 0) {
+ LOG("Could not read the configuration: %s\n", strerror(-r));
+ goto ERROR;
+ }
- r = pakfire_create(&t->pakfire, t->ctx, config, TEST_STUB_ROOT, NULL, 0);
+ // Create a pakfire instance (if requested)
+ if (t->flags & TEST_WANTS_PAKFIRE) {
+ r = pakfire_create(&t->pakfire, t->ctx, t->config, TEST_STUB_ROOT, NULL, 0);
if (r < 0) {
LOG("ERROR: Could not initialize pakfire: %s\n", strerror(-r));
goto ERROR;
t->ctx = NULL;
}
- if (config)
- pakfire_config_unref(config);
+ if (t->config)
+ pakfire_config_unref(t->config);
return r;
}