From bcd6fc9c329b312ff9cd4340d9e0fea6c17b27df Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Mon, 25 Sep 2023 15:44:33 +0100 Subject: [PATCH] modem/qrtr: add ci tests (MR 4420) Add a basic test that runs qrtr-lookup and ensures that at least one QMI service is available. This is mostly a proof of concept and can be extended in the future. Signed-off-by: Caleb Connolly --- modem/qrtr/APKBUILD | 18 ++++++++++++++++-- modem/qrtr/lookup-test.files | 1 + modem/qrtr/lookup-test.sh | 13 +++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 modem/qrtr/lookup-test.files create mode 100644 modem/qrtr/lookup-test.sh diff --git a/modem/qrtr/APKBUILD b/modem/qrtr/APKBUILD index db926d337..30f905dac 100644 --- a/modem/qrtr/APKBUILD +++ b/modem/qrtr/APKBUILD @@ -2,17 +2,19 @@ pkgname=qrtr pkgver=0.3_git20201207 _commit="9dc7a88548c27983e06465d3fbba2ba27d4bc050" -pkgrel=0 +pkgrel=1 pkgdesc="Userspace reference for net/qrtr in the Linux kernel" url="https://github.com/andersson/qrtr" arch="all" license="BSD-3-Clause" depends_dev="linux-headers" makedepends="$depends_dev" -subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-openrc" +subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-openrc $pkgname-pmtest" source=" qrtr-$_commit.tar.gz::https://github.com/andersson/qrtr/archive/$_commit.tar.gz qrtr-ns.initd + lookup-test.files + lookup-test.sh " builddir="$srcdir/qrtr-$_commit" options="!check" @@ -29,7 +31,19 @@ package() { install -Dm755 "$srcdir"/qrtr-ns.initd "$pkgdir"/etc/init.d/qrtr-ns } +pmtest() { + install_if="$pkgname=$pkgver-r$pkgrel postmarketos-mkinitfs-hook-ci" + + install -Dm755 "$srcdir"/lookup-test.sh \ + "$subpkgdir"/usr/libexec/pmos-tests-initramfs/10-qrtr-lookup.sh + + install -Dm644 "$srcdir"/lookup-test.files \ + "$subpkgdir"/usr/share/mkinitfs/files/10-qrtr-lookup.files +} + sha512sums=" d3dd93983382a105372665dd1e1abb944adace37fabab0980dec3dded175586e37dc0da480d21be5876921274f4420bdf032bd5cc0e86ab951e3ec704ec396e0 qrtr-9dc7a88548c27983e06465d3fbba2ba27d4bc050.tar.gz 68c27e5c1c70ffdec0498cd4746208dd571e392ba030cf1a52f4a05394a57e399cf7437a1f27631dd288c7771fb656946aa27d7aec5b23d41fe13c5199ae390a qrtr-ns.initd +00b26c284b2765ddc46cf4b9eb4013e09ae96dfa4a9ac1c49f608a735579bbb442cda2a116417131c5dec234aca224bac824a2167f280990a04c90bc3065a51d lookup-test.files +6daecca1be580176cc275a07e87086151fe2426a4f032264a305a5deb49d888acd29e05e6efbabb1693cd5ebdfb62a7543138d2149c9a1154d1451b3d854dfdc lookup-test.sh " diff --git a/modem/qrtr/lookup-test.files b/modem/qrtr/lookup-test.files new file mode 100644 index 000000000..618f079b9 --- /dev/null +++ b/modem/qrtr/lookup-test.files @@ -0,0 +1 @@ +/usr/bin/qrtr-lookup \ No newline at end of file diff --git a/modem/qrtr/lookup-test.sh b/modem/qrtr/lookup-test.sh new file mode 100644 index 000000000..86dd9dccf --- /dev/null +++ b/modem/qrtr/lookup-test.sh @@ -0,0 +1,13 @@ +#!/bin/sh -e +# Automated test for qrtr-lookup +# Ensures that a DSP is running and exposes at least 1 service + +qrtr-lookup | tee /tmp/qrtr-lookup.log + +if [ $(wc -l /tmp/qrtr-lookup.log | cut -d' ' -f1) -gt 1 ]; then + echo "At least one QMI service is running" + exit 0 +fi + +echo "FAIL: No QMI service is running" +exit 1