From f030bcc70c4e45e869254fdc323885ae1fc7c6e0 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 28 Nov 2017 19:32:57 +0100 Subject: [PATCH] testsuite: Add function to initialize Pakfire This will be used quite often, so that it is good to just write this once. Signed-off-by: Michael Tremer --- Makefile.am | 1 + tests/libpakfire/main.c | 4 +++- tests/libpakfire/pakfire.h | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/libpakfire/pakfire.h diff --git a/Makefile.am b/Makefile.am index fa524580e..7549959d3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -471,6 +471,7 @@ check_LTLIBRARIES = \ tests/libtestsuite.la tests_libtestsuite_la_SOURCES = \ + tests/pakfire.h \ tests/testsuite.c \ tests/testsuite.h diff --git a/tests/libpakfire/main.c b/tests/libpakfire/main.c index 8487bd407..4d6108e14 100644 --- a/tests/libpakfire/main.c +++ b/tests/libpakfire/main.c @@ -22,8 +22,10 @@ #include "../testsuite.h" +#include "pakfire.h" + static int test_init(const test_t* t) { - Pakfire pakfire = pakfire_create("/", "x86_64"); + Pakfire pakfire = init_pakfire(); if (!pakfire) return EXIT_FAILURE; diff --git a/tests/libpakfire/pakfire.h b/tests/libpakfire/pakfire.h new file mode 100644 index 000000000..0512ab5f1 --- /dev/null +++ b/tests/libpakfire/pakfire.h @@ -0,0 +1,25 @@ +/*############################################################################# +# # +# Pakfire - The IPFire package management system # +# Copyright (C) 2017 Pakfire development team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +static Pakfire init_pakfire() { + const char* path = "/"; + + return pakfire_create(path, NULL); +} -- 2.39.5