deb-bootupd/tests/kola/data/libtest.sh
robojerk aaf662d5b1
Some checks failed
Cross build / Build on ppc64le (push) Failing after 1m8s
Cross build / Build on s390x (push) Failing after 2s
Restructure project layout for better CI/CD integration
- Flattened nested bootupd/bootupd/ structure to root level
- Moved all core project files to root directory
- Added proper Debian packaging structure (debian/ directory)
- Created build scripts and CI configuration
- Improved project organization for CI/CD tools
- All Rust source, tests, and configuration now at root level
- Added GitHub Actions workflow for automated testing
- Maintained all original functionality while improving structure
2025-08-09 23:11:42 -07:00

91 lines
1.8 KiB
Bash
Executable file

# Source library for shell script tests
# Copyright (C) 2020 Red Hat, Inc.
# SPDX-License-Identifier: Apache-2.0
runv() {
(set -x && "$@")
}
N_TESTS=0
ok() {
echo "ok" $@
N_TESTS=$((N_TESTS + 1))
}
tap_finish() {
echo "Completing TAP test with:"
echo "1..${N_TESTS}"
}
fatal() {
echo error: $@ 1>&2; exit 1
}
runv() {
set -x
"$@"
}
# Dump ls -al + file contents to stderr, then fatal()
_fatal_print_file() {
file="$1"
shift
ls -al "$file" >&2
sed -e 's/^/# /' < "$file" >&2
fatal "$@"
}
assert_not_has_file () {
fpath=$1
shift
if test -e "$fpath"; then
fatal "Path exists: ${fpath}"
fi
}
assert_file_has_content () {
fpath=$1
shift
for re in "$@"; do
if ! grep -q -e "$re" "$fpath"; then
_fatal_print_file "$fpath" "File '$fpath' doesn't match regexp '$re'"
fi
done
}
assert_file_has_content_literal () {
fpath=$1; shift
for s in "$@"; do
if ! grep -q -F -e "$s" "$fpath"; then
_fatal_print_file "$fpath" "File '$fpath' doesn't match fixed string list '$s'"
fi
done
}
assert_not_file_has_content () {
fpath=$1
shift
for re in "$@"; do
if grep -q -e "$re" "$fpath"; then
_fatal_print_file "$fpath" "File '$fpath' matches regexp '$re'"
fi
done
}
assert_not_file_has_content_literal () {
fpath=$1; shift
for s in "$@"; do
if grep -q -F -e "$s" "$fpath"; then
_fatal_print_file "$fpath" "File '$fpath' matches fixed string list '$s'"
fi
done
}
# Mount the EFI partition at a temporary location.
efipart=/dev/disk/by-partlabel/EFI-SYSTEM
mount_tmp_efi () {
tmpmount=$(mktemp -d)
mkdir -p ${tmpmount}
mount ${efipart} ${tmpmount}
echo ${tmpmount}
}