-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert adapters to Python #48
Conversation
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Thanks a lot for the change. I do understand the motivation and I think it makes sense for Github Workflow. However, this change adds a requirement that all the adapters now have to be bash scripts. I'd rather avoid that unless it's absolutely necessary. Could we potentially solve it in a way so it doesn't force adapter maintainers to only write bash scripts? |
Obviously fair point. I have thought of two possible solutions. Neither is great 😅
i.e. a bare executable without leading path, or we'll also need to parse the path (of course /bin/sh won't make any sense on windows)
While I would favor (2) it's only slightly less of a hack |
PS after this change, there's still a problem with the shell scripts (at least in git bash). For example, assemblyscript It may be a better choice to not use bash and also python, rather just python? In other words maybe we can avoid the whole fork bash problems by not using it and instead have the shims python? $ python3 test-runner/wasi_test_runner.py -t ./tests/assemblyscript/testsuite/ -r adapters/wasmtime.sh
--snip--
Test environ_get-multiple-variables failed
[exit_code] 0 == 1
STDOUT
Unknown option line
--snip-- |
using Python would seem fair to me. After all the adapters are pretty simple |
I'd be ok with using Python as adapter, given it's very simple and we already require it for runtime anyway. @evacchi would you like to update your PR to support Python for adapters? |
so translate the other adapters? sure that's doable if you're ok with it :) |
I have added another commit (we can close/squash/whatever the PR in case this looks good) to run python-based adapters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, the change looks good to me. I left a few minor comments. i think we should also delete bash adapters once we have python ones too.
I think we should also update the documentation and and CI jobs. Please let me know if you can help with those as well.
Wonderful, sure will look into that too. In the meantime I am also making super sure everything works as expected |
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
I think I have applied the changes you suggested; obviously feel free to add more comments :) in case all is good, feel also free to squash the PR and merge (unless we want me to rebase and squash explicitly) Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good. I don't know of any other runtime that implements the adapter (other than toywasm, which already is written in Python), so I think we can merge it now.
Many thanks for making the change!
While setting up CI on GHA for wazero to run against the test suite, we realized that the Python script is assuming a Unix environment. I am opening this PR to start a discussion on the best approach. In my own tests, this worked reliably.
This PR:
colorama>=0.4.3
, otherwise pip on Windows (GHAwindows-2022
) raises the error:converts the shell-based adapters to Python and invokes them through the current Python interpreter (in a new sub-process)
updates docs and GitHub actions accordingly
(Originally proposed changes – no longer apply)
2. we explicitly invoke the shell adapter through `bash` instead of relying on the `#!` directive, because on Windows that won't work. Of course this also means that all adapters would be now expected to be runnable on bash.bash
(installed underC:\Program Files\Git\bin
is not on the PATH when invoked from Python on GHA, invoking insteadC:\Windows\system32\bash.exe
which is just a stub that prints a message telling the user to install WSL (which of course we don't want as that's a virtualized linux distro).Instead of fiddling with PATH, I decided to export an env variable (TEST_SHELL_RUNNER
), which defaults tobash
that can be overridden to a full path to a shell executable.EDIT: minimal reproducer https://github.com/evacchi/gha-playground/actions/runs/4013516139/jobs/6892946727EDIT2: I found a better workaround actions/runner-images#1081 (comment)
Signed-off-by: Edoardo Vacchi evacchi@users.noreply.github.com