spiegel-keyman/linux/debian/tests/test-build
Eberhard Beilharz 468bb37ddf
chore(linux): Run and ignore autopkgtests on s390x
This change allows the autopkgtests to run on s390x architecture
but immediately exits the test with a successful return code.

(cherry picked from commit 2f716b3e51)
2023-03-22 19:35:52 +01:00

38 lines
1.1 KiB
Bash

#!/bin/bash
# autopkgtest check: Build a program against libkmnkbp-dev to verify that the
# headers and pkg-config file are included and installed correctly.
# cf https://github.com/keymanapp/keyman/issues/7490
set -e
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd "$WORKDIR"
if [ "$(dpkg --print-architecture)" == "s390x" ]; then
# libkmnkbp doesn't support big endian architectures
# (https://github.com/keymanapp/keyman/issues/5111), so it isn't
# build on s390x and we can't run the tests. Simply ignore.
echo "Not supported on s390x: OK"
exit 0
fi
# Test all include files are available
cat <<EOF > keymantest.c
#include <keyman/keyboardprocessor.h>
km_kbp_context* c;
EOF
# shellcheck disable=SC2046
gcc -c keymantest.c $(pkg-config --cflags --libs keyman_kmn_processor)
echo "build 1: OK"
# Test pkg-config file - include without path
cat <<EOF > keymantest.c
#include <keyboardprocessor.h>
km_kbp_context* c;
EOF
# shellcheck disable=SC2046
gcc -c keymantest.c $(pkg-config --cflags --libs keyman_kmn_processor)
echo "build 2: OK"