Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: Update integration test container base image #221

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ x86_64 = "0.14.10"
[dev-dependencies]
dirs = "4.0.0"
rand = "0.8.5"
ssh2 = "0.9.4"
ssh2 = { version = "0.9.4", features = ["vendored-openssl"] }
tempfile = "3.3.0"
7 changes: 3 additions & 4 deletions resources/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM ubuntu:20.04 as dev
FROM ubuntu:22.04 as dev

ARG TARGETARCH
ARG RUST_TOOLCHAIN
ARG RHF_SRC_DIR="/rust-hypervisor-firmware"
ARG RHF_BUILD_DIR="$RHF_SRC_DIR/build"
ARG CARGO_REGISTRY_DIR="$RHF_BUILD_DIR/cargo_registry"
ARG CARGO_GIT_REGISTRY_DIR="$RHF_BUILD_DIR/cargo_git_registry"
ARG COREBOOT_VERSION="4.13"
ARG COREBOOT_VERSION="4.19"

ENV CARGO_HOME=/usr/local/rust
ENV RUSTUP_HOME=$CARGO_HOME
Expand Down Expand Up @@ -40,15 +40,14 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
socat \
dosfstools \
cpio \
python \
python3 \
python3-setuptools \
ntfs-3g \
python3-distutils \
uuid-dev \
m4 \
zlib1g-dev \
gnat-9 \
gnat \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
; fi
Expand Down
4 changes: 1 addition & 3 deletions scripts/dev_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,8 @@ cmd_help() {
echo " --release Build the release binary."
echo " --volumes Hash separated volumes to be exported. Example --volumes /mnt:/mnt#/myvol:/myvol"
echo ""
echo " build-container [--type]"
echo " build-container"
echo " Build the Rust Hypervisor Firmware container."
echo " --dev Build dev container. This is the default."
echo ""
echo " clean [<cargo args>]]"
echo " Remove the Rust Hypervisor Firmware artifacts."
Expand Down Expand Up @@ -453,7 +452,6 @@ cmd_build-container() {
RUST_TOOLCHAIN="$(rustup show active-toolchain | cut -d ' ' -f1)"

$DOCKER_RUNTIME build \
--target $container_type \
-t $CTR_IMAGE \
-f $BUILD_DIR/Dockerfile \
--build-arg TARGETARCH=$TARGETARCH \
Expand Down
11 changes: 11 additions & 0 deletions scripts/fetch_disk_images.sh → scripts/fetch_images.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/bash
set -x

fetch_ch() {
CH_PATH="$1"
CH_VERSION="v23.0"
CH_URL="https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/$CH_VERSION/cloud-hypervisor"
if [ ! -f "$CH_PATH" ]; then
wget --quiet $CH_URL -O $CH_PATH
chmod +x $CH_PATH
sudo setcap cap_net_admin+ep $CH_PATH
fi
}

fetch_image() {
OS_IMAGE="$1"
OS_IMAGE_URL="$2"
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_coreboot_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -x
RHF_ROOT_DIR=$(cd "$(dirname "$0")/../" && pwd)

source "${CARGO_HOME:-$HOME/.cargo}/env"
source "$(dirnam "$0")/fetch_disk_images.sh"
source "$(dirnam "$0")/fetch_images.sh"

WORKLOADS_DIR="$HOME/workloads"
mkdir -p "$WORKLOADS_DIR"
Expand Down
10 changes: 2 additions & 8 deletions scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@
set -x

source "${CARGO_HOME:-$HOME/.cargo}/env"
source $(dirname "$0")/fetch_disk_images.sh
source "$(dirname "$0")/fetch_images.sh"

WORKLOADS_DIR="$HOME/workloads"
mkdir -p "$WORKLOADS_DIR"

CH_VERSION="v23.0"
CH_URL="https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/$CH_VERSION/cloud-hypervisor"
CH_PATH="$WORKLOADS_DIR/cloud-hypervisor"
if [ ! -f "$CH_PATH" ]; then
wget --quiet $CH_URL -O $CH_PATH
chmod +x $CH_PATH
sudo setcap cap_net_admin+ep $CH_PATH
fi
fetch_ch "$CH_PATH"

fetch_disk_images "$WORKLOADS_DIR"

Expand Down
13 changes: 4 additions & 9 deletions scripts/run_integration_tests_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,22 @@
set -x

source "${CARGO_HOME:-$HOME/.cargo}/env"
source "$(dirname "$0")/fetch_images.sh"

WORKLOADS_DIR="$HOME/workloads"
mkdir -p "$WORKLOADS_DIR"

WIN_IMAGE_FILE="$WORKLOADS_DIR/windows-server-2019.raw"

CH_VERSION="v20.0"
CH_URL="https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/$CH_VERSION/cloud-hypervisor"
CH_PATH="$WORKLOADS_DIR/cloud-hypervisor"
if [ ! -f "$CH_PATH" ]; then
wget --quiet $CH_URL -O $CH_PATH
chmod +x $CH_PATH
sudo setcap cap_net_admin+ep $CH_PATH
fi

# Check if the image is present
if [ ! -f "$WIN_IMAGE_FILE" ]; then
echo "Windows image not present in the host"
exit 1
fi

CH_PATH="$WORKLOADS_DIR/cloud-hypervisor"
fetch_ch "$CH_PATH"

# Use device mapper to create a snapshot of the Windows image
img_blk_size=$(du -b -B 512 ${WIN_IMAGE_FILE} | awk '{print $1;}')
loop_device=$(losetup --find --show --read-only ${WIN_IMAGE_FILE})
Expand Down