python3.10-http-server: Add test scripts - #90
Conversation
- build/: scripts for building the image using defconfigs. - defconfig/: minimal Unikraft configuration files. - run/: scripts for running images and rootfs generation. - README.md: instructions for the automation scripts. Signed-off-by: Arghir Elisa-Elena <arghirelisaelena@gmail.com>
c09a911 to
46766ac
Compare
Add scripts/test/ for python3.10-http-server/: - README.md: instructions to run the tests - common.sh: common functions and variables for test scripts - single.sh: test an instance started beforehand - wrapper.sh: wrapper over single.sh that also starts an instance - all.sh: test all configurations Signed-off-by: Arghir Elisa-Elena <arghirelisaelena@gmail.com>
46766ac to
82cc741
Compare
There was a problem hiding this comment.
Aside from these suggestions, also implement the changes I suggested on your other PR. I have not included them here.
| test -d ./scripts/test/log || mkdir ./scripts/test/log | ||
|
|
||
| test_build_run qemu.x86_64 127.0.0.1 8080 | ||
| test_build_run qemu.arm64 127.0.0.1 18080 |
There was a problem hiding this comment.
Change the port number from 18080 to 8080, I think it's a typo.
| test_build_run fc.x86_64 172.44.0.2 8080 | ||
| test_build fc.arm64 | ||
| test_build xen.x86_64 | ||
| test_build xen.arm64 |
There was a problem hiding this comment.
These 3 lines should all be test_build_run <plat>.<arch> <host> <port>, so
test_build_run fc.arm64 172.44.0.2 8080
test_build_run xen.x86_64 127.0.0.1 8080
test_build_run xen.arm64 127.0.0.1 8080
| echo "Using as remote $host:$port" 1>&2 | ||
|
|
||
| test_curl_connect "$host" "$port" | ||
| test_curl_check_reply "$host" "$port" "Directory listing" |
There was a problem hiding this comment.
This check will always fail, because the check string is wrong.
Instead of "Directory listing" it should be "Hello, World!", because that's what the server returns after a GET request.
| test_curl_connect "$host" "$port" | ||
| test_curl_check_reply "$host" "$port" "Directory listing" | ||
|
|
||
| end_with_success |
There was a problem hiding this comment.
This end_with_success is redundant, it makes the output include an extra PASSED message. The first one is printed by wrapper.sh, so there is no need for this one.
|
|
||
| clean_up | ||
| start_instance | ||
| sleep 10 |
There was a problem hiding this comment.
From what I tested, sleep 10 is not enough for the server to properly initialize, so the curl check will almost always fail. Increase it to 15 or higher.
| And then query it with the `single.sh` script: | ||
|
|
||
| ```console | ||
| ./single.sh |
There was a problem hiding this comment.
Include the path from the application directory:
./scripts/test/single.sh
Running single.sh from the test drectory will fail because it will not find the auxiliary script common.sh, it uses a relative path.
There was a problem hiding this comment.
Pull request overview
Adds a scripts-based build/run/test harness for the python3.10-http-server Unikraft app, including end-to-end smoke tests that can be run across multiple platform/arch configurations.
Changes:
- Adds
scripts/test/with common helpers plussingle.sh,wrapper.sh, andall.shfor automated test runs and log capture. - Introduces
scripts/build/*,scripts/run/*, andscripts/defconfig/*to build and boot the app across QEMU/Firecracker/Xen targets. - Adds README documentation for using the new scripts.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| python3.10-http-server/scripts/test/wrapper.sh | Wrapper to start an instance then run the single-instance HTTP checks. |
| python3.10-http-server/scripts/test/single.sh | Runs basic HTTP connectivity and response-content checks against a running instance. |
| python3.10-http-server/scripts/test/README.md | Documents how to run the test scripts. |
| python3.10-http-server/scripts/test/common.sh | Shared test helpers: cleanup, start, and connectivity checks. |
| python3.10-http-server/scripts/test/all.sh | Orchestrates building and running tests across supported configurations and logs output. |
| python3.10-http-server/scripts/test/.gitignore | Ignores generated test logs. |
| python3.10-http-server/scripts/run/xen.x86_64 | Xen x86_64 run script: rootfs generation, initrd packaging, and xl launch. |
| python3.10-http-server/scripts/run/xen.arm64 | Xen arm64 run script: rootfs generation, initrd packaging, and xl launch. |
| python3.10-http-server/scripts/run/qemu.x86_64 | QEMU x86_64 run script with host port forward and kernel/initrd boot args. |
| python3.10-http-server/scripts/run/qemu.arm64 | QEMU arm64 run script with host port forward and kernel/initrd boot args. |
| python3.10-http-server/scripts/run/fc.x86_64 | Firecracker x86_64 run script using a config JSON and socket cleanup. |
| python3.10-http-server/scripts/run/fc.arm64 | Firecracker arm64 run script using a config JSON and socket cleanup. |
| python3.10-http-server/scripts/README.md | Documents the build/run script entrypoints and usage. |
| python3.10-http-server/scripts/defconfig/xen.x86_64 | Xen x86_64 Unikraft defconfig for this app. |
| python3.10-http-server/scripts/defconfig/xen.arm64 | Xen arm64 Unikraft defconfig for this app. |
| python3.10-http-server/scripts/defconfig/qemu.x86_64 | QEMU x86_64 Unikraft defconfig for this app. |
| python3.10-http-server/scripts/defconfig/qemu.arm64 | QEMU arm64 Unikraft defconfig for this app. |
| python3.10-http-server/scripts/defconfig/fc.x86_64 | Firecracker x86_64 Unikraft defconfig for this app. |
| python3.10-http-server/scripts/defconfig/fc.arm64 | Firecracker arm64 Unikraft defconfig for this app. |
| python3.10-http-server/scripts/build/xen.x86_64 | Xen x86_64 build script that applies defconfig and builds. |
| python3.10-http-server/scripts/build/xen.arm64 | Xen arm64 build script that applies defconfig and builds. |
| python3.10-http-server/scripts/build/qemu.x86_64 | QEMU x86_64 build script that applies defconfig and builds. |
| python3.10-http-server/scripts/build/qemu.arm64 | QEMU arm64 build script that applies defconfig and builds. |
| python3.10-http-server/scripts/build/fc.x86_64 | Firecracker x86_64 build script that applies defconfig and builds. |
| python3.10-http-server/scripts/build/fc.arm64 | Firecracker arm64 build script that applies defconfig and builds. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| start_instance() | ||
| { | ||
| # Start instance. | ||
| setsid --fork "$start_command" 1>&2 & | ||
| if test $? -ne 0; then | ||
| echo "Cannot start instance" 1>&2 | ||
| echo "FAILED" | ||
| clean_up | ||
| exit 1 | ||
| fi |
| CONFIG_ARCH_X86_64=y | ||
| CONFIG_PLAT_XEN=y | ||
| CONFIG_APP_PYHTON3_HTTP_SERVER=y | ||
| CONFIG_LIBPYTHON3=y |
| CONFIG_ARCH_ARM64=y | ||
| CONFIG_PLAT_XEN=y | ||
| CONFIG_APP_PYHTON3_HTTP_SERVER=y | ||
| CONFIG_LIBPYTHON3=y |
| @@ -0,0 +1,13 @@ | |||
| CONFIG_ARCH_ARM64=y | |||
| CONFIG_PLAT_FC=y | |||
| CONFIG_APPPYHTON3_HTTP_SERVER=y | |||
| And then query it with the `single.sh` script: | ||
|
|
||
| ```console | ||
| ./single.sh |
| @@ -0,0 +1,56 @@ | |||
| # Scripts for Python3.10-http-server on Unikraft | |||
|
|
|||
| These are companions instruction to the main instructions in the [`README`](README.md). | |||
| # Scripts for Python3.10-http-server on Unikraft | ||
|
|
||
| These are companions instruction to the main instructions in the [`README`](README.md). | ||
|
|
||
| Use scripts as quick actions for building and running Python3.10-http-server on Unikraft. | ||
|
|
||
| **Note**: Run scripts from the application directory. | ||
|
|
Add scripts/test/ directory with scripts used for testing: