summaryrefslogtreecommitdiffstats
path: root/debian/tests/build-with-static-libsystemd
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/build-with-static-libsystemd38
1 files changed, 38 insertions, 0 deletions
diff --git a/debian/tests/build-with-static-libsystemd b/debian/tests/build-with-static-libsystemd
new file mode 100755
index 0000000..6b91009
--- /dev/null
+++ b/debian/tests/build-with-static-libsystemd
@@ -0,0 +1,38 @@
+#!/bin/sh
+# autopkgtest check: Test build against static libsystemd
+
+set -e
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+cat <<EOF > uuid-gen.c
+#include <assert.h>
+#include <stdio.h>
+
+#include <systemd/sd-id128.h>
+
+int main(void)
+{
+ sd_id128_t id;
+ char id_str[SD_ID128_STRING_MAX];
+ int r;
+
+ r = sd_id128_randomize(&id);
+ if (r < 0) {
+ fprintf(stderr, "Failed to generate id: %s\n", strerror(-r));
+ return 1;
+ }
+
+ assert(sd_id128_to_string(id, id_str) > 0);
+ printf("uuid: %s\n", id_str);
+
+ return 0;
+}
+EOF
+
+gcc -Wall -Werror -o uuid-gen uuid-gen.c -l:libsystemd.a -lcap
+echo "build: OK"
+[ -x uuid-gen ]
+./uuid-gen
+echo "run: OK"