Revert "ci: remove cross toolchain"

Turns out this was actually being used through magic.

Remove mips since it is a tier 3 target that is only supported on
nightly and dtolnay/rust-toolchain doesn't seem to handle installing
targets without std.

Exclude xtask since it depends on `ring` which doesn't build on all
targets.

Fix compilation on armv7 which had rotted.

This reverts commit d92fc95c39.
reviewable/pr1203/r1
Tamir Duberstein 1 week ago
parent 34319cba12
commit e16f0482f8

@ -71,10 +71,9 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
bpf_target_arch: arch:
- aarch64-unknown-linux-gnu - aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabi - armv7-unknown-linux-gnueabi
- mips-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu - powerpc64le-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu - riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu - s390x-unknown-linux-gnu
@ -84,11 +83,18 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.arch }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack - uses: taiki-e/install-action@cargo-hack
# This is magic, it sets `$CARGO_BUILD_TARGET`.
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.arch }}
- name: Build - name: Build
run: | run: |
set -euxo pipefail set -euxo pipefail
@ -97,6 +103,7 @@ jobs:
--exclude aya-ebpf-bindings \ --exclude aya-ebpf-bindings \
--exclude aya-log-ebpf \ --exclude aya-log-ebpf \
--exclude integration-ebpf \ --exclude integration-ebpf \
--exclude xtask \
--workspace --workspace
- name: Test - name: Test
@ -110,6 +117,7 @@ jobs:
--exclude aya-log-ebpf \ --exclude aya-log-ebpf \
--exclude integration-ebpf \ --exclude integration-ebpf \
--exclude integration-test \ --exclude integration-test \
--exclude xtask \
--workspace --workspace
- name: Doctests - name: Doctests
@ -124,6 +132,7 @@ jobs:
--exclude init \ --exclude init \
--exclude integration-ebpf \ --exclude integration-ebpf \
--exclude integration-test \ --exclude integration-test \
--exclude xtask \
--workspace --workspace
build-test-aya-ebpf: build-test-aya-ebpf:

@ -1,6 +1,6 @@
use std::{ use std::{
cmp, cmp,
ffi::{CStr, CString, c_char, c_long}, ffi::{CStr, CString, c_char},
io, iter, io, iter,
mem::{self, MaybeUninit}, mem::{self, MaybeUninit},
os::fd::{AsFd as _, AsRawFd as _, BorrowedFd, FromRawFd as _, RawFd}, os::fd::{AsFd as _, AsRawFd as _, BorrowedFd, FromRawFd as _, RawFd},
@ -1079,7 +1079,7 @@ fn bpf_prog_load(attr: &mut bpf_attr) -> io::Result<crate::MockableFd> {
unsafe { fd_sys_bpf(bpf_cmd::BPF_PROG_LOAD, attr) } unsafe { fd_sys_bpf(bpf_cmd::BPF_PROG_LOAD, attr) }
} }
fn sys_bpf(cmd: bpf_cmd, attr: &mut bpf_attr) -> io::Result<c_long> { fn sys_bpf(cmd: bpf_cmd, attr: &mut bpf_attr) -> io::Result<i64> {
syscall(Syscall::Ebpf { cmd, attr }).map_err(|(code, io_error)| { syscall(Syscall::Ebpf { cmd, attr }).map_err(|(code, io_error)| {
assert_eq!(code, -1); assert_eq!(code, -1);
io_error io_error

@ -8,7 +8,7 @@ mod perf_event;
mod fake; mod fake;
use std::{ use std::{
ffi::{c_int, c_long, c_void}, ffi::{c_int, c_void},
io, io,
os::fd::{BorrowedFd, OwnedFd}, os::fd::{BorrowedFd, OwnedFd},
}; };
@ -23,7 +23,7 @@ pub(crate) use netlink::*;
pub(crate) use perf_event::*; pub(crate) use perf_event::*;
use thiserror::Error; use thiserror::Error;
pub(crate) type SysResult = Result<c_long, (c_long, io::Error)>; pub(crate) type SysResult = Result<i64, (i64, io::Error)>;
#[cfg_attr(test, expect(dead_code))] #[cfg_attr(test, expect(dead_code))]
#[derive(Debug)] #[derive(Debug)]
@ -139,6 +139,9 @@ fn syscall(call: Syscall<'_>) -> SysResult {
} }
} }
}; };
// c_long is i32 on armv7.
#[allow(clippy::useless_conversion)]
let ret: i64 = ret.into();
match ret { match ret {
0.. => Ok(ret), 0.. => Ok(ret),

Loading…
Cancel
Save