@@ -153,6 +153,9 @@ jobs:
153153 # Full matrix — every example actually runs and its expected output is
154154 # greped from the guest console. This is the real regression gate;
155155 # build-example above only catches link-time errors.
156+ #
157+ # Memory values are read from each example's Justfile at runtime
158+ # (the `memory` variable), so the matrix only carries args/expect.
156159 runtime-test :
157160 runs-on : ubuntu-latest
158161 needs : build-example
@@ -165,76 +168,59 @@ jobs:
165168 matrix :
166169 include :
167170 - example : helloworld-c
168- memory : " 4Mi"
169171 args : " "
170172 expect : " Hello from C on Hyperlight"
171173 - example : rust
172- memory : " 16Mi"
173174 args : " "
174175 expect : " Hello from Rust on Hyperlight"
175176 - example : go
176- memory : " 96Mi"
177177 args : " "
178178 expect : " Hello from Go on Hyperlight"
179179 - example : shell
180- memory : " 16Mi"
181180 args : " -- /demo.sh"
182181 expect : " Hello from Shell on Hyperlight"
183182 - example : python
184- memory : " 512Mi"
185183 args : " -- /hello.py"
186184 expect : " Hello from Python on Hyperlight"
187185 - example : python-tools
188- memory : " 1Gi"
189186 args : " --enable-tools -- /test_tools.py"
190187 expect : " Tool returned"
191188 - example : nodejs
192- memory : " 512Mi"
193189 args : " -- /app/hello.js"
194190 expect : " Hello from Node.js on Hyperlight"
195191 - example : dotnet
196- memory : " 512Mi"
197192 args : " "
198193 expect : " Hello, World! From .NET on Hyperlight"
199194 - example : dotnet-nativeaot
200- memory : " 512Mi"
201195 args : " "
202196 expect : " Hello, World! From .NET NativeAOT on Hyperlight"
203197 - example : hostfs-posix-c
204- memory : " 16Mi"
205198 args : " "
206199 expect : " done\\ ."
207200 needs_mount : true
208201 - example : hostfs-posix-py
209- memory : " 512Mi"
210202 args : " -- /hostfs_demo.py"
211203 expect : " done\\ ."
212204 needs_mount : true
213205 - example : multifn-c
214- memory : " 4Mi"
215206 args : " "
216207 expect : " RUN: world"
217208 driver : multifn-test
218209 - example : python-agent
219- memory : " 1Gi"
220210 args : " -- /agent.py"
221211 expect : " done\\ ."
222212 needs_mount : true
223213 - example : python-agent-driver
224- memory : " 2Gi"
225214 args : " "
226215 expect : " hello from driver"
227216 driver : pydriver-run
228217 - example : powershell
229- memory : " 1Gi"
230218 args : " -- -NoProfile -File /scripts/hello.ps1"
231219 expect : " Hello, World! From PowerShell on Hyperlight"
232220 - example : networking-py
233- memory : " 512Mi"
234221 args : " --net -- /urllib_get.py"
235222 expect : " SUCCESS: urllib GET worked!"
236223 - example : networking-py
237- memory : " 512Mi"
238224 args : " --port 8080 -- /echo_server_test.py"
239225 expect : " SUCCESS: bind\\ +listen on port 8080 allowed"
240226 steps :
@@ -340,6 +326,11 @@ jobs:
340326 ls -la .unikraft/build/ *.cpio 2>&1 | head -40 || true
341327 exit 1
342328 fi
329+ # Read memory from the example's Justfile (single source of truth).
330+ memory=$(grep '^memory' Justfile | sed 's/memory.*:= *"//' | sed 's/".*//')
331+ if [ -z "$memory" ]; then
332+ echo "::notice::No memory variable in Justfile, using binary default"
333+ fi
343334 expect='${{ matrix.expect }}'
344335 mount_args=""
345336 if [ "${{ matrix.needs_mount }}" = "true" ]; then
@@ -355,7 +346,11 @@ jobs:
355346 cmd=(timeout 120 /home/runner/work/hyperlight-unikraft/hyperlight-unikraft/host/target/release/pydriver-run "$kernel" "$cpio" /tmp/tiny.py)
356347 ;;
357348 *)
358- cmd=(timeout 120 hyperlight-unikraft -q -m "${{ matrix.memory }}" "$kernel" --initrd "$cpio" $mount_args ${{ matrix.args }})
349+ mem_args=""
350+ if [ -n "$memory" ]; then
351+ mem_args="-m $memory"
352+ fi
353+ cmd=(timeout 120 hyperlight-unikraft -q $mem_args "$kernel" --initrd "$cpio" $mount_args ${{ matrix.args }})
359354 ;;
360355 esac
361356 set +e
@@ -490,6 +485,8 @@ jobs:
490485 # The only difference is we can't build the images on Windows (no
491486 # kraft-hyperlight + no Linux docker), so we download them from the
492487 # package-images-for-windows job.
488+ #
489+ # Memory values are read from each example's Justfile at runtime.
493490 runtime-test-windows :
494491 runs-on : windows-latest
495492 needs : package-images-for-windows
@@ -502,76 +499,59 @@ jobs:
502499 matrix :
503500 include :
504501 - example : helloworld-c
505- memory : " 4Mi"
506502 args : " "
507503 expect : " Hello from C on Hyperlight"
508504 - example : rust
509- memory : " 16Mi"
510505 args : " "
511506 expect : " Hello from Rust on Hyperlight"
512507 - example : go
513- memory : " 96Mi"
514508 args : " "
515509 expect : " Hello from Go on Hyperlight"
516510 - example : shell
517- memory : " 16Mi"
518511 args : " -- /demo.sh"
519512 expect : " Hello from Shell on Hyperlight"
520513 - example : python
521- memory : " 512Mi"
522514 args : " -- /hello.py"
523515 expect : " Hello from Python on Hyperlight"
524516 - example : python-tools
525- memory : " 1Gi"
526517 args : " --enable-tools -- /test_tools.py"
527518 expect : " Tool returned"
528519 - example : nodejs
529- memory : " 512Mi"
530520 args : " -- /app/hello.js"
531521 expect : " Hello from Node.js on Hyperlight"
532522 - example : dotnet
533- memory : " 512Mi"
534523 args : " "
535524 expect : " Hello, World! From .NET on Hyperlight"
536525 - example : dotnet-nativeaot
537- memory : " 512Mi"
538526 args : " "
539527 expect : " Hello, World! From .NET NativeAOT on Hyperlight"
540528 - example : hostfs-posix-c
541- memory : " 16Mi"
542529 args : " "
543530 expect : " done\\ ."
544531 needs_mount : true
545532 - example : hostfs-posix-py
546- memory : " 512Mi"
547533 args : " -- /hostfs_demo.py"
548534 expect : " done\\ ."
549535 needs_mount : true
550536 - example : multifn-c
551- memory : " 4Mi"
552537 args : " "
553538 expect : " RUN: world"
554539 driver : multifn-test
555540 - example : python-agent
556- memory : " 1Gi"
557541 args : " -- /agent.py"
558542 expect : " done\\ ."
559543 needs_mount : true
560544 - example : python-agent-driver
561- memory : " 2Gi"
562545 args : " "
563546 expect : " hello from driver"
564547 driver : pydriver-run
565548 - example : powershell
566- memory : " 1Gi"
567549 args : " -- -NoProfile -File /scripts/hello.ps1"
568550 expect : " Hello, World! From PowerShell on Hyperlight"
569551 - example : networking-py
570- memory : " 512Mi"
571552 args : " --net -- /urllib_get.py"
572553 expect : " SUCCESS: urllib GET worked!"
573554 - example : networking-py
574- memory : " 512Mi"
575555 args : " --port 8080 -- /echo_server_test.py"
576556 expect : " SUCCESS: bind\\ +listen on port 8080 allowed"
577557 steps :
@@ -614,10 +594,19 @@ jobs:
614594 $cpio = (Resolve-Path "image/initrd.cpio").Path
615595 $expect = '${{ matrix.expect }}'
616596 $driver = '${{ matrix.driver }}'
617- $memory = '${{ matrix.memory }}'
618597 $runArgs = '${{ matrix.args }}'
619598 $needsMount = '${{ matrix.needs_mount }}'
620599
600+ # Read memory from the example's Justfile (single source of truth).
601+ $memory = ''
602+ $justfile = "examples/${{ matrix.example }}/Justfile"
603+ if (Test-Path $justfile) {
604+ $memLine = Get-Content $justfile | Where-Object { $_ -match '^\s*memory\s*:=' }
605+ if ($memLine -match '"([^"]+)"') {
606+ $memory = $Matches[1]
607+ }
608+ }
609+
621610 $mountArgs = @()
622611 if ($needsMount -eq 'true') {
623612 $mountDir = Join-Path $env:RUNNER_TEMP ('hostfs-' + '${{ matrix.example }}')
@@ -649,7 +638,11 @@ jobs:
649638 if ($runArgs -ne '') {
650639 $argList = $runArgs.Split(' ') | Where-Object { $_ -ne '' }
651640 }
652- $out = & hyperlight-unikraft -q -m $memory `
641+ $memArgs = @()
642+ if ($memory -ne '') {
643+ $memArgs = @('-m', $memory)
644+ }
645+ $out = & hyperlight-unikraft -q @memArgs `
653646 $kernel --initrd $cpio @mountArgs @argList 2>&1
654647 $rc = $LASTEXITCODE
655648 }
0 commit comments