Skip to content

python3.10-http-server: Add test scripts#90

Open
elisaarghir wants to merge 2 commits into
unikraft:testfrom
elisaarghir:test-python3.10
Open

python3.10-http-server: Add test scripts#90
elisaarghir wants to merge 2 commits into
unikraft:testfrom
elisaarghir:test-python3.10

Conversation

@elisaarghir
Copy link
Copy Markdown

Add scripts/test/ directory with scripts used for testing:

  • .gitignore: files to be ignored by GIT
  • all.sh: script that tests all available configurations
  • wrapper.sh: wrapper script over test.sh that starts the instance beforehand
  • common.sh: script with common variables and functions, included by other scripts
  • single.sh: basic script to test started instance
  • README.md: instructions to run the tests

- 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>
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>
@razvand razvand requested a review from george17c March 1, 2026 07:09
@razvand razvand self-assigned this Mar 1, 2026
@razvand razvand added the enhancement New feature or request label Mar 1, 2026
Copy link
Copy Markdown

@george17c george17c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

@george17c george17c Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

@george17c george17c Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants