Skip to content

Commit

Permalink
fixup! tests: add test for pivot_root in initramfs support
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksa Sarai <[email protected]>
  • Loading branch information
cyphar committed Oct 29, 2024
1 parent aeb45ac commit bb3234d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/integration/initramfs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function qemu_native() {
# Different distributions put qemu-kvm in different locations and with
# different names. Debian and Ubuntu have a "kvm" binary, while AlmaLinux
# has /usr/libexec/qemu-kvm.
local qemu_candidates=("kvm" "qemu-kvm" "/usr/libexec/qemu-kvm")
local qemu_binary candidate
local qemu_binary= qemu_candidates=("kvm" "qemu-kvm" "/usr/libexec/qemu-kvm")

Check warning on line 42 in tests/integration/initramfs.bats

View workflow job for this annotation

GitHub Actions / shellcheck

Remove space after = if trying to assign a value (for empty string, use var='' ... ).
local candidate
for candidate in "${qemu_candidates[@]}"; do
"$candidate" -help &>/dev/null || continue
qemu_binary="$candidate"
Expand All @@ -50,20 +50,23 @@ function qemu_native() {
# architecture if qemu-kvm is missing?
[ -n "$qemu_binary" ] || skip "could not find qemu-kvm binary"

local machine
local machine=
case "$(go env GOARCH)" in
386 | amd64)
# Try to use a slightly newer PC CPU.
machine="pc"
;;
arm | arm64)
# ARM doesn't provide a "default" machine value (because its use is so
# varied) so we have to specify the machine manually.
machine="virt"
;;
*)
echo "could not figure out -machine argument for qemu -- using default" >&2
;;
esac
local machine_args=()
[ -n "$machine" ] && machine_args=("-machine" "$machine")
local machine_args=("-cpu" "max")
[ -n "$machine" ] && machine_args+=("-machine" "$machine")

qemu_output="$INITRAMFS_ROOT/qemu.log"
sane_run --pipe --timeout=3m \
Expand Down

0 comments on commit bb3234d

Please sign in to comment.