add testsuite

This commit is contained in:
Tobias Powalowski 2024-06-10 15:04:08 +02:00
parent 2e01092a11
commit bc023b9114
4 changed files with 53 additions and 4 deletions

View file

@ -15,9 +15,9 @@ _usage () {
[[ -z "${1}" ]] && _usage
_archboot_check
# update pacman db first
pacman -Sy
pacman --noconfirm -Sy
if [[ "${1}" == "base" ]]; then
pacman -S base
pacman --noconfirm -S base
_PACKAGE="$(pacman -Qi base | grep Depends | cut -d ":" -f2)"
else
_PACKAGE="${1}"

49
usr/bin/archboot-testsuite.sh Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
. /usr/lib/archboot/common.sh
LANG=C
_APPNAME=${0##*/}
_usage () {
echo "Tests for Archboot Environment"
echo "-------------------------------------------------"
echo "Basic tests for Archboot"
echo ""
echo "usage: ${_APPNAME} run"
exit 0
}
[[ -z "${1}" || "${1}" != "run" ]] && _usage
echo "Boot Test..."
if dmesg | grep -q error; then
dmesg | grep error
echo "Test failed!"
_TEST_FAIL=1
fi
echo "Binary Test..."
for i in /usr/bin/*; do
if ldd "${i}" 2>${_NO_LOG} | grep -q 'not found'; then
echo "${i}"
ldd "${i}" | grep 'not found'
echo "Test failed!"
_TEST_FAIL=1
fi
done
echo "Base Binary Test..."
_BASE_BLACKLIST="arpd backup bashbug enosys exch fsck.cramfs fsck.minix gawk-5.3.0 gawkbug gencat getconf iconv iconvconfig lastlog2 ld.so locale lsclocks makedb makepkg-template memusage memusagestat mkfs.bfs mkfs.cramfs mkfs.minix mtrace newgidmap newuidmap pcprofiledump pldd pstree.x11 restore routel run0 setpgid sln sotruss sprof systemd-confext systemd-cryptsetup systemd-delta systemd-repart systemd-run systemd-vmspawn varlinkctl xtrace"
archboot-binary-check.sh base
for i in grep '/usr/bin/' binary.txt | sed -e 's#^/usr/bin/##g'; do
if ! echo "${_BASE_BLACKLIST}" | grep -qw "${i}"; then
echo "Test failed!"
echo "${i}" >> base-binary.txt
_TEST_FAIL=1
fi
cat base-binary.txt
done
echo "Pacman Package Database Test..."
if ! archboot-not-installed.sh; then
echo "Test failed!"
cat not-installed.txt
_TEST_FAIL=1
fi
[[ -n "${_TEST_FAIL}" ]] && exit 1
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -6,7 +6,7 @@ _run ()
{
_dir /mnt/install
_map _binary genfstab arch-chroot pacstrap \
archboot-binary-check.sh archboot-not-installed.sh hwdetect
archboot-{binary-check.sh,not-installed.sh,testsuite.sh} hwdetect
_file_rename /usr/bin/archboot-setup.sh /usr/bin/setup
_file_rename /usr/bin/archboot-launcher.sh /usr/bin/launcher
_file_rename /usr/bin/archboot-quickinst.sh /usr/bin/quickinst

View file

@ -161,7 +161,7 @@ _download_latest_task() {
for i in ${_SCRIPTS}; do
[[ -e "${_BIN}/${i}" ]] && ${_DLPROG} -o "${_BIN}/${i}" "${_SOURCE}${_BIN}/archboot-${i}.sh?inline=false"
done
_SCRIPTS="binary-check.sh not-installed.sh secureboot-keys.sh mkkeys.sh hwsim.sh"
_SCRIPTS="binary-check.sh not-installed.sh secureboot-keys.sh testsuite.sh mkkeys.sh hwsim.sh"
for i in ${_SCRIPTS}; do
[[ -e "${_BIN}/${i}" ]] && ${_DLPROG} -o "${_BIN}/${i}" "${_SOURCE}${_BIN}/archboot-${i}?inline=false"
[[ -e "${_BIN}/archboot-${i}" ]] && ${_DLPROG} -o "${_BIN}/archboot-${i}" "${_SOURCE}${_BIN}/archboot-${i}?inline=false"