Build Wasm modules (#5830)

This commit is contained in:
rbehjati 2021-05-25 15:36:20 +01:00 committed by GitHub
parent 693dd5037f
commit 4325d5b3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -29,7 +29,11 @@ RUN curl --location https://github.com/protocolbuffers/protobuf/releases/downloa
&& chmod --recursive a+rwx ${protobuf_dir} \
&& protoc --version
# Install WebAssembly target for Rust.
RUN rustup target add wasm32-unknown-unknown
RUN git clone --depth 1 https://github.com/project-oak/oak oak
WORKDIR oak
COPY build.sh $SRC/
COPY rustc.py $SRC/

View File

@ -24,7 +24,16 @@ then
export RUSTC="$SRC/rustc.py"
fi
cargo fuzz build -O
cargo fuzz build --release
# Clear RUSTFLAGS, and build the fuzzable example. The Wasm module is stored in `/out/bin`.
# Keep this in sync with `https://github.com/project-oak/oak/blob/main/oak_functions/loader/fuzz/fuzz_targets/wasm_invoke.rs`.
export RUSTFLAGS=""
cargo -Zunstable-options build \
--target=wasm32-unknown-unknown \
--target-dir=target/wasm32-unknown-unknown/wasm \
--out-dir="$OUT/bin" \
--manifest-path=../examples/fuzzable/module/Cargo.toml
FUZZ_TARGET_OUTPUT_DIR=fuzz/target/x86_64-unknown-linux-gnu/release
for f in fuzz/fuzz_targets/*.rs