[neon/backports-focal/libaqbanking/Neon/release] debian/tests: debian/tests: Add minimal compile/execute test
Micha Lenk
null at kde.org
Wed Mar 24 09:53:25 GMT 2021
Git commit 47d6d899baa163c237c0b501692d14805b1c2b8d by Micha Lenk.
Committed on 11/03/2021 at 14:32.
Pushed by jriddell into branch 'Neon/release'.
debian/tests: Add minimal compile/execute test
A +31 -0 debian/tests/compile-execute-test.inc.sh
A +2 -0 debian/tests/control
A +5 -0 debian/tests/libaqbanking-dev
A +28 -0 debian/tests/src/libaqbanking-dev.c *
The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.
https://invent.kde.org/neon/backports-focal/libaqbanking/commit/47d6d899baa163c237c0b501692d14805b1c2b8d
diff --git a/debian/tests/compile-execute-test.inc.sh b/debian/tests/compile-execute-test.inc.sh
new file mode 100644
index 0000000..6891821
--- /dev/null
+++ b/debian/tests/compile-execute-test.inc.sh
@@ -0,0 +1,31 @@
+#! /bin/sh
+
+echoexec() {
+ echo $@
+ $@
+}
+
+compile_execute_test() {
+ local name=${0##*/}
+ local package="$@"
+
+ CFLAGS=$(pkg-config --cflags $package)
+ LIBS=$(pkg-config --libs $package)
+
+ echo "Using CFLAGS: $CFLAGS"
+ echo "Using LIBS: $LIBS"
+ echo
+ echo "Compiling ${name}.c"
+ echoexec gcc -c -o $ADTTMP/${name}.o debian/tests/src/${name}.c $CFLAGS
+ echo
+ echo "Linking ${name}"
+ echoexec gcc -o $ADTTMP/$name $ADTTMP/${name}.o $LIBS
+ echo
+ set -x
+ mkdir -pv $ADTTMP/home
+ export HOME=$ADTTMP/home
+ chmod a+x $ADTTMP/$name
+ set +x
+ echo "Execute built binary: ${name}"
+ echoexec $ADTTMP/$name
+}
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..f96ffed
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: libaqbanking-dev
+Depends: build-essential, pkg-config, libaqbanking-dev
diff --git a/debian/tests/libaqbanking-dev b/debian/tests/libaqbanking-dev
new file mode 100644
index 0000000..accadb4
--- /dev/null
+++ b/debian/tests/libaqbanking-dev
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+. debian/tests/compile-execute-test.inc.sh
+
+compile_execute_test aqbanking gwenhywfar
diff --git a/debian/tests/src/libaqbanking-dev.c b/debian/tests/src/libaqbanking-dev.c
new file mode 100644
index 0000000..2452c3f
--- /dev/null
+++ b/debian/tests/src/libaqbanking-dev.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+#include <aqbanking/banking.h>
+#include <gwenhywfar/cgui.h>
+
+int main(int argc, const char *argv[]) {
+ int major, minor, patchlevel, build;
+ AB_BANKING *banking;
+ GWEN_GUI *gui;
+
+ gui = GWEN_Gui_CGui_new();
+ GWEN_Gui_SetGui(gui);
+
+ banking = AB_Banking_new(__FILE__, NULL, 0);
+ AB_Banking_Init(banking);
+
+ AB_Banking_GetVersion(&major, &minor, &patchlevel, &build);
+
+ AB_Banking_Fini(banking);
+ AB_Banking_free(banking);
+
+ GWEN_Gui_free(gui);
+
+ printf("Successfully tested AqBanking %d.%d.%d.%d\n",
+ major, minor, patchlevel, build);
+
+ return 0;
+}
More information about the Neon-commits
mailing list