-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathretry-build-microvm.sh
More file actions
executable file
·94 lines (79 loc) · 4.58 KB
/
Copy pathretry-build-microvm.sh
File metadata and controls
executable file
·94 lines (79 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
set -euo pipefail
ROOTFS_CACHE=~/.cache/dirge/microvm
echo "=== Cleaning cached rootfs ==="
rm -rf "$ROOTFS_CACHE"
echo "=== Killing zombie runner processes ==="
pkill -f "dirge-microvm-runner" 2>/dev/null || true
echo "=== Cleaning stale test temps ==="
rm -rf /tmp/dirge-test-microvm* 2>/dev/null || true
echo "=== Cleaning snapshots ==="
rm -rf ~/.cache/dirge/microvm/snapshots 2>/dev/null || true
echo "=== Removing stale buildah images ==="
buildah rmi --storage-driver vfs dirge-microvm:debian 2>/dev/null || true
buildah rmi --storage-driver vfs dirge-microvm:alpine 2>/dev/null || true
buildah rmi --storage-driver vfs dirge-microvm:dev 2>/dev/null || true
echo "=== Forcing rebuild (removing old binaries) ==="
rm -f target/debug/dirge target/debug/dirge-microvm-runner 2>/dev/null || true
echo "=== Building debug binary ==="
cargo build --features sandbox-microvm
echo "=== Codesigning runner binary (macOS: Hypervisor.framework entitlement) ==="
if [ "$(uname)" = "Darwin" ] && [ -f target/debug/dirge-microvm-runner ]; then
codesign --force --sign - --entitlements dirge.entitlements target/debug/dirge-microvm-runner
fi
echo "=== Setting up sandbox (pulls/builds guest images) ==="
./target/debug/dirge sandbox setup
echo "=== Building additional guest images ==="
buildah bud --storage-driver vfs --tag dirge-microvm:alpine -f images/alpine/Dockerfile .
buildah bud --storage-driver vfs --tag dirge-microvm:dev -f images/dev/Dockerfile .
echo "=== Running unit tests (no KVM required) ==="
cargo test --bin dirge --features sandbox-microvm -- \
sandbox::microvm::tests::tests::microvm_config_defaults \
sandbox::microvm::tests::tests::microvm_sandbox_new_does_not_start \
sandbox::microvm::tests::tests::exec_fails_if_not_started \
sandbox::microvm::tests::tests::ssh_keys_generate_and_cleanup \
sandbox::microvm::tests::tests::ssh_wait_for_timeout \
sandbox::microvm::tests::tests::host_keys_generate_and_inject \
sandbox::microvm::tests::tests::krun_config_has_required_mounts \
sandbox::microvm::tests::tests::oci_pull_nonexistent_image_is_error \
sandbox::microvm::rootfs::tests::canonicalize_bare_name \
sandbox::microvm::rootfs::tests::canonicalize_passthrough \
sandbox::microvm::rootfs::tests::local_variant_extraction \
sandbox::microvm::rootfs::tests::build_guest_image_invalid_name \
sandbox::microvm::rootfs::tests::copy_file_reflink_copies_content \
sandbox::microvm::rootfs::tests::copy_file_reflink_empty_file \
sandbox::microvm::rootfs::tests::copy_file_reflink_nonexistent_src_is_error \
sandbox::microvm::rootfs::tests::cp_r_copies_dir_tree \
sandbox::microvm::rootfs::tests::cp_r_copies_symlinks \
sandbox::microvm::rootfs::tests::prepare_local_nonexistent_image_is_error \
sandbox::microvm::rootfs::tests::prepare_docker_nonexistent_image_is_error \
sandbox::microvm::oci::tests::image_ref_docker_hub_official \
sandbox::microvm::oci::tests::image_ref_docker_hub_official_default_tag \
sandbox::microvm::oci::tests::image_ref_docker_hub_user_image \
sandbox::microvm::oci::tests::image_ref_docker_hub_user_image_default_tag \
sandbox::microvm::oci::tests::image_ref_docker_hub_explicit_registry \
sandbox::microvm::oci::tests::image_ref_ghcr \
sandbox::microvm::oci::tests::image_ref_quay \
sandbox::microvm::oci::tests::image_ref_custom_registry_with_port \
sandbox::microvm::oci::tests::image_ref_custom_registry_port_no_tag \
sandbox::microvm::oci::tests::verify_blob_digest_valid \
sandbox::microvm::oci::tests::verify_blob_digest_mismatch \
sandbox::microvm::oci::tests::verify_blob_digest_invalid_format \
sandbox::microvm::oci::tests::verify_blob_digest_unsupported_algo \
sandbox::microvm::oci::tests::verify_blob_digest_empty_bytes \
sandbox::microvm::oci::tests::www_auth_realm \
sandbox::microvm::oci::tests::www_auth_service \
sandbox::microvm::oci::tests::www_auth_missing_param
echo "=== Running lifecycle tests (needs /dev/kvm + libkrun) ==="
cargo test --bin dirge --features sandbox-microvm -- \
sandbox::microvm::tests::tests::full_microvm_lifecycle \
sandbox::microvm::tests::tests::full_microvm_lifecycle_alpine
echo "=== Running keyboard load tests (needs /dev/kvm + libkrun) ==="
cargo test --bin dirge --features sandbox-microvm -- \
sandbox::microvm::tests::tests::keyboard_load_test \
sandbox::microvm::tests::tests::keyboard_stress_test \
--nocapture
echo "=== Done. Run: ./target/debug/dirge --resume ==="
echo ""
echo "To use the dev image (includes Rust toolchain):"
echo " ./target/debug/dirge --sandbox microvm --microvm-image dev"