Skip to content
Open
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
55 changes: 55 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,58 @@ The following command can be used to generate the `compile_commands.json` file:
```
BAZEL_BUILD_OPTION_LIST="--define=engine=multi" ./tools/gen_compilation_database.py --include_all //test/... //:lib
```

## Testing s390x locally

The s390x build-tools image used in our CI environment does not contain all the tools necessary to build test wasm modules. First, build those wasm modules in your native environment:

```bash
bazel build --verbose_failures --test_output=errors --config=clang --config=hermetic-llvm -c opt $(bazel query 'kind(was.*_rust_binary, //test/test_data/...)') $(bazel query 'kind(_optimized_wasm_cc_binary, //test/test_data/...)')

# Copy the built artifacts to the test_data dir.
cp bazel-bin/test/test_data/*.wasm test/test_data/

# Rewrite test/test_data/BUILD to use the pre-built wasm module artifacts
echo "package(default_visibility = [\"//visibility:public\"])" > test/test_data/BUILD
for i in $(cd test/test_data && ls -1 *.wasm | sed 's/\.wasm$//g'); do \
echo "filegroup(name = \"$i\", srcs = [\"$i.wasm\"])" >> test/test_data/BUILD; \
done
# Rewrite test/BUILD to use the pre-built artifacts
sed 's/\.wasm//g' test/BUILD > test/BUILD.tmp && mv test/BUILD.tmp test/BUILD
```
Comment on lines +17 to +30
Copy link
Member

Choose a reason for hiding this comment

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

Since this is a bit error prone and repeated here and in the CI, perhaps extract this to a script?

Alternatively, maybe we should fix building test data on S390x? Rust modules should just work, since we're building Wasmtime, and we could either check if Emscripten supports S390x or perhaps skip tests using C++ SDK when testing locally?


s390x tests can be run locally using the build-tools docker images published in
this repo. An s390x QEMU emulator is required to be installed ([example
instructions](https://docs.gitlab.com/omnibus/development/s390x/#vm-provisioning)).
Comment on lines +32 to +34
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just include those 2 lines here instead of linking?

The following command will start an interactive session in an emulated s390x
Copy link
Member

Choose a reason for hiding this comment

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

Nit: missing separation between paragraphs.

environment with bazel installed. The command mounts $HOME inside the container
and assumes proxy-wasm-cpp-host is somewhere under $HOME.

```bash
docker run --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/s390x --interactive -t --env PS1="docker (s390x):" ghcr.io/proxy-wasm/build-tools:ubuntu-24.04-bazel-7.7.1 bash

# Set a useful prompt to remind yourself this shell is in s390x:
export PS1='docker@s390x:\[\033[01;34m\]\w\[\033[00m\] )> '
Copy link
Member

Choose a reason for hiding this comment

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

You're already configuring PS1 in the docker invocation.

```

Inside this shell, you may now call out to bazel to run any build or test
command using the s390x environment. Note that `--config=hermetic-llvm` is not
supported for s390x.

```bash
bazel test --verbose_failures --test_output=errors --define engine=wasmtime --config=clang --test_timeout=1800 //test:runtime_test --test_filter=\*PassingValue\*
```


### Troubleshooting

If you experience errors relating to GCC_DUMMY_TOOLCHAIN, re-check that your
test/test_data/BUILD file contains only `filegroup()` rules pointing at
pre-build wasm modules.

If you get a "Required file not available" error message when executing a
toolchain with your host architecture in the file path, it is likely due to
bazel re-using a cache from your host environment. Please run `bazel clean
--expunge` and `bazel shutdown` in the docker container to clear bazel's cache
analysis cache.

Loading