Skip to content

Commit 19c0377

Browse files
committed
modifying to update the readme and extend test loop
1 parent d42ff50 commit 19c0377

11 files changed

Lines changed: 145 additions & 32 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
9090
cargo install just
9191

9292
# 2. kraft-hyperlight (builds Unikraft kernels)
93-
git clone --branch hyperlight-platform https://github.com/danbugs/kraftkit.git
93+
git clone --branch plat-hyperlight https://github.com/unikraft/kraftkit/
9494
cd kraftkit && go build -o kraft-hyperlight ./cmd/kraft
9595
sudo mv kraft-hyperlight /usr/local/bin/ && cd ..
9696

examples/dotnet-nativeaot/Justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ run:
2020
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}}
2121

2222
# Run 5 times via snapshot/restore
23-
run-5:
24-
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 4 --memory {{memory}}
23+
run-10:
24+
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 9 --memory {{memory}}
2525

2626
# Build rootfs via Docker (cross-platform)
2727
rootfs:

examples/dotnet/Justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ run:
2020
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}}
2121

2222
# Run 5 times via snapshot/restore
23-
run-5:
24-
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 4 --memory {{memory}}
23+
run-10:
24+
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 9 --memory {{memory}}
2525

2626
# Build rootfs via Docker (cross-platform)
2727
rootfs:

examples/go/Justfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# go on Hyperlight
22
#
33
# just run - Run once
4-
# just run-5 - Run 5x (snapshot/restore)
4+
# just run-10 - Run 10x (snapshot/restore)
55
# just rootfs - Build rootfs via Docker (cross-platform)
66
# just build - Build/pull kernel
77
# just clean - Remove build artifacts
@@ -19,9 +19,9 @@ ghcr_kernel := "ghcr.io/hyperlight-dev/hyperlight-unikraft/go-kernel:latest"
1919
run:
2020
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} -- hello
2121

22-
# Run 5 times via snapshot/restore
23-
run-5:
24-
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 4 --memory {{memory}} -- hello
22+
# Run 10 times via snapshot/restore
23+
run-10:
24+
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 9 --memory {{memory}} -- hello
2525

2626
# Build rootfs via Docker (cross-platform)
2727
rootfs:

examples/nodejs/Justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ ghcr_kernel := "ghcr.io/hyperlight-dev/hyperlight-unikraft/nodejs-kernel:latest"
1919
run:
2020
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} -- /app/hello.js
2121

22-
# Run 5 times via snapshot/restore
23-
run-5:
24-
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 4 --memory {{memory}} -- /app/hello.js
22+
# Run 10 times via snapshot/restore
23+
run-10:
24+
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 9 --memory {{memory}} -- /app/hello.js
2525

2626
# Build rootfs via Docker (cross-platform)
2727
rootfs:

examples/powershell/Justfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# powershell on Hyperlight
22
#
33
# just run - Run once
4-
# just run-5 - Run 5x (snapshot/restore)
4+
# just run-10 - Run 10x (snapshot/restore)
55
# just rootfs - Build rootfs via Docker (cross-platform)
66
# just build - Build/pull kernel
77
# just clean - Remove build artifacts
@@ -19,9 +19,9 @@ ghcr_kernel := "ghcr.io/hyperlight-dev/hyperlight-unikraft/powershell-kernel:lat
1919
run:
2020
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} -- -NoProfile -File /scripts/hello.ps1
2121

22-
# Run 5 times via snapshot/restore
23-
run-5:
24-
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 4 --memory {{memory}} -- -NoProfile -File /scripts/hello.ps1
22+
# Run 10 times via snapshot/restore
23+
run-10:
24+
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 9 --memory {{memory}} -- -NoProfile -File /scripts/hello.ps1
2525

2626
# Build rootfs via Docker (cross-platform)
2727
rootfs:

examples/python-tools/Justfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# python-tools on Hyperlight
22
#
33
# just run - Run once
4-
# just run-5 - Run 5x (snapshot/restore)
4+
# just run-10 - Run 10x (snapshot/restore)
55
# just rootfs - Build rootfs via Docker (cross-platform)
66
# just build - Build/pull kernel
77
# just clean - Remove build artifacts
@@ -19,9 +19,9 @@ ghcr_kernel := "ghcr.io/hyperlight-dev/hyperlight-unikraft/python-tools-kernel:l
1919
run:
2020
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} --enable-tools -- /test_tools.py
2121

22-
# Run 5 times via snapshot/restore
23-
run-5:
24-
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 4 --memory {{memory}} --enable-tools -- /test_tools.py
22+
# Run 10 times via snapshot/restore
23+
run-10:
24+
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 9 --memory {{memory}} --enable-tools -- /test_tools.py
2525

2626
# Build rootfs via Docker (cross-platform)
2727
rootfs:

examples/python/Justfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# python on Hyperlight
22
#
33
# just run - Run once
4-
# just run-5 - Run 5x (snapshot/restore)
4+
# just run-10 - Run 10x (snapshot/restore)
55
# just rootfs - Build rootfs via Docker (cross-platform)
66
# just build - Build/pull kernel
77
# just clean - Remove build artifacts
@@ -19,9 +19,9 @@ ghcr_kernel := "ghcr.io/hyperlight-dev/hyperlight-unikraft/python-kernel:latest"
1919
run:
2020
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} -- /hello.py
2121

22-
# Run 5 times via snapshot/restore
23-
run-5:
24-
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 4 --memory {{memory}} -- /hello.py
22+
# Run 10 times via snapshot/restore
23+
run-10:
24+
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 9 --memory {{memory}} -- /hello.py
2525

2626
# Build rootfs via Docker (cross-platform)
2727
rootfs:

examples/run-all-examples.sh

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/bin/bash
2+
# Run all Hyperlight-Unikraft examples (excluding python-agent-driver)
3+
# Captures both "just run" (single cold execution) and "just run-X" (repeated snapshot/restore)
4+
#
5+
# Usage: chmod +x run-all-examples.sh && ./run-all-examples.sh
6+
#
7+
# Per-example logs: results-<name>.txt
8+
# Final summary: results-summary.txt
9+
10+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
11+
cd "$SCRIPT_DIR"
12+
13+
SUMMARY="results-summary.txt"
14+
echo "=== Hyperlight-Unikraft Examples Run — $(date) ===" | tee "$SUMMARY"
15+
echo "" | tee -a "$SUMMARY"
16+
17+
run_example() {
18+
local name="$1"
19+
local repeat_cmd="$2" # e.g. "run-5", "run-10", or "" if none
20+
local outfile="results-${name}.txt"
21+
22+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$SUMMARY"
23+
echo "$name" | tee -a "$SUMMARY"
24+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$SUMMARY"
25+
26+
cd "$SCRIPT_DIR/$name"
27+
28+
# Build
29+
printf " [build] running... "
30+
local t0=$(date +%s%N)
31+
just build < /dev/null > "$outfile" 2>&1
32+
local rc=$?
33+
local t1=$(date +%s%N)
34+
local build_ms=$(( (t1 - t0) / 1000000 ))
35+
if [ $rc -eq 0 ]; then
36+
echo "${build_ms}ms" | tee -a "$outfile" | tee -a "$SCRIPT_DIR/$SUMMARY"
37+
else
38+
echo "✗ FAILED (exit=$rc, ${build_ms}ms)" | tee -a "$outfile" | tee -a "$SCRIPT_DIR/$SUMMARY"
39+
cd "$SCRIPT_DIR"
40+
return 1
41+
fi
42+
43+
# Rootfs
44+
printf " [rootfs] running... "
45+
t0=$(date +%s%N)
46+
just rootfs < /dev/null >> "$outfile" 2>&1
47+
rc=$?
48+
t1=$(date +%s%N)
49+
local rootfs_ms=$(( (t1 - t0) / 1000000 ))
50+
if [ $rc -eq 0 ]; then
51+
echo "${rootfs_ms}ms" | tee -a "$outfile" | tee -a "$SCRIPT_DIR/$SUMMARY"
52+
else
53+
echo "✗ FAILED (exit=$rc, ${rootfs_ms}ms)" | tee -a "$outfile" | tee -a "$SCRIPT_DIR/$SUMMARY"
54+
cd "$SCRIPT_DIR"
55+
return 1
56+
fi
57+
58+
# Run once (cold start)
59+
printf " [run] running... "
60+
t0=$(date +%s%N)
61+
just run < /dev/null >> "$outfile" 2>&1
62+
rc=$?
63+
t1=$(date +%s%N)
64+
local run_ms=$(( (t1 - t0) / 1000000 ))
65+
if [ $rc -eq 0 ]; then
66+
echo "${run_ms}ms" | tee -a "$outfile" | tee -a "$SCRIPT_DIR/$SUMMARY"
67+
else
68+
echo "✗ FAILED (exit=$rc, ${run_ms}ms)" | tee -a "$outfile" | tee -a "$SCRIPT_DIR/$SUMMARY"
69+
fi
70+
71+
# Run repeated (snapshot/restore) — if a repeat command exists
72+
if [ -n "$repeat_cmd" ]; then
73+
printf " [$repeat_cmd] running... "
74+
t0=$(date +%s%N)
75+
just "$repeat_cmd" < /dev/null >> "$outfile" 2>&1
76+
rc=$?
77+
t1=$(date +%s%N)
78+
local repeat_ms=$(( (t1 - t0) / 1000000 ))
79+
if [ $rc -eq 0 ]; then
80+
echo "${repeat_ms}ms" | tee -a "$outfile" | tee -a "$SCRIPT_DIR/$SUMMARY"
81+
else
82+
echo "✗ FAILED (exit=$rc, ${repeat_ms}ms)" | tee -a "$outfile" | tee -a "$SCRIPT_DIR/$SUMMARY"
83+
fi
84+
echo " TOTAL: build=${build_ms}ms rootfs=${rootfs_ms}ms run=${run_ms}ms ${repeat_cmd}=${repeat_ms}ms" | tee -a "$SCRIPT_DIR/$SUMMARY"
85+
else
86+
echo " TOTAL: build=${build_ms}ms rootfs=${rootfs_ms}ms run=${run_ms}ms" | tee -a "$SCRIPT_DIR/$SUMMARY"
87+
fi
88+
89+
echo "" | tee -a "$SCRIPT_DIR/$SUMMARY"
90+
cd "$SCRIPT_DIR"
91+
}
92+
93+
# Examples with their repeat commands (from each Justfile)
94+
run_example "helloworld-c" "run-5"
95+
run_example "rust" "run-5"
96+
run_example "go" "run-10"
97+
run_example "shell" "run-5"
98+
run_example "python" "run-10"
99+
run_example "python-tools" "run-10"
100+
run_example "nodejs" "run-10"
101+
run_example "dotnet" "run-10"
102+
run_example "dotnet-nativeaot" "run-10"
103+
run_example "powershell" "run-10"
104+
run_example "hostfs-posix-c" "run-5"
105+
run_example "hostfs-posix-py" "run-5"
106+
run_example "multifn-c" ""
107+
run_example "python-agent" ""
108+
run_example "networking-py" "run-get"
109+
110+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$SUMMARY"
111+
echo "✅ ALL DONE — $(date)" | tee -a "$SUMMARY"
112+
echo "Per-example logs: results-<name>.txt"
113+
echo "Summary: $SUMMARY"

examples/rust/Justfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# rust on Hyperlight
22
#
33
# just run - Run once
4-
# just run-5 - Run 5x (snapshot/restore)
4+
# just run-5 - Run 10x (snapshot/restore)
55
# just rootfs - Build rootfs via Docker (cross-platform)
66
# just build - Build/pull kernel
77
# just clean - Remove build artifacts
@@ -19,9 +19,9 @@ ghcr_kernel := "ghcr.io/hyperlight-dev/hyperlight-unikraft/rust-kernel:latest"
1919
run:
2020
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}}
2121

22-
# Run 5 times via snapshot/restore
23-
run-5:
24-
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 4 --memory {{memory}}
22+
# Run 10 times via snapshot/restore
23+
run-10:
24+
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --repeat 9 --memory {{memory}}
2525

2626
# Build rootfs via Docker (cross-platform)
2727
rootfs:

0 commit comments

Comments
 (0)