From: Michael Tremer Date: Sat, 27 Feb 2021 11:34:07 +0000 (+0000) Subject: tests: Parse beep.nm X-Git-Tag: 0.9.28~1285^2~684 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6a88c882b04b6b048f19547937d52ff9b50c86a;p=pakfire.git tests: Parse beep.nm Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 3d4a7b324..39ff27bef 100644 --- a/Makefile.am +++ b/Makefile.am @@ -647,6 +647,9 @@ EXTRA_DIST += \ tests/data/726D8B0B0889B04E.key \ tests/data/beep-1.3-2.ip3.x86_64.pfm \ \ + tests/data/beep.nm \ + tests/data/kernel.nm \ + \ tests/data/parser/test-comments.txt \ tests/data/parser/test-conditionals.txt \ tests/data/parser/test-declarations.txt \ diff --git a/tests/data/beep.nm b/tests/data/beep.nm new file mode 100644 index 000000000..4bd39c0c3 --- /dev/null +++ b/tests/data/beep.nm @@ -0,0 +1,47 @@ +############################################################################### +# IPFire.org - An Open Source Firewall Solution # +# Copyright (C) - IPFire Development Team # +############################################################################### + +name = beep +version = 1.3 +release = 2 + +groups = Applications/System +url = http://www.johnath.com/beep/ +license = GPLv2+ +summary = Beep the PC speaker any number of ways. + +description + Beep allows the user to control the PC speaker with precision, \ + allowing different sounds to indicate different events. While it \ + can be run quite happily on the commandline, it's intended place \ + of residence is within shell/perl scripts, notifying the user when \ + something interesting occurs. Of course, it has no notion of \ + what's interesting, but it's real good at that notifying part. +end + +source_dl = http://www.johnath.com/beep/ +tarball = %{thisapp}.tar.gz + +build + build + make FLAGS="%{CFLAGS} %{LDFLAGS}" %{PARALLELISMFLAGS} + end + + install + mkdir -pv %{BUILDROOT}/usr/bin + mkdir -pv %{BUILDROOT}/usr/share/man/man1 + + install -m 0755 beep %{BUILDROOT}/usr/bin + cp beep.1.gz %{BUILDROOT}/usr/share/man/man1 + end +end + +packages + package beep + + package %{name}-debuginfo + template DEBUGINFO + end +end diff --git a/tests/libpakfire/makefile.c b/tests/libpakfire/makefile.c index c0b839a93..3ee392c34 100644 --- a/tests/libpakfire/makefile.c +++ b/tests/libpakfire/makefile.c @@ -26,29 +26,34 @@ #include "../testsuite.h" -static int test_parse(const struct test* t) { - char* path = pakfire_path_join(TEST_SRC_PATH, "data/kernel.nm"); +static const char* makefiles[] = { + "data/beep.nm", + "data/kernel.nm", + NULL, +}; - // Open file - FILE* f = fopen(path, "r"); - ASSERT(f); +static int test_parse(const struct test* t) { + const char** makefile = makefiles; - PakfireParser parser = pakfire_parser_create(t->pakfire, NULL, NULL); + while (*makefile) { + char* path = pakfire_path_join(TEST_SRC_PATH, *makefile); - int r = pakfire_parser_read(parser, f); - ASSERT(r == 0); + // Open file + FILE* f = fopen(path, "r"); + ASSERT(f); - // Try to retrieve some value - char* value = pakfire_parser_get(parser, "sources"); - ASSERT(value); + PakfireParser parser = pakfire_parser_create(t->pakfire, NULL, NULL); - printf("VALUE: sources = %s\n", value); - free(value); + int r = pakfire_parser_read(parser, f); + ASSERT(r == 0); - // Cleanup - free(path); + pakfire_parser_unref(parser); + free(path); + fclose(f); - pakfire_parser_unref(parser); + // Next file + makefile++; + } return EXIT_SUCCESS; }