]> git.ipfire.org Git - pakfire.git/commitdiff
tests: Parse beep.nm
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 27 Feb 2021 11:34:07 +0000 (11:34 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 27 Feb 2021 11:34:07 +0000 (11:34 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
tests/data/beep.nm [new file with mode: 0644]
tests/libpakfire/makefile.c

index 3d4a7b3248d81c5343b029068a4efc6825cbdb32..39ff27bef91c61ba0113e69daf4fce4899a6b8df 100644 (file)
@@ -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 (file)
index 0000000..4bd39c0
--- /dev/null
@@ -0,0 +1,47 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info@ipfire.org>                   #
+###############################################################################
+
+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
index c0b839a9327508a3b79a8a0f0ab2f3b191e85a05..3ee392c3484b770bf36f7914ba547907aa8e195e 100644 (file)
 
 #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;
 }