Skip to content

Commit 0d0f93f

Browse files
committed
libc: Switch tier 2 targets to the new ctest
1 parent ca402b7 commit 0d0f93f

File tree

2 files changed

+78
-81
lines changed

2 files changed

+78
-81
lines changed

.github/workflows/ci.yaml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -101,33 +101,33 @@ jobs:
101101
strategy:
102102
matrix:
103103
include:
104-
- target: i686-unknown-linux-gnu
105-
docker: true
106-
os: ubuntu-24.04
107-
- target: i686-unknown-linux-gnu
108-
docker: true
109-
os: ubuntu-24.04
110-
artifact-tag: offset-bits64
111-
env:
112-
RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS: 64
113-
- target: i686-unknown-linux-gnu
114-
docker: true
115-
os: ubuntu-24.04
116-
artifact-tag: time-bits64
117-
env:
118-
RUST_LIBC_UNSTABLE_GNU_TIME_BITS: 64
119-
- target: x86_64-unknown-linux-gnu
120-
docker: true
121-
os: ubuntu-24.04
122-
- target: aarch64-apple-darwin
123-
os: macos-15
124-
- target: x86_64-pc-windows-gnu
125-
os: windows-2022
126-
env:
127-
ARCH_BITS: 64
128-
ARCH: x86_64
129-
- target: x86_64-pc-windows-msvc
130-
os: windows-2022
104+
# - target: i686-unknown-linux-gnu
105+
# docker: true
106+
# os: ubuntu-24.04
107+
# - target: i686-unknown-linux-gnu
108+
# docker: true
109+
# os: ubuntu-24.04
110+
# artifact-tag: offset-bits64
111+
# env:
112+
# RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS: 64
113+
# - target: i686-unknown-linux-gnu
114+
# docker: true
115+
# os: ubuntu-24.04
116+
# artifact-tag: time-bits64
117+
# env:
118+
# RUST_LIBC_UNSTABLE_GNU_TIME_BITS: 64
119+
# - target: x86_64-unknown-linux-gnu
120+
# docker: true
121+
# os: ubuntu-24.04
122+
# - target: aarch64-apple-darwin
123+
# os: macos-15
124+
# - target: x86_64-pc-windows-gnu
125+
# os: windows-2022
126+
# env:
127+
# ARCH_BITS: 64
128+
# ARCH: x86_64
129+
# - target: x86_64-pc-windows-msvc
130+
# os: windows-2022
131131
# FIXME: It currently causes segfaults.
132132
#- target: i686-pc-windows-gnu
133133
# env:
@@ -183,29 +183,29 @@ jobs:
183183
target:
184184
# FIXME(sparc): this takes much longer to run than any other job, put
185185
# it first to make sure it gets a head start.
186-
- sparc64-unknown-linux-gnu
186+
# - sparc64-unknown-linux-gnu
187187
- aarch64-linux-android
188-
- aarch64-unknown-linux-gnu
189-
- aarch64-unknown-linux-musl
188+
# - aarch64-unknown-linux-gnu
189+
# - aarch64-unknown-linux-musl
190190
- arm-linux-androideabi
191-
- arm-unknown-linux-musleabihf
191+
# - arm-unknown-linux-musleabihf
192192
# FIXME(#4297): Disabled due to spurious failueSome android jobs are disabled because of high rates of
193193
# - i686-linux-android
194-
- i686-unknown-linux-musl
195-
- loongarch64-unknown-linux-gnu
196-
- loongarch64-unknown-linux-musl
197-
- powerpc64-unknown-linux-gnu
198-
- powerpc64le-unknown-linux-gnu
199-
- powerpc64le-unknown-linux-musl
200-
- riscv64gc-unknown-linux-gnu
201-
- s390x-unknown-linux-gnu
202-
- wasm32-unknown-emscripten
203-
- wasm32-wasip1
204-
- wasm32-wasip2
194+
# - i686-unknown-linux-musl
195+
# - loongarch64-unknown-linux-gnu
196+
# - loongarch64-unknown-linux-musl
197+
# - powerpc64-unknown-linux-gnu
198+
# - powerpc64le-unknown-linux-gnu
199+
# - powerpc64le-unknown-linux-musl
200+
# - riscv64gc-unknown-linux-gnu
201+
# - s390x-unknown-linux-gnu
202+
# - wasm32-unknown-emscripten
203+
# - wasm32-wasip1
204+
# - wasm32-wasip2
205205
- x86_64-linux-android
206206
# FIXME: Exec format error (os error 8)
207207
# - x86_64-unknown-linux-gnux32
208-
- x86_64-unknown-linux-musl
208+
# - x86_64-unknown-linux-musl
209209
# FIXME: It seems some items in `src/unix/mod.rs`
210210
# aren't defined on redox actually.
211211
# - x86_64-unknown-redox

libc-test/build.rs

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ fn test_android(target: &str) {
17901790
let x86 = target.contains("i686") || target.contains("x86_64");
17911791
let aarch64 = target.contains("aarch64");
17921792

1793-
let mut cfg = ctest_old_cfg();
1793+
let mut cfg = ctest_cfg();
17941794
cfg.define("_GNU_SOURCE", None);
17951795

17961796
headers! { cfg:
@@ -1939,46 +1939,39 @@ fn test_android(target: &str) {
19391939
"android/set_abort_message.h"
19401940
}
19411941

1942-
cfg.type_name(move |ty, is_struct, is_union| {
1943-
match ty {
1944-
// Just pass all these through, no need for a "struct" prefix
1945-
"FILE" | "fd_set" | "Dl_info" | "Elf32_Phdr" | "Elf64_Phdr" => ty.to_string(),
1946-
1947-
t if is_union => format!("union {t}"),
1948-
1949-
t if t.ends_with("_t") => t.to_string(),
1950-
1951-
"Ioctl" => "int".to_string(),
1952-
1953-
// put `struct` in front of all structs:.
1954-
t if is_struct => format!("struct {t}"),
1942+
cfg.rename_type(move |ty| match ty {
1943+
"Ioctl" => Some("int".to_string()),
1944+
_ => None,
1945+
});
19551946

1956-
t => t.to_string(),
1957-
}
1947+
cfg.rename_struct_ty(|ty| match ty {
1948+
// Just pass all these through, no need for a "struct" prefix
1949+
"FILE" | "fd_set" | "Dl_info" | "Elf32_Phdr" | "Elf64_Phdr" => Some(ty.to_string()),
1950+
t if t.ends_with("_t") => Some(t.to_string()),
1951+
_ => None,
19581952
});
19591953

1960-
cfg.field_name(move |struct_, field| {
1961-
match field {
1954+
cfg.rename_struct_field(move |struct_, field| {
1955+
match field.ident() {
19621956
// Our stat *_nsec fields normally don't actually exist but are part
19631957
// of a timeval struct
1964-
s if s.ends_with("_nsec") && struct_.starts_with("stat") => s.to_string(),
1958+
s if s.ends_with("_nsec") && struct_.ident().starts_with("stat") => Some(s.to_string()),
19651959
// The following structs have a field called `type` in C,
19661960
// but `type` is a Rust keyword, so these fields are translated
19671961
// to `type_` in Rust.
19681962
"type_"
1969-
if struct_ == "input_event"
1970-
|| struct_ == "input_mask"
1971-
|| struct_ == "ff_effect" =>
1963+
if struct_.ident() == "input_event"
1964+
|| struct_.ident() == "input_mask"
1965+
|| struct_.ident() == "ff_effect" =>
19721966
{
1973-
"type".to_string()
1967+
Some("type".to_string())
19741968
}
1975-
1976-
s => s.to_string(),
1969+
_ => None,
19771970
}
19781971
});
19791972

1980-
cfg.skip_type(move |ty| {
1981-
match ty {
1973+
cfg.skip_alias(move |ty| {
1974+
match ty.ident() {
19821975
// FIXME(android): `sighandler_t` type is incorrect, see:
19831976
// https://github.com/rust-lang/libc/issues/1359
19841977
"sighandler_t" => true,
@@ -1999,11 +1992,11 @@ fn test_android(target: &str) {
19991992
}
20001993
});
20011994

2002-
cfg.skip_struct(move |ty| {
2003-
if ty.starts_with("__c_anonymous_") {
1995+
cfg.skip_struct(move |struct_| {
1996+
if struct_.ident().starts_with("__c_anonymous_") {
20041997
return true;
20051998
}
2006-
match ty {
1999+
match struct_.ident() {
20072000
// These are tested as part of the linux_fcntl tests since there are
20082001
// header conflicts when including them with all the other structs.
20092002
"termios2" => true,
@@ -2027,8 +2020,8 @@ fn test_android(target: &str) {
20272020
}
20282021
});
20292022

2030-
cfg.skip_const(move |name| {
2031-
match name {
2023+
cfg.skip_const(move |constant| {
2024+
match constant.ident() {
20322025
// The IPV6 constants are tested in the `linux_ipv6.rs` tests:
20332026
| "IPV6_FLOWINFO"
20342027
| "IPV6_FLOWLABEL_MGR"
@@ -2178,9 +2171,9 @@ fn test_android(target: &str) {
21782171
}
21792172
});
21802173

2181-
cfg.skip_fn(move |name| {
2174+
cfg.skip_fn(move |func| {
21822175
// skip those that are manually verified
2183-
match name {
2176+
match func.ident() {
21842177
// FIXME(android): for unknown reasons linker unable to find "fexecve"
21852178
"fexecve" => true,
21862179

@@ -2247,7 +2240,9 @@ fn test_android(target: &str) {
22472240
}
22482241
});
22492242

2250-
cfg.skip_field_type(move |struct_, field| {
2243+
cfg.skip_struct_field_type(move |struct_, field| {
2244+
let struct_ = struct_.ident();
2245+
let field = field.ident();
22512246
// This is a weird union, don't check the type.
22522247
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
22532248
// this one is an anonymous union
@@ -2261,8 +2256,8 @@ fn test_android(target: &str) {
22612256
(struct_ == "flock64" && (field == "l_start" || field == "l_len"))
22622257
});
22632258

2264-
cfg.skip_field(|struct_, field| {
2265-
match (struct_, field) {
2259+
cfg.skip_struct_field(|struct_, field| {
2260+
match (struct_.ident(), field.ident()) {
22662261
// conflicting with `p_type` macro from <resolve.h>.
22672262
("Elf32_Phdr", "p_type") => true,
22682263
("Elf64_Phdr", "p_type") => true,
@@ -2280,7 +2275,7 @@ fn test_android(target: &str) {
22802275
}
22812276
});
22822277

2283-
cfg.generate(src_hotfix_dir().join("lib.rs"), "ctest_output.rs");
2278+
ctest::generate_test(&mut cfg, "../src/lib.rs", "ctest_output.rs").unwrap();
22842279

22852280
test_linux_like_apis(target);
22862281
}
@@ -3377,6 +3372,8 @@ fn test_neutrino(target: &str) {
33773372
}
33783373
});
33793374

3375+
cfg.skip_union(move |union_| union_.ident().starts_with("__c_anonymous_"));
3376+
33803377
cfg.skip_const(move |constant| {
33813378
match constant.ident() {
33823379
// These signal "functions" are actually integer values that are casted to a fn ptr

0 commit comments

Comments
 (0)