Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ jobs:
times=()
for i in $(seq 1 15); do
ms=$( { /usr/bin/time -f "%e" pyhl run -c "print(42)" > /dev/null; } 2>&1 )
ms_int=$(echo "$ms * 1000" | bc | cut -d. -f1)
ms_int=$(echo "$ms * 1000" | tr -d '\r' | bc | cut -d. -f1)
times+=($ms_int)
echo " run $i: ${ms_int}ms"
done
Expand Down Expand Up @@ -223,7 +223,7 @@ jobs:
times=()
for i in $(seq 1 10); do
ms=$( { /usr/bin/time -f "%e" pyhl run /tmp/pandas_bench.py > /dev/null; } 2>&1 )
ms_int=$(echo "$ms * 1000" | bc | cut -d. -f1)
ms_int=$(echo "$ms * 1000" | tr -d '\r' | bc | cut -d. -f1)
times+=($ms_int)
echo " run $i: ${ms_int}ms"
done
Expand Down
79 changes: 65 additions & 14 deletions .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,18 @@ jobs:
- example: python-agent-driver
args: ""
expect: "hello from driver"
driver: pydriver-run
driver: pyhl
pyhl_code: "print('hello from driver')"
- example: python-agent-driver
args: ""
expect: "hello from hyperlight guest"
driver: pyhl
pyhl_script: demo_busybox.py
- example: python-agent-driver
args: "--net"
expect: "imported six"
driver: pyhl
pyhl_script: demo_pip_install.py
- example: powershell
args: "-- -NoProfile -File /scripts/hello.ps1"
expect: "Hello, World! From PowerShell on Hyperlight"
Expand Down Expand Up @@ -281,8 +292,9 @@ jobs:
if: steps.kvm_check.outputs.available == 'true'
run: |
cd host
cargo build --release --features wasm-host-fns --bin hyperlight-unikraft --bin multifn-test --bin pydriver-run
cargo build --release --features wasm-host-fns --bin hyperlight-unikraft --bin multifn-test --bin pyhl
sudo cp target/release/hyperlight-unikraft /usr/local/bin/
sudo cp target/release/pyhl /usr/local/bin/

- name: Build echo Wasm host function
if: steps.kvm_check.outputs.available == 'true' && matrix.needs_echo_tool == true
Expand Down Expand Up @@ -322,9 +334,10 @@ jobs:
kraft-hyperlight --no-prompt build --plat hyperlight --arch x86_64
fi

- name: Prepare pydriver-run script (python-agent-driver only)
if: steps.kvm_check.outputs.available == 'true' && matrix.driver == 'pydriver-run'
run: echo 'print("hello from driver")' > /tmp/tiny.py
- name: pyhl setup (python-agent-driver only)
if: steps.kvm_check.outputs.available == 'true' && matrix.driver == 'pyhl'
working-directory: examples/${{ matrix.example }}
run: pyhl setup --from . --force

- name: Run and check output
if: steps.kvm_check.outputs.available == 'true'
Expand Down Expand Up @@ -401,8 +414,17 @@ jobs:
multifn-test)
cmd=(timeout 60 /home/runner/work/hyperlight-unikraft/hyperlight-unikraft/host/target/release/multifn-test "$kernel" "$cpio")
;;
pydriver-run)
cmd=(timeout 120 /home/runner/work/hyperlight-unikraft/hyperlight-unikraft/host/target/release/pydriver-run "$kernel" "$cpio" /tmp/tiny.py)
pyhl)
pyhl_args=()
if [ -n "${{ matrix.pyhl_script }}" ]; then
pyhl_args+=(examples/${{ matrix.example }}/${{ matrix.pyhl_script }})
elif [ -n "${{ matrix.pyhl_code }}" ]; then
pyhl_args+=(-c "${{ matrix.pyhl_code }}")
fi
if echo "${{ matrix.args }}" | grep -q "\-\-net"; then
pyhl_args+=(--net)
fi
cmd=(timeout 300 pyhl run -v "${pyhl_args[@]}")
;;
*)
mem_args=""
Expand Down Expand Up @@ -606,7 +628,18 @@ jobs:
- example: python-agent-driver
args: ""
expect: "hello from driver"
driver: pydriver-run
driver: pyhl
pyhl_code: "print('hello from driver')"
- example: python-agent-driver
args: ""
expect: "hello from hyperlight guest"
driver: pyhl
pyhl_script: demo_busybox.py
- example: python-agent-driver
args: "--net"
expect: "imported six"
driver: pyhl
pyhl_script: demo_pip_install.py
- example: powershell
args: "-- -NoProfile -File /scripts/hello.ps1"
expect: "Hello, World! From PowerShell on Hyperlight"
Expand Down Expand Up @@ -645,10 +678,9 @@ jobs:
shell: pwsh
run: |
cd host
cargo build --release --features wasm-host-fns --bin hyperlight-unikraft --bin multifn-test --bin pydriver-run --bin pyhl
cargo build --release --features wasm-host-fns --bin hyperlight-unikraft --bin multifn-test --bin pyhl
Copy-Item target\release\hyperlight-unikraft.exe $env:USERPROFILE\.cargo\bin\ -Force
Copy-Item target\release\multifn-test.exe $env:USERPROFILE\.cargo\bin\ -Force
Copy-Item target\release\pydriver-run.exe $env:USERPROFILE\.cargo\bin\ -Force
Copy-Item target\release\pyhl.exe $env:USERPROFILE\.cargo\bin\ -Force

- name: Build echo Wasm host function
Expand All @@ -664,6 +696,15 @@ jobs:
name: windows-image-${{ matrix.example }}
path: image

- name: pyhl setup (python-agent-driver only)
if: matrix.driver == 'pyhl'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path src-dir/.unikraft/build | Out-Null
Copy-Item image/kernel src-dir/.unikraft/build/pyhl-kernel_hyperlight-x86_64
Copy-Item image/initrd.cpio src-dir/pyhl-initrd.cpio
pyhl setup --from src-dir --force

- name: Run and check output
shell: pwsh
run: |
Expand Down Expand Up @@ -758,10 +799,20 @@ jobs:
$out = & multifn-test $kernel $cpio 2>&1
$rc = $LASTEXITCODE
}
'pydriver-run' {
"print('hello from driver')" | Out-File -Encoding ascii tiny.py
$tiny = (Resolve-Path "tiny.py").Path
$out = & pydriver-run $kernel $cpio $tiny 2>&1
'pyhl' {
$pyhlArgs = @('run', '-v')
$pyhlScript = "${{ matrix.pyhl_script }}"
$pyhlCode = "${{ matrix.pyhl_code }}"
if ($pyhlScript -ne '') {
Copy-Item "examples/${{ matrix.example }}/$pyhlScript" -Destination tiny.py
$pyhlArgs += (Resolve-Path "tiny.py").Path
} elseif ($pyhlCode -ne '') {
$pyhlArgs += @('-c', $pyhlCode)
}
if ($runArgs -match '--net') {
$pyhlArgs += '--net'
}
$out = & pyhl @pyhlArgs 2>&1
$rc = $LASTEXITCODE
}
default {
Expand Down
8 changes: 4 additions & 4 deletions examples/dotnet-http/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: dotnet-http-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
# Platform
CONFIG_PLAT_HYPERLIGHT: 'y'
Expand Down Expand Up @@ -90,8 +90,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/dotnet-nativeaot/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: dotnet-nativeaot-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
CONFIG_PLAT_HYPERLIGHT: 'y'
CONFIG_PAGING: 'n'
Expand Down Expand Up @@ -56,8 +56,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/dotnet/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: dotnet-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
# Platform
CONFIG_PLAT_HYPERLIGHT: 'y'
Expand Down Expand Up @@ -78,8 +78,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/go-http/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: go-http-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
# Platform
CONFIG_PLAT_HYPERLIGHT: 'y'
Expand Down Expand Up @@ -79,8 +79,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/go/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ specification: '0.6'
name: go-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
# Platform
CONFIG_PLAT_HYPERLIGHT: 'y'
Expand Down Expand Up @@ -64,8 +64,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/helloworld-c/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: helloworld-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
CONFIG_PLAT_HYPERLIGHT: 'y'
CONFIG_PAGING: 'n'
Expand Down Expand Up @@ -55,8 +55,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/hostfs-posix-c/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: hostfs-posix-c-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
# Platform
CONFIG_PLAT_HYPERLIGHT: 'y'
Expand Down Expand Up @@ -71,8 +71,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/hostfs-posix-py/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: hostfs-posix-py-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
# Platform
CONFIG_PLAT_HYPERLIGHT: 'y'
Expand Down Expand Up @@ -76,8 +76,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/multifn-c/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: multifn-c-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
CONFIG_PLAT_HYPERLIGHT: 'y'
CONFIG_PAGING: 'n'
Expand Down Expand Up @@ -49,8 +49,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/networking-py/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ specification: '0.6'
name: networking-py-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
# Platform
CONFIG_PLAT_HYPERLIGHT: 'y'
Expand Down Expand Up @@ -72,8 +72,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
8 changes: 4 additions & 4 deletions examples/nodejs/kraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ specification: '0.6'
name: nodejs-hyperlight

unikraft:
source: https://github.com/unikraft/unikraft.git
version: plat-hyperlight
source: https://github.com/danbugs/unikraft.git
version: proto/vfork
kconfig:
# Platform
CONFIG_PLAT_HYPERLIGHT: 'y'
Expand Down Expand Up @@ -74,8 +74,8 @@ unikraft:

libraries:
app-elfloader:
source: https://github.com/unikraft/app-elfloader.git
version: plat-hyperlight
source: https://github.com/danbugs/app-elfloader.git
version: proto/vfork
libelf:
source: https://github.com/unikraft/lib-libelf.git
version: staging
Expand Down
Loading
Loading