Minor nitpicks

This commit is contained in:
gnzlbg 2019-05-28 16:07:46 +02:00
parent cf0bd36e78
commit 8e26ab4964
6 changed files with 29 additions and 19 deletions

View File

@ -1428,7 +1428,7 @@ fn test_android(target: &str) {
cfg.generate("../src/lib.rs", "main.rs");
test_linux_incompatible_apis(target);
test_linux_like_apis(target);
}
fn test_freebsd(target: &str) {
@ -2241,17 +2241,19 @@ fn test_linux(target: &str) {
cfg.generate("../src/lib.rs", "main.rs");
test_linux_incompatible_apis(target);
test_linux_like_apis(target);
}
// This function tests APIs that are incompatible to test when other APIs
// are included (e.g. because including both sets of headers clashes)
fn test_linux_incompatible_apis(target: &str) {
assert!(target.contains("linux") || target.contains("android"));
fn test_linux_like_apis(target: &str) {
let musl = target.contains("musl");
let linux = target.contains("linux");
let emscripten = target.contains("emscripten");
let android = target.contains("android");
assert!(linux || android || emscripten);
{
if linux || android || emscripten {
// test strerror_r from the `string.h` header
let mut cfg = ctest::TestGenerator::new();
cfg.skip_type(|_| true).skip_static(|_| true);
@ -2265,7 +2267,8 @@ fn test_linux_incompatible_apis(target: &str) {
.skip_struct(|_| true);
cfg.generate("../src/lib.rs", "linux_strerror_r.rs");
}
{
if linux || android || emscripten {
// test fcntl - see:
// http://man7.org/linux/man-pages/man2/fcntl.2.html
let mut cfg = ctest::TestGenerator::new();
@ -2295,7 +2298,8 @@ fn test_linux_incompatible_apis(target: &str) {
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
}
{
if linux || android {
// test termios
let mut cfg = ctest::TestGenerator::new();
cfg.header("asm/termbits.h");
@ -2312,12 +2316,7 @@ fn test_linux_incompatible_apis(target: &str) {
cfg.generate("../src/lib.rs", "linux_termios.rs");
}
if !linux {
return;
}
// linux-only tests (no android):
{
if linux || android {
// test IPV6_ constants:
let mut cfg = ctest::TestGenerator::new();
headers! {
@ -2344,7 +2343,8 @@ fn test_linux_incompatible_apis(target: &str) {
});
cfg.generate("../src/lib.rs", "linux_ipv6.rs");
}
{
if linux || android {
// Test Elf64_Phdr and Elf32_Phdr
// These types have a field called `p_type`, but including
// "resolve.h" defines a `p_type` macro that expands to `__p_type`

View File

@ -7,4 +7,6 @@ use libc::*;
include!(concat!(env!("OUT_DIR"), "/linux_elf.rs"));
#[cfg(not(target_os = "linux"))]
fn main() { println!("PASSED 0 tests"); }
fn main() {
println!("PASSED 0 tests");
}

View File

@ -7,4 +7,6 @@ use libc::*;
include!(concat!(env!("OUT_DIR"), "/linux_fcntl.rs"));
#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() { println!("PASSED 0 tests"); }
fn main() {
println!("PASSED 0 tests");
}

View File

@ -7,4 +7,6 @@ use libc::*;
include!(concat!(env!("OUT_DIR"), "/linux_ipv6.rs"));
#[cfg(not(target_os = "linux"))]
fn main() { println!("PASSED 0 tests"); }
fn main() {
println!("PASSED 0 tests");
}

View File

@ -7,4 +7,6 @@ use libc::*;
include!(concat!(env!("OUT_DIR"), "/linux_strerror_r.rs"));
#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() { println!("PASSED 0 tests"); }
fn main() {
println!("PASSED 0 tests");
}

View File

@ -7,4 +7,6 @@ use libc::*;
include!(concat!(env!("OUT_DIR"), "/linux_termios.rs"));
#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() { println!("PASSED 0 tests"); }
fn main() {
println!("PASSED 0 tests");
}