From 204e80653c54c544d546fae780d5a2c3df11836c Mon Sep 17 00:00:00 2001 From: Stuart Pernsteiner Date: Fri, 31 May 2024 09:24:38 -0700 Subject: [PATCH] vm_runner: rearrange test files --- src/vm_runner/.gitignore | 1 + src/vm_runner/tests/build_hello_img.sh | 15 --------------- src/vm_runner/tests/build_mps_img.sh | 16 ---------------- .../base_nested.toml} | 10 +++++----- .../base_single.toml} | 8 ++++---- src/vm_runner/tests/hello/build_img.sh | 15 +++++++++++++++ .../tests/{hello_guest.toml => hello/guest.toml} | 0 src/vm_runner/tests/{ => hello}/hello.sh | 0 .../tests/{hello_host.toml => hello/host.toml} | 2 +- .../base_nested.toml} | 12 ++++++------ .../base_single.toml} | 10 +++++----- src/vm_runner/tests/mps/build_img.sh | 16 ++++++++++++++++ .../tests/{mps_guest.toml => mps/guest.toml} | 0 .../tests/{mps_host.toml => mps/host.toml} | 2 +- src/vm_runner/tests/{ => mps}/mps.sh | 0 15 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 src/vm_runner/.gitignore delete mode 100644 src/vm_runner/tests/build_hello_img.sh delete mode 100644 src/vm_runner/tests/build_mps_img.sh rename src/vm_runner/tests/{hello_base_nested.toml => hello/base_nested.toml} (55%) rename src/vm_runner/tests/{hello_base_single.toml => hello/base_single.toml} (57%) create mode 100644 src/vm_runner/tests/hello/build_img.sh rename src/vm_runner/tests/{hello_guest.toml => hello/guest.toml} (100%) rename src/vm_runner/tests/{ => hello}/hello.sh (100%) rename src/vm_runner/tests/{hello_host.toml => hello/host.toml} (88%) rename src/vm_runner/tests/{mps_base_nested.toml => mps/base_nested.toml} (55%) rename src/vm_runner/tests/{mps_base_single.toml => mps/base_single.toml} (57%) create mode 100644 src/vm_runner/tests/mps/build_img.sh rename src/vm_runner/tests/{mps_guest.toml => mps/guest.toml} (100%) rename src/vm_runner/tests/{mps_host.toml => mps/host.toml} (90%) rename src/vm_runner/tests/{ => mps}/mps.sh (100%) diff --git a/src/vm_runner/.gitignore b/src/vm_runner/.gitignore new file mode 100644 index 00000000..a89285e5 --- /dev/null +++ b/src/vm_runner/.gitignore @@ -0,0 +1 @@ +*.img diff --git a/src/vm_runner/tests/build_hello_img.sh b/src/vm_runner/tests/build_hello_img.sh deleted file mode 100644 index c0a520e0..00000000 --- a/src/vm_runner/tests/build_hello_img.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -euo pipefail - -tests_dir="$(dirname "$0")" - -python3 "$tests_dir/../build_application_image.py" \ - -f "$tests_dir/hello_guest.toml=runner.toml" \ - -f "$tests_dir/hello.sh" \ - -o "$tests_dir/hello_guest.img" - -python3 "$tests_dir/../build_application_image.py" \ - -f "$tests_dir/hello_host.toml=runner.toml" \ - -f "$tests_dir/hello_guest.img" \ - -o "$tests_dir/hello_host.img" - diff --git a/src/vm_runner/tests/build_mps_img.sh b/src/vm_runner/tests/build_mps_img.sh deleted file mode 100644 index 0f6570d9..00000000 --- a/src/vm_runner/tests/build_mps_img.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail - -tests_dir="$(dirname "$0")" - -python3 "$tests_dir/../build_application_image.py" \ - -f "$tests_dir/mps_guest.toml=runner.toml" \ - -f "$tests_dir/../../../components/mission_protection_system/src/rts=mps" \ - -f "$tests_dir/mps.sh" \ - -o "$tests_dir/mps_guest.img" - -python3 "$tests_dir/../build_application_image.py" \ - -f "$tests_dir/mps_host.toml=runner.toml" \ - -f "$tests_dir/mps_guest.img" \ - -o "$tests_dir/mps_host.img" - diff --git a/src/vm_runner/tests/hello_base_nested.toml b/src/vm_runner/tests/hello/base_nested.toml similarity index 55% rename from src/vm_runner/tests/hello_base_nested.toml rename to src/vm_runner/tests/hello/base_nested.toml index d55572af..3580d1be 100644 --- a/src/vm_runner/tests/hello_base_nested.toml +++ b/src/vm_runner/tests/hello/base_nested.toml @@ -3,19 +3,19 @@ mode = "exec" [[process]] type = "vm" kvm = false -kernel = "../../pkvm_setup/vms/debian-boot/vmlinuz" -initrd = "../../pkvm_setup/vms/debian-boot/initrd.img" +kernel = "../../../pkvm_setup/vms/debian-boot/vmlinuz" +initrd = "../../../pkvm_setup/vms/debian-boot/initrd.img" append = 'earlycon root=/dev/vda2 systemd.run=/opt/opensut/bin/opensut_boot opensut.app_device=/dev/vdc' [process.disk.vda] format = "qcow2" -path = "../../pkvm_setup/vms/disk_host.img" +path = "../../../pkvm_setup/vms/disk_host.img" [process.disk.vdb] format = "qcow2" -path = "../../pkvm_setup/vms/disk_guest.img" +path = "../../../pkvm_setup/vms/disk_guest.img" [process.disk.vdc] format = "raw" -path = "hello_host.img" +path = "host.img" read_only = true diff --git a/src/vm_runner/tests/hello_base_single.toml b/src/vm_runner/tests/hello/base_single.toml similarity index 57% rename from src/vm_runner/tests/hello_base_single.toml rename to src/vm_runner/tests/hello/base_single.toml index 95ca9a25..47e68965 100644 --- a/src/vm_runner/tests/hello_base_single.toml +++ b/src/vm_runner/tests/hello/base_single.toml @@ -3,15 +3,15 @@ mode = "exec" [[process]] type = "vm" kvm = false -kernel = "../../pkvm_setup/vms/debian-boot/vmlinuz" -initrd = "../../pkvm_setup/vms/debian-boot/initrd.img" +kernel = "../../../pkvm_setup/vms/debian-boot/vmlinuz" +initrd = "../../../pkvm_setup/vms/debian-boot/initrd.img" append = 'earlycon root=/dev/vda2 systemd.run=/opt/opensut/bin/opensut_boot opensut.app_device=/dev/vdb' [process.disk.vda] format = "qcow2" -path = "../../pkvm_setup/vms/disk_host.img" +path = "../../../pkvm_setup/vms/disk_host.img" [process.disk.vdb] format = "raw" -path = "hello_guest.img" +path = "guest.img" read_only = true diff --git a/src/vm_runner/tests/hello/build_img.sh b/src/vm_runner/tests/hello/build_img.sh new file mode 100644 index 00000000..2fecde1a --- /dev/null +++ b/src/vm_runner/tests/hello/build_img.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail + +hello_dir="$(dirname "$0")" + +python3 "$hello_dir/../../build_application_image.py" \ + -f "$hello_dir/guest.toml=runner.toml" \ + -f "$hello_dir/hello.sh" \ + -o "$hello_dir/guest.img" + +python3 "$hello_dir/../../build_application_image.py" \ + -f "$hello_dir/host.toml=runner.toml" \ + -f "$hello_dir/guest.img" \ + -o "$hello_dir/host.img" + diff --git a/src/vm_runner/tests/hello_guest.toml b/src/vm_runner/tests/hello/guest.toml similarity index 100% rename from src/vm_runner/tests/hello_guest.toml rename to src/vm_runner/tests/hello/guest.toml diff --git a/src/vm_runner/tests/hello.sh b/src/vm_runner/tests/hello/hello.sh similarity index 100% rename from src/vm_runner/tests/hello.sh rename to src/vm_runner/tests/hello/hello.sh diff --git a/src/vm_runner/tests/hello_host.toml b/src/vm_runner/tests/hello/host.toml similarity index 88% rename from src/vm_runner/tests/hello_host.toml rename to src/vm_runner/tests/hello/host.toml index 0df8572b..1f443f7e 100644 --- a/src/vm_runner/tests/hello_host.toml +++ b/src/vm_runner/tests/hello/host.toml @@ -13,5 +13,5 @@ path = "/dev/vdb" [process.disk.vdb] format = "raw" -path = "/opt/opensut/app/hello_guest.img" +path = "/opt/opensut/app/guest.img" read_only = true diff --git a/src/vm_runner/tests/mps_base_nested.toml b/src/vm_runner/tests/mps/base_nested.toml similarity index 55% rename from src/vm_runner/tests/mps_base_nested.toml rename to src/vm_runner/tests/mps/base_nested.toml index 50dd67cf..84ed17f3 100644 --- a/src/vm_runner/tests/mps_base_nested.toml +++ b/src/vm_runner/tests/mps/base_nested.toml @@ -3,23 +3,23 @@ mode = "exec" [[process]] type = "vm" kvm = false -kernel = "../../pkvm_setup/vms/debian-boot/vmlinuz" -initrd = "../../pkvm_setup/vms/debian-boot/initrd.img" +kernel = "../../../pkvm_setup/vms/debian-boot/vmlinuz" +initrd = "../../../pkvm_setup/vms/debian-boot/initrd.img" append = 'earlycon root=/dev/vda2 systemd.run=/opt/opensut/bin/opensut_boot opensut.app_device=/dev/vdc' [process.disk.vda] format = "qcow2" -path = "../../pkvm_setup/vms/disk_host.img" +path = "../../../pkvm_setup/vms/disk_host.img" [process.disk.vdb] format = "qcow2" -path = "../../pkvm_setup/vms/disk_guest.img" +path = "../../../pkvm_setup/vms/disk_guest.img" [process.disk.vdc] format = "raw" -path = "mps_host.img" +path = "host.img" read_only = true [process.serial.hvc0] mode = "unix" -path = "../serial.socket" +path = "../../serial.socket" diff --git a/src/vm_runner/tests/mps_base_single.toml b/src/vm_runner/tests/mps/base_single.toml similarity index 57% rename from src/vm_runner/tests/mps_base_single.toml rename to src/vm_runner/tests/mps/base_single.toml index 207c41aa..acaae0c8 100644 --- a/src/vm_runner/tests/mps_base_single.toml +++ b/src/vm_runner/tests/mps/base_single.toml @@ -3,19 +3,19 @@ mode = "exec" [[process]] type = "vm" kvm = false -kernel = "../../pkvm_setup/vms/debian-boot/vmlinuz" -initrd = "../../pkvm_setup/vms/debian-boot/initrd.img" +kernel = "../../../pkvm_setup/vms/debian-boot/vmlinuz" +initrd = "../../../pkvm_setup/vms/debian-boot/initrd.img" append = 'earlycon root=/dev/vda2 systemd.run=/opt/opensut/bin/opensut_boot opensut.app_device=/dev/vdb' [process.disk.vda] format = "qcow2" -path = "../../pkvm_setup/vms/disk_host.img" +path = "../../../pkvm_setup/vms/disk_host.img" [process.disk.vdb] format = "raw" -path = "mps_guest.img" +path = "guest.img" read_only = true [process.serial.hvc0] mode = "unix" -path = "../serial.socket" +path = "../../serial.socket" diff --git a/src/vm_runner/tests/mps/build_img.sh b/src/vm_runner/tests/mps/build_img.sh new file mode 100644 index 00000000..dde1d488 --- /dev/null +++ b/src/vm_runner/tests/mps/build_img.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -euo pipefail + +mps_dir="$(dirname "$0")" + +python3 "$mps_dir/../../build_application_image.py" \ + -f "$mps_dir/guest.toml=runner.toml" \ + -f "$mps_dir/../../../../components/mission_protection_system/src/rts=mps" \ + -f "$mps_dir/mps.sh" \ + -o "$mps_dir/guest.img" + +python3 "$mps_dir/../../build_application_image.py" \ + -f "$mps_dir/host.toml=runner.toml" \ + -f "$mps_dir/guest.img" \ + -o "$mps_dir/host.img" + diff --git a/src/vm_runner/tests/mps_guest.toml b/src/vm_runner/tests/mps/guest.toml similarity index 100% rename from src/vm_runner/tests/mps_guest.toml rename to src/vm_runner/tests/mps/guest.toml diff --git a/src/vm_runner/tests/mps_host.toml b/src/vm_runner/tests/mps/host.toml similarity index 90% rename from src/vm_runner/tests/mps_host.toml rename to src/vm_runner/tests/mps/host.toml index 27de9732..5431f3d8 100644 --- a/src/vm_runner/tests/mps_host.toml +++ b/src/vm_runner/tests/mps/host.toml @@ -13,7 +13,7 @@ path = "/dev/vdb" [process.disk.vdb] format = "raw" -path = "/opt/opensut/app/mps_guest.img" +path = "/opt/opensut/app/guest.img" read_only = true [process.serial.hvc0] diff --git a/src/vm_runner/tests/mps.sh b/src/vm_runner/tests/mps/mps.sh similarity index 100% rename from src/vm_runner/tests/mps.sh rename to src/vm_runner/tests/mps/mps.sh