mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Allow spread to use locally-provided kernel
By placing a bzImage into the top level of the AppArmor git repository one can instruct spread and image-garden to use that image instead of booting traditionally with an EFI / full disk image pair. In addition, make error handling in qemu more robust, so failures are both surfaced and do not cause endless attempts to allocate. Please update image-garden to at least 5a00ead9964df6463e19432ae50e7760fc6da755 Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This commit is contained in:
parent
11d121409d
commit
7031b5aeee
2 changed files with 40 additions and 6 deletions
|
@ -230,6 +230,9 @@ git clean -xdf
|
||||||
Running the `run_spread.sh` script, with `spread` on `PATH` will run all the
|
Running the `run_spread.sh` script, with `spread` on `PATH` will run all the
|
||||||
tests across several supported systems (Debian, Ubuntu and openSUSE).
|
tests across several supported systems (Debian, Ubuntu and openSUSE).
|
||||||
|
|
||||||
|
If you include a `bzImage` file in the root of the repository then that kernel
|
||||||
|
will be used in the integration test. Please look at `spread.yaml` for details.
|
||||||
|
|
||||||
Regression tests
|
Regression tests
|
||||||
----------------
|
----------------
|
||||||
For details on structure and adding tests, see
|
For details on structure and adding tests, see
|
||||||
|
|
43
spread.yaml
43
spread.yaml
|
@ -4,12 +4,40 @@ backends:
|
||||||
# The garden backend relies on https://gitlab.com/zygoon/image-garden
|
# The garden backend relies on https://gitlab.com/zygoon/image-garden
|
||||||
# TODO: Switch to a released version for better stability.
|
# TODO: Switch to a released version for better stability.
|
||||||
type: adhoc
|
type: adhoc
|
||||||
# Use just enough RAM to link the parser on a virtual system with two
|
allocate: |
|
||||||
# cores. Using more cores may easily consume more memory, due to make
|
# Use just enough RAM to link the parser on a virtual system with
|
||||||
# -j$(nproc, used below than a small CI/CD system is typically granted.
|
# two cores. Using more cores may easily consume more memory, due
|
||||||
# It is better to have more workers than to have one big worker with
|
# to make -j$(nproc), used below than a small CI/CD system is
|
||||||
# lots of resources.
|
# typically granted. It is better to have more workers than to
|
||||||
allocate: ADDRESS "$(QEMU_MEM_OPTION="-m 1536" QEMU_SMP_OPTION="-smp 2" image-garden allocate "$SPREAD_SYSTEM".$(uname -m))"
|
# have one big worker with lots of resources.
|
||||||
|
export QEMU_MEM_OPTION="-m 1536"
|
||||||
|
export QEMU_SMP_OPTION="-smp 2"
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
# If a locally built kernel image exist then use it for booting.
|
||||||
|
# Care needs to be taken to make sure the kernel is compatible with
|
||||||
|
# loadable modules present in the file system.
|
||||||
|
if [ -f bzImage ]; then
|
||||||
|
# Create the qcow2/run files before setting custom kernel
|
||||||
|
# options, so that first boot and initialization happen in a
|
||||||
|
# standardized manner.
|
||||||
|
image-garden make "$SPREAD_SYSTEM"."$ARCH".run "$SPREAD_SYSTEM"."$ARCH".qcow2 1>&2
|
||||||
|
# Pass a simple drive instead of the more elaborate virtio
|
||||||
|
# configuration that is used by default. Some images may not
|
||||||
|
# support virtio enough for booting.
|
||||||
|
export QEMU_STORAGE_OPTION="-drive file=$SPREAD_SYSTEM.$ARCH.qcow2,format=qcow2"
|
||||||
|
# Refrain from passing EFI firmware to qemu so that we boot a
|
||||||
|
# kernel directly and bypass both EFI and BIOS.
|
||||||
|
export QEMU_BOOT_FIRMWARE_OPTION=""
|
||||||
|
# Pass the kernel and cmdline by hand. At present this is tuned
|
||||||
|
# to the Ubuntu cloud images that have the rootfs as the first
|
||||||
|
# partition.
|
||||||
|
exec image-garden allocate "$SPREAD_SYSTEM"."$ARCH" \
|
||||||
|
-kernel bzImage \
|
||||||
|
-append 'root=/dev/sda1 ro console=tty1 console=ttyS0'
|
||||||
|
fi
|
||||||
|
# Ask image garden to allocate the system and relay the result back
|
||||||
|
# to spread as either success of failure.
|
||||||
|
exec image-garden allocate "$SPREAD_SYSTEM"."$ARCH"
|
||||||
discard: image-garden discard "$SPREAD_SYSTEM_ADDRESS"
|
discard: image-garden discard "$SPREAD_SYSTEM_ADDRESS"
|
||||||
systems:
|
systems:
|
||||||
# All systems except for the one Ubuntu system are marked as
|
# All systems except for the one Ubuntu system are marked as
|
||||||
|
@ -57,6 +85,9 @@ exclude:
|
||||||
- "*.lock"
|
- "*.lock"
|
||||||
- spread-logs
|
- spread-logs
|
||||||
- spread-artifacts
|
- spread-artifacts
|
||||||
|
# Locally provided kernel image. See allocate section in system backends,
|
||||||
|
# this image, if present, is passed directly to qemu.
|
||||||
|
- bzImage
|
||||||
|
|
||||||
# Copy the project to this path on the test system.
|
# Copy the project to this path on the test system.
|
||||||
# This is also available as $SPREAD_PATH.
|
# This is also available as $SPREAD_PATH.
|
||||||
|
|
Loading…
Add table
Reference in a new issue