@@ -216,7 +216,18 @@ jobs:
216216 - example : python-agent-driver
217217 args : " "
218218 expect : " hello from driver"
219- driver : pydriver-run
219+ driver : pyhl
220+ pyhl_code : " print('hello from driver')"
221+ - example : python-agent-driver
222+ args : " "
223+ expect : " hello from hyperlight guest"
224+ driver : pyhl
225+ pyhl_script : demo_busybox.py
226+ - example : python-agent-driver
227+ args : " --net"
228+ expect : " imported six"
229+ driver : pyhl
230+ pyhl_script : demo_pip_install.py
220231 - example : powershell
221232 args : " -- -NoProfile -File /scripts/hello.ps1"
222233 expect : " Hello, World! From PowerShell on Hyperlight"
@@ -281,8 +292,9 @@ jobs:
281292 if : steps.kvm_check.outputs.available == 'true'
282293 run : |
283294 cd host
284- cargo build --release --features wasm-host-fns --bin hyperlight-unikraft --bin multifn-test --bin pydriver-run
295+ cargo build --release --features wasm-host-fns --bin hyperlight-unikraft --bin multifn-test --bin pyhl
285296 sudo cp target/release/hyperlight-unikraft /usr/local/bin/
297+ sudo cp target/release/pyhl /usr/local/bin/
286298
287299 - name : Build echo Wasm host function
288300 if : steps.kvm_check.outputs.available == 'true' && matrix.needs_echo_tool == true
@@ -322,9 +334,10 @@ jobs:
322334 kraft-hyperlight --no-prompt build --plat hyperlight --arch x86_64
323335 fi
324336
325- - name : Prepare pydriver-run script (python-agent-driver only)
326- if : steps.kvm_check.outputs.available == 'true' && matrix.driver == 'pydriver-run'
327- run : echo 'print("hello from driver")' > /tmp/tiny.py
337+ - name : pyhl setup (python-agent-driver only)
338+ if : steps.kvm_check.outputs.available == 'true' && matrix.driver == 'pyhl'
339+ working-directory : examples/${{ matrix.example }}
340+ run : pyhl setup --from . --force
328341
329342 - name : Run and check output
330343 if : steps.kvm_check.outputs.available == 'true'
@@ -401,8 +414,17 @@ jobs:
401414 multifn-test)
402415 cmd=(timeout 60 /home/runner/work/hyperlight-unikraft/hyperlight-unikraft/host/target/release/multifn-test "$kernel" "$cpio")
403416 ;;
404- pydriver-run)
405- cmd=(timeout 120 /home/runner/work/hyperlight-unikraft/hyperlight-unikraft/host/target/release/pydriver-run "$kernel" "$cpio" /tmp/tiny.py)
417+ pyhl)
418+ pyhl_args=()
419+ if [ -n "${{ matrix.pyhl_script }}" ]; then
420+ pyhl_args+=(examples/${{ matrix.example }}/${{ matrix.pyhl_script }})
421+ elif [ -n "${{ matrix.pyhl_code }}" ]; then
422+ pyhl_args+=(-c "${{ matrix.pyhl_code }}")
423+ fi
424+ if echo "${{ matrix.args }}" | grep -q "\-\-net"; then
425+ pyhl_args+=(--net)
426+ fi
427+ cmd=(timeout 300 pyhl run -v "${pyhl_args[@]}")
406428 ;;
407429 *)
408430 mem_args=""
@@ -606,7 +628,18 @@ jobs:
606628 - example : python-agent-driver
607629 args : " "
608630 expect : " hello from driver"
609- driver : pydriver-run
631+ driver : pyhl
632+ pyhl_code : " print('hello from driver')"
633+ - example : python-agent-driver
634+ args : " "
635+ expect : " hello from hyperlight guest"
636+ driver : pyhl
637+ pyhl_script : demo_busybox.py
638+ - example : python-agent-driver
639+ args : " --net"
640+ expect : " imported six"
641+ driver : pyhl
642+ pyhl_script : demo_pip_install.py
610643 - example : powershell
611644 args : " -- -NoProfile -File /scripts/hello.ps1"
612645 expect : " Hello, World! From PowerShell on Hyperlight"
@@ -645,10 +678,9 @@ jobs:
645678 shell : pwsh
646679 run : |
647680 cd host
648- cargo build --release --features wasm-host-fns --bin hyperlight-unikraft --bin multifn-test --bin pydriver-run --bin pyhl
681+ cargo build --release --features wasm-host-fns --bin hyperlight-unikraft --bin multifn-test --bin pyhl
649682 Copy-Item target\release\hyperlight-unikraft.exe $env:USERPROFILE\.cargo\bin\ -Force
650683 Copy-Item target\release\multifn-test.exe $env:USERPROFILE\.cargo\bin\ -Force
651- Copy-Item target\release\pydriver-run.exe $env:USERPROFILE\.cargo\bin\ -Force
652684 Copy-Item target\release\pyhl.exe $env:USERPROFILE\.cargo\bin\ -Force
653685
654686 - name : Build echo Wasm host function
@@ -664,6 +696,15 @@ jobs:
664696 name : windows-image-${{ matrix.example }}
665697 path : image
666698
699+ - name : pyhl setup (python-agent-driver only)
700+ if : matrix.driver == 'pyhl'
701+ shell : pwsh
702+ run : |
703+ New-Item -ItemType Directory -Force -Path src-dir/.unikraft/build | Out-Null
704+ Copy-Item image/kernel src-dir/.unikraft/build/pyhl-kernel_hyperlight-x86_64
705+ Copy-Item image/initrd.cpio src-dir/pyhl-initrd.cpio
706+ pyhl setup --from src-dir --force
707+
667708 - name : Run and check output
668709 shell : pwsh
669710 run : |
@@ -758,10 +799,20 @@ jobs:
758799 $out = & multifn-test $kernel $cpio 2>&1
759800 $rc = $LASTEXITCODE
760801 }
761- 'pydriver-run' {
762- "print('hello from driver')" | Out-File -Encoding ascii tiny.py
763- $tiny = (Resolve-Path "tiny.py").Path
764- $out = & pydriver-run $kernel $cpio $tiny 2>&1
802+ 'pyhl' {
803+ $pyhlArgs = @('run', '-v')
804+ $pyhlScript = "${{ matrix.pyhl_script }}"
805+ $pyhlCode = "${{ matrix.pyhl_code }}"
806+ if ($pyhlScript -ne '') {
807+ Copy-Item "examples/${{ matrix.example }}/$pyhlScript" -Destination tiny.py
808+ $pyhlArgs += (Resolve-Path "tiny.py").Path
809+ } elseif ($pyhlCode -ne '') {
810+ $pyhlArgs += @('-c', $pyhlCode)
811+ }
812+ if ($runArgs -match '--net') {
813+ $pyhlArgs += '--net'
814+ }
815+ $out = & pyhl @pyhlArgs 2>&1
765816 $rc = $LASTEXITCODE
766817 }
767818 default {
0 commit comments