2024-06-10 15:04:08 +02:00
|
|
|
#!/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
|
2024-06-10 15:37:27 +02:00
|
|
|
_LOG=testsuite.log
|
2024-06-10 15:04:08 +02:00
|
|
|
_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
|
2024-06-10 15:37:27 +02:00
|
|
|
echo "Boot Test running..."
|
2024-06-10 15:04:08 +02:00
|
|
|
if dmesg | grep -q error; then
|
2024-06-10 15:14:27 +02:00
|
|
|
dmesg | grep error >>dmesg-error.txt
|
2024-06-10 15:04:08 +02:00
|
|
|
_TEST_FAIL=1
|
|
|
|
fi
|
2024-06-10 15:37:27 +02:00
|
|
|
if [[ -f dmesg-error.txt ]]; then
|
|
|
|
echo "Test failed!"
|
|
|
|
cat dmesg-error.txt
|
|
|
|
else
|
|
|
|
echo "Test run succesfully."
|
|
|
|
fi
|
|
|
|
echo "Binary Test running..."
|
2024-06-10 15:04:08 +02:00
|
|
|
for i in /usr/bin/*; do
|
|
|
|
if ldd "${i}" 2>${_NO_LOG} | grep -q 'not found'; then
|
2024-06-10 15:14:27 +02:00
|
|
|
echo "${i}" >>binary-error.txt
|
2024-06-10 15:04:08 +02:00
|
|
|
ldd "${i}" | grep 'not found'
|
|
|
|
_TEST_FAIL=1
|
|
|
|
fi
|
|
|
|
done
|
2024-06-10 15:37:27 +02:00
|
|
|
if [[ -f binary-error.txt ]]; then
|
|
|
|
echo "Test failed!"
|
|
|
|
cat binary-error.txt
|
|
|
|
else
|
|
|
|
echo "Test run succesfully."
|
|
|
|
fi
|
|
|
|
[[ -f binary-error.txt ]] && cat binary-error.txt
|
|
|
|
echo "Base Binary Test running..."
|
|
|
|
_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"
|
2024-06-10 15:14:27 +02:00
|
|
|
archboot-binary-check.sh base &>>"${_LOG}"
|
2024-06-10 15:07:56 +02:00
|
|
|
for i in $(grep '/usr/bin/' binary.txt | sed -e 's#^/usr/bin/##g'); do
|
2024-06-10 15:04:08 +02:00
|
|
|
if ! echo "${_BASE_BLACKLIST}" | grep -qw "${i}"; then
|
2024-06-10 15:14:27 +02:00
|
|
|
echo "${i}" >> base-binary-error.txt
|
2024-06-10 15:04:08 +02:00
|
|
|
_TEST_FAIL=1
|
|
|
|
fi
|
|
|
|
done
|
2024-06-10 15:37:27 +02:00
|
|
|
if [[ -f base-binary-error.txt ]]; then
|
|
|
|
echo "Test failed!"
|
|
|
|
cat base-binary-error.txt
|
|
|
|
else
|
|
|
|
echo "Test run succesfully."
|
|
|
|
fi
|
2024-06-10 16:01:52 +02:00
|
|
|
# uninstall base again!
|
|
|
|
pacman --noconfirm -Rdd base
|
2024-06-10 15:37:27 +02:00
|
|
|
echo "Pacman Package Database Test running..."
|
2024-06-10 15:48:59 +02:00
|
|
|
archboot-not-installed.sh &>>"${_LOG}"
|
2024-06-10 16:01:52 +02:00
|
|
|
if [[ -s not-installed.txt ]]; then
|
2024-06-10 15:04:08 +02:00
|
|
|
echo "Test failed!"
|
2024-06-10 16:01:52 +02:00
|
|
|
cat not-installed.txt
|
2024-06-10 15:04:08 +02:00
|
|
|
_TEST_FAIL=1
|
|
|
|
fi
|
|
|
|
[[ -n "${_TEST_FAIL}" ]] && exit 1
|
|
|
|
# vim: set ft=sh ts=4 sw=4 et:
|