From: Michael Tremer Date: Wed, 1 Nov 2023 14:51:44 +0000 (+0000) Subject: tests: Add a simple test for xfers X-Git-Tag: 0.9.30~1340 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adbe861c0155dddd5554a002ab3699074a99087c;p=pakfire.git tests: Add a simple test for xfers Signed-off-by: Michael Tremer --- diff --git a/.gitignore b/.gitignore index fca65496a..a2a7678bc 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ /tests/libpakfire/snapshot /tests/libpakfire/string /tests/libpakfire/util +/tests/libpakfire/xfer /tests/parser/test /tests/stub/root /tmp diff --git a/Makefile.am b/Makefile.am index 660ec4b10..aa1e0de0c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -613,7 +613,8 @@ check_PROGRAMS += \ tests/libpakfire/repo \ tests/libpakfire/snapshot \ tests/libpakfire/string \ - tests/libpakfire/util + tests/libpakfire/util \ + tests/libpakfire/xfer dist_tests_libpakfire_main_SOURCES = \ tests/libpakfire/main.c @@ -915,6 +916,18 @@ tests_libpakfire_util_CFLAGS = \ tests_libpakfire_util_LDADD = \ $(TESTSUITE_LDADD) +dist_tests_libpakfire_xfer_SOURCES = \ + tests/libpakfire/xfer.c + +tests_libpakfire_xfer_CPPFLAGS = \ + $(TESTSUITE_CPPFLAGS) + +tests_libpakfire_xfer_CFLAGS = \ + $(TESTSUITE_CFLAGS) + +tests_libpakfire_xfer_LDADD = \ + $(TESTSUITE_LDADD) + # ------------------------------------------------------------------------------ noinst_PROGRAMS += \ diff --git a/tests/libpakfire/xfer.c b/tests/libpakfire/xfer.c new file mode 100644 index 000000000..1b2ddf8d9 --- /dev/null +++ b/tests/libpakfire/xfer.c @@ -0,0 +1,46 @@ +/*############################################################################# +# # +# Pakfire - The IPFire package management system # +# Copyright (C) 2023 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 . # +# # +#############################################################################*/ + +#include + +#include "../testsuite.h" + +static int test_create(const struct test* t) { + struct pakfire_xfer* xfer = NULL; + int r = EXIT_FAILURE; + + // Create a new transfer + ASSERT_SUCCESS(pakfire_xfer_create(&xfer, t->ctx, t->httpclient, "file://invalid")); + + // Everything passed + r = EXIT_SUCCESS; + +FAIL: + if (xfer) + pakfire_xfer_unref(xfer); + + return r; +} + +int main(int argc, const char* argv[]) { + testsuite_add_test(test_create, TEST_WANTS_HTTPCLIENT); + + return testsuite_run(argc, argv); +}