Skip to content

Commit

Permalink
Enable CI for Loongarch64 (#2509)
Browse files Browse the repository at this point in the history
* ci: enable loongarch64-unknown-linux-gnu

Co-authored-by: donmor <[email protected]>

* Ignore `test_disable_enable_perf_events` and `test_get_set_thp_disable` on Loongarch64 QEMU

---------

Co-authored-by: donmor <[email protected]>
  • Loading branch information
Fearyncess and donmor authored Sep 22, 2024
1 parent a0869f9 commit a1384d0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ permissions:

env:
MSRV: 1.69.0
# Rust's Loongarch support merged in 1.71.0
MSRV_LOONGARCH: 1.71.0
RUSTFLAGS: -Dwarnings

jobs:
Expand Down Expand Up @@ -92,6 +94,7 @@ jobs:
mips64el-unknown-linux-gnuabi64,
mipsel-unknown-linux-gnu,
powerpc64le-unknown-linux-gnu,
loongarch64-unknown-linux-gnu,
]

steps:
Expand All @@ -101,7 +104,8 @@ jobs:
- name: setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: '${{ env.MSRV }}'
# Use a newer version rustc if the target is Loongarch, remove this workaround after MSRV is newer than 1.71.0
toolchain: "${{ matrix.target == 'loongarch64-unknown-linux-gnu' && env.MSRV_LOONGARCH || env.MSRV }}"
components: clippy

# cross relies on docker or podman, GitHub Acton already has it installed.
Expand Down
3 changes: 3 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ passthrough = [
"RUSTFLAGS",
"RUST_TEST_THREADS"
]

[target.loongarch64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/loongarch64-unknown-linux-gnu:edge"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The following targets are supported by `nix`:
<li>arm-unknown-linux-musleabi</li>
<li>armv7-linux-androideabi</li>
<li>i686-linux-android</li>
<li>loongarch64-unknown-linux-gnu</li>
<li>s390x-unknown-linux-gnu</li>
<li>x86_64-linux-android</li>
<li>x86_64-unknown-illumos</li>
Expand Down
8 changes: 8 additions & 0 deletions test/sys/test_prctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ mod test_prctl {
prctl::set_timerslack(original).unwrap();
}

// Loongarch need to use a newer QEMU that disabled these PRCTL subcodes/methods.
// https://github.com/qemu/qemu/commit/220717a6f46a99031a5b1af964bbf4dec1310440
// So we should ignore them when testing in QEMU environments.
#[cfg_attr(all(qemu, target_arch = "loongarch64"), ignore)]
#[test]
fn test_disable_enable_perf_events() {
prctl::task_perf_events_disable().unwrap();
Expand All @@ -112,6 +116,10 @@ mod test_prctl {
assert!(no_new_privs);
}

// Loongarch need to use a newer QEMU that disabled these PRCTL subcodes/methods
// https://github.com/qemu/qemu/commit/220717a6f46a99031a5b1af964bbf4dec1310440
// So we should ignore them when testing in QEMU environments.
#[cfg_attr(all(qemu, target_arch = "loongarch64"), ignore)]
#[test]
fn test_get_set_thp_disable() {
let original = prctl::get_thp_disable().unwrap();
Expand Down

0 comments on commit a1384d0

Please sign in to comment.