Skip to content

Commit a1384d0

Browse files
Fearyncessdonmor
andauthored
Enable CI for Loongarch64 (#2509)
* 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]>
1 parent a0869f9 commit a1384d0

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

.github/workflows/ci.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ permissions:
1414

1515
env:
1616
MSRV: 1.69.0
17+
# Rust's Loongarch support merged in 1.71.0
18+
MSRV_LOONGARCH: 1.71.0
1719
RUSTFLAGS: -Dwarnings
1820

1921
jobs:
@@ -92,6 +94,7 @@ jobs:
9294
mips64el-unknown-linux-gnuabi64,
9395
mipsel-unknown-linux-gnu,
9496
powerpc64le-unknown-linux-gnu,
97+
loongarch64-unknown-linux-gnu,
9598
]
9699

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

107111
# cross relies on docker or podman, GitHub Acton already has it installed.

Cross.toml

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ passthrough = [
33
"RUSTFLAGS",
44
"RUST_TEST_THREADS"
55
]
6+
7+
[target.loongarch64-unknown-linux-gnu]
8+
image = "ghcr.io/cross-rs/loongarch64-unknown-linux-gnu:edge"

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ The following targets are supported by `nix`:
8585
<li>arm-unknown-linux-musleabi</li>
8686
<li>armv7-linux-androideabi</li>
8787
<li>i686-linux-android</li>
88+
<li>loongarch64-unknown-linux-gnu</li>
8889
<li>s390x-unknown-linux-gnu</li>
8990
<li>x86_64-linux-android</li>
9091
<li>x86_64-unknown-illumos</li>

test/sys/test_prctl.rs

+8
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ mod test_prctl {
9999
prctl::set_timerslack(original).unwrap();
100100
}
101101

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

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

0 commit comments

Comments
 (0)