Skip to content

Commit 44c8576

Browse files
committed
Remove more skipped tests on Android
1 parent 7d5be31 commit 44c8576

File tree

1 file changed

+34
-108
lines changed

1 file changed

+34
-108
lines changed

libc-test/build.rs

Lines changed: 34 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,18 +1323,15 @@ fn test_android(target: &str) {
13231323
// generate the error 'Your time_t is already 64-bit'
13241324
cfg.header("time64.h");
13251325
}
1326+
13261327
if x86 {
13271328
cfg.header("sys/reg.h");
13281329
}
13291330

13301331
cfg.type_name(move |ty, is_struct, is_union| {
13311332
match ty {
13321333
// Just pass all these through, no need for a "struct" prefix
1333-
// FIXME: still required ?
1334-
"FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
1335-
| "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym"
1336-
| "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr"
1337-
| "Elf64_Chdr" => ty.to_string(),
1334+
"FILE" | "fd_set" | "Dl_info" => ty.to_string(),
13381335

13391336
t if is_union => format!("union {}", t),
13401337

@@ -1382,7 +1379,6 @@ fn test_android(target: &str) {
13821379

13831380
// These are tested as part of the linux_fcntl tests since there are
13841381
// header conflicts when including them with all the other structs.
1385-
// FIXME: still necessary
13861382
"termios2" => true,
13871383

13881384
_ => false,
@@ -1406,37 +1402,6 @@ fn test_android(target: &str) {
14061402
// FIXME: still necessary?
14071403
"SIGUNUSED" => true, // removed in glibc 2.26
14081404

1409-
// weird signed extension or something like that?
1410-
// FIXME: still necessary?
1411-
"MS_NOUSER" => true,
1412-
// FIXME: still necessary?
1413-
"MS_RMT_MASK" => true, // updated in glibc 2.22 and musl 1.1.13
1414-
1415-
// Android uses old kernel headers
1416-
// These are constants used in getrandom syscall
1417-
// FIXME: still necessary?
1418-
"GRND_NONBLOCK" | "GRND_RANDOM" => true,
1419-
1420-
// Defined by libattr not libc on linux (hard to test).
1421-
// See constant definition for more details.
1422-
// FIXME: still necessary?
1423-
"ENOATTR" => true,
1424-
1425-
// FIXME: still necessary?
1426-
"BOTHER" => true,
1427-
1428-
// MFD_HUGETLB is not available in some older libc versions on the CI builders. On the
1429-
// x86_64 and i686 builders it seems to be available for all targets, so at least test
1430-
// it there.
1431-
// FIXME: still necessary?
1432-
"MFD_HUGETLB" => true,
1433-
1434-
// These change all the time from release to release of linux
1435-
// distros, let's just not bother trying to verify them. They
1436-
// shouldn't be used in code anyway...
1437-
// FIXME: still necessary?
1438-
"AF_MAX" | "PF_MAX" => true,
1439-
14401405
_ => false,
14411406
}
14421407
});
@@ -1459,9 +1424,6 @@ fn test_android(target: &str) {
14591424
// FIXME: still necessary?
14601425
"getdtablesize" => true,
14611426

1462-
// FIXME: still necessary?
1463-
"dlerror" => true, // const-ness is added
1464-
14651427
// Apparently the NDK doesn't have this defined on android, but
14661428
// it's in a header file?
14671429
// FIXME: still necessary?
@@ -1523,40 +1485,12 @@ fn test_android(target: &str) {
15231485
field == "ssi_arch"))
15241486
});
15251487

1526-
// FIXME: remove
1527-
cfg.fn_cname(move |name, _cname| name.to_string());
1528-
15291488
cfg.generate("../src/lib.rs", "main.rs");
15301489

15311490
// On Android also generate another script for testing linux/fcntl
15321491
// declarations. These cannot be tested normally because including both
15331492
// `linux/fcntl.h` and `fcntl.h` fails.
1534-
//
1535-
// FIXME: is still necessary?
1536-
let mut cfg = ctest::TestGenerator::new();
1537-
cfg.skip_type(|_| true)
1538-
.skip_fn(|_| true)
1539-
.skip_static(|_| true);
1540-
cfg.header("linux/fcntl.h");
1541-
cfg.header("net/if.h");
1542-
cfg.header("linux/if.h");
1543-
cfg.header("linux/quota.h");
1544-
cfg.header("asm/termbits.h");
1545-
cfg.skip_const(move |name| match name {
1546-
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
1547-
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => {
1548-
false
1549-
}
1550-
"BOTHER" => false,
1551-
_ => true,
1552-
});
1553-
cfg.skip_struct(|s| s != "termios2");
1554-
cfg.type_name(move |ty, is_struct, is_union| match ty {
1555-
t if is_struct => format!("struct {}", t),
1556-
t if is_union => format!("union {}", t),
1557-
t => t.to_string(),
1558-
});
1559-
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
1493+
test_linux_termios2();
15601494
}
15611495

15621496
fn test_freebsd(target: &str) {
@@ -2778,29 +2712,47 @@ fn test_linux(target: &str) {
27782712
// On Linux also generate another script for testing linux/fcntl declarations.
27792713
// These cannot be tested normally because including both `linux/fcntl.h` and `fcntl.h`
27802714
// fails on a lot of platforms.
2715+
test_linux_termios2();
2716+
2717+
// Test Elf64_Phdr and Elf32_Phdr
2718+
// These types have a field called `p_type`, but including
2719+
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
2720+
// making the tests for these fails when both are included.
2721+
let mut cfg = ctest::TestGenerator::new();
2722+
cfg.skip_fn(|_| true)
2723+
.skip_const(|_| true)
2724+
.skip_static(|_| true)
2725+
.type_name(move |ty, _is_struct, _is_union| ty.to_string());
2726+
cfg.skip_struct(move |ty| match ty {
2727+
"Elf64_Phdr" | "Elf32_Phdr" => false,
2728+
_ => true,
2729+
});
2730+
cfg.skip_type(move |ty| match ty {
2731+
"Elf64_Phdr" | "Elf32_Phdr" => false,
2732+
_ => true,
2733+
});
2734+
cfg.header("elf.h");
2735+
cfg.generate("../src/lib.rs", "linux_elf.rs");
2736+
}
2737+
2738+
fn test_linux_termios2() {
27812739
let mut cfg = ctest::TestGenerator::new();
27822740
cfg.skip_type(|_| true)
27832741
.skip_fn(|_| true)
27842742
.skip_static(|_| true);
2785-
// musl defines these directly in `fcntl.h`
2786-
if musl {
2787-
cfg.header("fcntl.h");
2788-
} else {
2789-
cfg.header("linux/fcntl.h");
2790-
}
2791-
if !musl {
2792-
cfg.header("net/if.h");
2793-
cfg.header("linux/if.h");
2743+
headers! {
2744+
cfg:
2745+
"linux/fcntl.h",
2746+
"net/if.h",
2747+
"linux/if.h",
2748+
"linux/quota.h",
2749+
"asm/termbits.h"
27942750
}
2795-
cfg.header("linux/quota.h");
2796-
cfg.header("asm/termbits.h");
27972751
cfg.skip_const(move |name| match name {
27982752
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
27992753
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => {
28002754
false
28012755
}
2802-
"QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips => false,
2803-
"BOTHER" => false,
28042756
_ => true,
28052757
});
28062758
cfg.skip_struct(|s| s != "termios2");
@@ -2810,30 +2762,4 @@ fn test_linux(target: &str) {
28102762
t => t.to_string(),
28112763
});
28122764
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
2813-
2814-
// Test Elf64_Phdr and Elf32_Phdr
2815-
// These types have a field called `p_type`, but including
2816-
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
2817-
// making the tests for these fails when both are included.
2818-
let mut cfg = ctest::TestGenerator::new();
2819-
cfg.skip_fn(|_| true)
2820-
.skip_const(|_| true)
2821-
.skip_static(|_| true)
2822-
.type_name(move |ty, _is_struct, _is_union| {
2823-
ty.to_string()
2824-
});
2825-
cfg.skip_struct(move |ty| {
2826-
match ty {
2827-
"Elf64_Phdr" | "Elf32_Phdr" => false,
2828-
_ => true,
2829-
}
2830-
});
2831-
cfg.skip_type(move |ty| {
2832-
match ty {
2833-
"Elf64_Phdr" | "Elf32_Phdr" => false,
2834-
_ => true,
2835-
}
2836-
});
2837-
cfg.header("elf.h");
2838-
cfg.generate("../src/lib.rs", "linux_elf.rs");
28392765
}

0 commit comments

Comments
 (0)