]> git.ipfire.org Git - pakfire.git/commitdiff
testsuite: Add function to initialize Pakfire
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 28 Nov 2017 18:32:57 +0000 (19:32 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 28 Nov 2017 18:32:57 +0000 (19:32 +0100)
This will be used quite often, so that it is good to
just write this once.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
tests/libpakfire/main.c
tests/libpakfire/pakfire.h [new file with mode: 0644]

index fa524580e20931319f694bec3b3af8e43660b909..7549959d342f50e50cc4456f5df9746b836cbd78 100644 (file)
@@ -471,6 +471,7 @@ check_LTLIBRARIES = \
        tests/libtestsuite.la
 
 tests_libtestsuite_la_SOURCES = \
+       tests/pakfire.h \
        tests/testsuite.c \
        tests/testsuite.h
 
index 8487bd4071ee6cce0d84e6b44a7c4266aa422211..4d6108e14c7f2f135616d427b95ddb7177e0c3ec 100644 (file)
 
 #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 (file)
index 0000000..0512ab5
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+static Pakfire init_pakfire() {
+    const char* path = "/";
+
+    return pakfire_create(path, NULL);
+}