Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

CI: Test Pulley on 32-bit and no_std targets #9013

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
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
27 changes: 18 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ jobs:
- run: rustup target add x86_64-unknown-none
- run: cargo check --target x86_64-unknown-none -p wasmtime --no-default-features --features runtime,gc,component-model
- run: cargo check --target x86_64-unknown-none -p cranelift-control --no-default-features
- run: cargo check --target x86_64-unknown-none -p pulley-interpreter --features encode,decode,disas,interp

# Check that wasmtime compiles with panic=abort since there's some `#[cfg]`
# for specifically panic=abort there.
Expand Down Expand Up @@ -604,22 +605,30 @@ jobs:

- run: cargo fetch --locked

- uses: actions/cache@v4
with:
path: ${{ runner.tool_cache }}/qemu
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patchcpuinfo
if: matrix.target != '' && matrix.os == 'ubuntu-latest'
- name: Install cross-compilation tools
run: |
set -ex

sudo apt-get update
sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build

# Configure Cargo for cross compilation and tell it how it can run
# cross executables
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} >> $GITHUB_ENV
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV
if: matrix.gcc != ''

- uses: actions/cache@v4
with:
path: ${{ runner.tool_cache }}/qemu
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patchcpuinfo
if: matrix.qemu != ''
- name: Install qemu
run: |
set -ex

upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} >> $GITHUB_ENV

# QEMU emulation is not always the speediest, so total testing time
# goes down if we build the libs in release mode when running tests.
Expand All @@ -643,7 +652,7 @@ jobs:
./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache}}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs
ninja -C build install
touch ${{ runner.tool_cache }}/qemu/built
if: matrix.gcc != ''
if: matrix.qemu != ''

# Record some CPU details; this is helpful information if tests fail due
# to CPU-specific features.
Expand Down Expand Up @@ -817,7 +826,7 @@ jobs:
if: failure() && github.event_name != 'pull_request'
env:
GH_TOKEN: ${{ github.token }}

build-preview1-component-adapter-provider:
name: Build wasi-preview1-component-adapter-provider
needs: build-preview1-component-adapter
Expand All @@ -830,7 +839,7 @@ jobs:
- uses: ./.github/actions/build-adapter-provider
with:
run-id: ${{ github.run_id }}


# common logic to cancel the entire run if this job fails
- run: gh run cancel ${{ github.run_id }}
Expand Down
41 changes: 40 additions & 1 deletion ci/build-test-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,27 @@ const FULL_MATRIX = [
"name": "Test Linux riscv64",
"filter": "linux-riscv64",
"isa": "riscv64",
}
},
{
"name": "Test Pulley on i686-unknown-linux-gnu",
"32-bit": true,
"os": "ubuntu-latest",
"target": "i686-unknown-linux-gnu",
"gcc_package": "gcc-i686-linux-gnu",
"gcc": "i686-linux-gnu-gcc",
"filter": "pulley",
},
{
"name": "Test Pulley on armv7-unknown-linux-gnueabihf",
"32-bit": true,
"os": "ubuntu-latest",
"target": "armv7-unknown-linux-gnueabihf",
"gcc_package": "gcc-arm-linux-gnueabihf",
"gcc": "arm-linux-gnueabihf-gcc",
"qemu": "qemu-arm -L /usr/arm-linux-gnueabihf -E LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib",
"qemu_target": "arm-linux-user",
"filter": "pulley",
},
];

/// Get the workspace's full list of member crates.
Expand Down Expand Up @@ -198,6 +218,20 @@ async function shard(configs) {
// created above.
const sharded = [];
for (const config of configs) {
// Special case 32-bit configs. Only Pulley runs on 32-bit targets.
if (config["32-bit"] === true) {
sharded.push(Object.assign(
{},
config,
{
bucket: members
.map(c => c.indexOf("pulley") !== -1 ? `--package ${c}` : `--exclude ${c}`)
.join(" "),
}
));
continue;
}

for (const bucket of buckets) {
sharded.push(Object.assign(
{},
Expand Down Expand Up @@ -255,6 +289,11 @@ async function main() {
return config.isa !== undefined;
}

// If any Pulley source file was modified, then run Pulley-specific configs.
if (names.includes("pulley") && config.filter == "pulley") {
return true;
}

// If the commit explicitly asks for this test config, then include it.
if (config.filter && commits.includes(`prtest:${config.filter}`)) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion pulley/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ impl Decoder {
V: OpVisitor<BytecodeStream = SafeBytecodeStream<'a>> + ExtendedOpVisitor,
{
let mut decoder = Decoder::new();
let mut results = vec![];
let mut results = Vec::new();

while !visitor.bytecode().as_slice().is_empty() {
results.push(decoder.decode_one(visitor)?);
Expand Down