Skip to content

Commit fac0a27

Browse files
committed
tests: Add aarch64 integration tests
Since PR #262 was merged, we can boot vanilla Ubuntu images using RHF from Cloud Hypervisor. This commit adds integration tests for aarch64. Signed-off-by: Akira Moroo <retrage01@gmail.com>
1 parent 1f9669d commit fac0a27

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

Jenkinsfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pipeline {
6262
}
6363
}
6464
}
65-
stage ('AArch64 Unit Tests') {
65+
stage ('AArch64 Tests') {
6666
agent { node { label 'focal-arm64' } }
6767
stages {
6868
stage ('Checkout') {
@@ -75,6 +75,14 @@ pipeline {
7575
sh "scripts/dev_cli.sh tests --unit"
7676
}
7777
}
78+
stage('Run integration tests') {
79+
options {
80+
timeout(time: 1, unit: 'HOURS')
81+
}
82+
steps {
83+
sh "scripts/dev_cli.sh tests --integration"
84+
}
85+
}
7886
}
7987
}
8088
}

scripts/dev_cli.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ cmd_tests() {
317317
shift
318318
arg_vols="$1"
319319
;;
320-
"--all") { cargo=true; unit=true; [ "$arch" = "x86_64" ] && integration=true; } ;;
320+
"--all") { cargo=true; unit=true; integration=true; } ;;
321321
"--") { shift; break; } ;;
322322
*)
323323
die "Unknown tests argument: $1. Please use --help for help."
@@ -326,10 +326,7 @@ cmd_tests() {
326326
shift
327327
done
328328

329-
if [ "$(uname -m)" = "aarch64" ] ; then
330-
if [ "$integration" = true ] ; then
331-
die "Integration test is not supported for aarch64."
332-
fi
329+
if [ "$arch" = "aarch64" ] ; then
333330
if [ "$integration_coreboot" = true ] ; then
334331
die "coreboot integration test is not supported for aarch64."
335332
fi

scripts/fetch_images.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ fetch_ch() {
77
CH_VERSION="v32.0"
88
CH_URL_BASE="https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/$CH_VERSION"
99

10+
[ "$CH_ARCH" = "aarch64" ] && CH_NAME="cloud-hypervisor-static-aarch64"
1011
[ "$CH_ARCH" = "x86_64" ] && CH_NAME="cloud-hypervisor"
1112
CH_URL="$CH_URL_BASE/$CH_NAME"
1213

@@ -46,6 +47,11 @@ fetch_raw_ubuntu_image() {
4647
convert_image "$OS_IMAGE_NAME" "$OS_RAW_IMAGE_NAME"
4748
}
4849

50+
aarch64_fetch_disk_images() {
51+
fetch_raw_ubuntu_image "focal" "arm64"
52+
fetch_raw_ubuntu_image "jammy" "arm64"
53+
}
54+
4955
x86_64_fetch_disk_images() {
5056
CLEAR_OS_IMAGE_NAME="clear-31311-cloudguest.img"
5157
CLEAR_OS_URL_BASE="https://cloud-hypervisor.azureedge.net/"
@@ -62,6 +68,7 @@ fetch_disk_images() {
6268

6369
pushd "$WORKLOADS_DIR"
6470

71+
[ "$ARCH" = "aarch64" ] && aarch64_fetch_disk_images
6572
[ "$ARCH" = "x86_64" ] && x86_64_fetch_disk_images
6673

6774
popd

scripts/run_integration_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ fetch_ch "$CH_PATH" "$arch"
1414

1515
fetch_disk_images "$WORKLOADS_DIR" "$arch"
1616

17+
[ "$arch" = "aarch64" ] && target="aarch64-unknown-none"
1718
[ "$arch" = "x86_64" ] && target="x86_64-unknown-none"
1819

1920
rustup component add rust-src

src/integration.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,13 @@ mod tests {
465465
path: &'a str,
466466
}
467467

468+
#[cfg(target_arch = "aarch64")]
469+
const TARGET_TRIPLE: &str = "aarch64-unknown-none";
468470
#[cfg(target_arch = "x86_64")]
469471
const TARGET_TRIPLE: &str = "x86_64-unknown-none";
470472

473+
#[cfg(target_arch = "aarch64")]
474+
const QEMU_NAME: &str = "qemu-system-aarch64";
471475
#[cfg(target_arch = "x86_64")]
472476
const QEMU_NAME: &str = "qemu-system-x86_64";
473477

@@ -605,6 +609,25 @@ mod tests {
605609
handle_child_output(&tmp_dir, r, &output);
606610
}
607611

612+
mod aarch64 {
613+
use super::*;
614+
615+
const FOCAL_IMAGE_NAME: &str = "focal-server-cloudimg-arm64-raw.img";
616+
const JAMMY_IMAGE_NAME: &str = "jammy-server-cloudimg-arm64-raw.img";
617+
618+
#[test]
619+
#[cfg(not(feature = "coreboot"))]
620+
fn test_boot_ch_focal() {
621+
test_boot(FOCAL_IMAGE_NAME, &UbuntuCloudInit {}, spawn_ch)
622+
}
623+
624+
#[test]
625+
#[cfg(not(feature = "coreboot"))]
626+
fn test_boot_ch_jammy() {
627+
test_boot(JAMMY_IMAGE_NAME, &UbuntuCloudInit {}, spawn_ch)
628+
}
629+
}
630+
608631
mod x86_64 {
609632
use super::*;
610633

0 commit comments

Comments
 (0)