postmarketos-mkinitfs-hook-ci: new aport (MR 4420)
Add a new initramfs hook for running tests in a CI environment. This hook automatically runs any scripts from /usr/libexec/ci-tests. Tests should be installed as a subpackage of some other package (e.g. qrtr) with an install_if clause to install them when this hook is installed. This allows platform specific packages like device packages to define tests that will automatically be installed and executed when building the initramfs for that device. See device/community/device-oneplus-enchilada for an example. Signed-off-by: Caleb Connolly <caleb@connolly.tech>
This commit is contained in:
parent
aecda04b22
commit
e22f6f684f
3 changed files with 71 additions and 0 deletions
8
main/postmarketos-mkinitfs-hook-ci/05-ci.files
Normal file
8
main/postmarketos-mkinitfs-hook-ci/05-ci.files
Normal file
|
@ -0,0 +1,8 @@
|
|||
/usr/libexec/pmos-tests-initramfs
|
||||
# We want all modules to be here so that we can validate
|
||||
# that all the device drivers load properly
|
||||
/lib/modules
|
||||
/sbin/udevd
|
||||
/bin/udevadm
|
||||
/etc/udev/rules.d
|
||||
/lib/udev/rules.d
|
38
main/postmarketos-mkinitfs-hook-ci/05-ci.sh
Normal file
38
main/postmarketos-mkinitfs-hook-ci/05-ci.sh
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC1091
|
||||
. ./init_functions.sh
|
||||
. /usr/share/misc/source_deviceinfo
|
||||
|
||||
TEST=""
|
||||
|
||||
DID_FAIL=0
|
||||
|
||||
echo "==> Running postmarketos-mkinitfs-hook-ci"
|
||||
echo "==> disabling dmesg on console"
|
||||
dmesg -n 2
|
||||
|
||||
for f in /usr/libexec/pmos-tests-initramfs/*; do
|
||||
echo -e "\n==> Running test $f\n\n"
|
||||
$f
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "==> FAIL: $f"
|
||||
DID_FAIL=1
|
||||
else
|
||||
echo "==> OK: $f"
|
||||
fi
|
||||
done
|
||||
|
||||
dmesg -n 8
|
||||
|
||||
if [ $DID_FAIL -ne 0 ]; then
|
||||
echo "==> PMOS-CI-FAIL"
|
||||
else
|
||||
echo "==> PMOS-CI-OK"
|
||||
fi
|
||||
|
||||
# We're done, kill it
|
||||
# CDBA will exit if it sees 20 '~' characters
|
||||
# in a row, send a whole bunch just to be sure
|
||||
# In the worst case it will timeout.
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
25
main/postmarketos-mkinitfs-hook-ci/APKBUILD
Normal file
25
main/postmarketos-mkinitfs-hook-ci/APKBUILD
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Maintainer: Caleb Connolly <caleb@connolly.tech>
|
||||
pkgname=postmarketos-mkinitfs-hook-ci
|
||||
pkgver=0.1.0
|
||||
pkgrel=0
|
||||
pkgdesc="Hook for doing automated CI tests in the initramfs"
|
||||
url="https://postmarketos.org"
|
||||
source="
|
||||
05-ci.sh
|
||||
05-ci.files
|
||||
"
|
||||
arch="noarch"
|
||||
license="GPL2"
|
||||
options="!check"
|
||||
|
||||
package() {
|
||||
install -Dm755 "$srcdir"/05-ci.sh \
|
||||
"$pkgdir"/usr/share/mkinitfs/hooks/05-ci.sh
|
||||
install -Dm644 "$srcdir"/05-ci.files \
|
||||
"$pkgdir"/usr/share/mkinitfs/files/05-ci.files
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
43f9d9a35a57845eb36893a3f20d8ff5f20b93b1c22c7c6e3959b07a41b3c5fe2f9941612620cf006a0018b53edae5fdc7ed3006befc6908c19a5617f322dea3 05-ci.sh
|
||||
35457ab221acd485ebde84fccac2187f36a074554c5f73828f2031f1e8e92ab7b3d46e654f0d7c62c0aa483c1d7f0dc901422fe0398ae0eae6995a2ae539a4af 05-ci.files
|
||||
"
|
Loading…
Reference in a new issue