59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
name: gvisor-resource-test
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
resource-test:
|
|
runs-on: gvisor
|
|
steps:
|
|
- name: Environment
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
grep -qi gvisor /proc/version
|
|
echo "kernel: $(uname -r)"
|
|
echo "nproc: $(nproc)"
|
|
free -m || true
|
|
df -h .
|
|
|
|
- name: Disk I/O (2 GiB write + read)
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
echo "Writing 2 GiB to the job workspace..."
|
|
sync
|
|
dd if=/dev/zero of=./gvisor-disk-test bs=1M count=2048 2>&1 | tail -1
|
|
sync
|
|
echo "Reading 2 GiB back..."
|
|
dd if=./gvisor-disk-test of=/dev/null bs=1M 2>&1 | tail -1
|
|
ls -lh ./gvisor-disk-test
|
|
rm -f ./gvisor-disk-test
|
|
|
|
- name: Memory allocation (2 GiB)
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
start=$(date +%s)
|
|
# BusyBox awk: create 2048 one-MiB strings and touch them so the
|
|
# allocation really happens inside the gVisor sandbox.
|
|
awk 'BEGIN {
|
|
for (i = 0; i < 2048; i++) a[i] = sprintf("%01048576s", "");
|
|
# Touch every string so the pages really stay resident.
|
|
for (i = 0; i < 2048; i++) if (length(a[i]) != 1048576) exit 1;
|
|
printf "allocated=%d MiB\n", 2048;
|
|
}'
|
|
end=$(date +%s)
|
|
echo "elapsed_s=$((end - start))"
|
|
|
|
- name: CPU scheduling (1 core, then 4 parallel workers)
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
echo "Single-core awk integer loop:"
|
|
time awk 'BEGIN { for (i = 0; i < 10000000; i++) x += i; print x }'
|
|
echo "Four parallel awk loops:"
|
|
time sh -c 'for i in 1 2 3 4; do awk "BEGIN { for (i = 0; i < 5000000; i++) x += i; print x }" & done; wait'
|