Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fn do_ctest() {
t if t.contains("solaris") => return test_solaris(t),
t if t.contains("wasi") => return test_wasi(t),
t if t.contains("windows") => return test_windows(t),
t if t.contains("vxworks") => return test_vxworks(t),
t => panic!("unknown target {}", t),
}
}
Expand Down Expand Up @@ -1927,6 +1928,115 @@ fn test_emscripten(target: &str) {
cfg.generate("../src/lib.rs", "main.rs");
}

fn test_vxworks(target: &str) {
assert!(target.contains("vxworks"));

let mut cfg = ctest::TestGenerator::new();
headers! { cfg:
"vxWorks.h",
"yvals.h",
"nfs/nfsCommon.h",
"rtpLibCommon.h",
"randomNumGen.h",
"taskLib.h",
"sysLib.h",
"ioLib.h",
"inetLib.h",
"socket.h",
"errnoLib.h",
"ctype.h",
"dirent.h",
"dlfcn.h",
"elf.h",
"fcntl.h",
"grp.h",
"sys/poll.h",
"ifaddrs.h",
"langinfo.h",
"limits.h",
"link.h",
"locale.h",
"sys/stat.h",
"netdb.h",
"pthread.h",
"pwd.h",
"sched.h",
"semaphore.h",
"signal.h",
"stddef.h",
"stdint.h",
"stdio.h",
"stdlib.h",
"string.h",
"sys/file.h",
"sys/ioctl.h",
"sys/socket.h",
"sys/time.h",
"sys/times.h",
"sys/types.h",
"sys/uio.h",
"sys/un.h",
"sys/utsname.h",
"sys/wait.h",
"netinet/tcp.h",
"syslog.h",
"termios.h",
"time.h",
"ucontext.h",
"unistd.h",
"utime.h",
"wchar.h",
"errno.h",
"sys/mman.h",
"pathLib.h",
}
/* Fix me */
cfg.skip_const(move |name| match name {
// sighandler_t weirdness
"SIG_DFL" | "SIG_ERR" | "SIG_IGN"
// This is not defined in vxWorks
| "RTLD_DEFAULT" => true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a FIXME here as well for now.

_ => false,
});
/* Fix me */
cfg.skip_type(move |ty| match ty {
"stat64" | "sighandler_t" | "off64_t" => true,
_ => false,
});

cfg.skip_field_type(move |struct_, field| match (struct_, field) {
("siginfo_t", "si_value")
| ("stat", "st_size")
| ("sigaction", "sa_u") => true,
_ => false,
});

cfg.skip_roundtrip(move |s| match s {
_ => false,
});

cfg.type_name(move |ty, is_struct, is_union| match ty {
"DIR" | "FILE" | "Dl_info" | "RTP_DESC" => ty.to_string(),
t if is_union => format!("union {}", t),
t if t.ends_with("_t") => t.to_string(),
t if is_struct => format!("struct {}", t),
t => t.to_string(),
});

/* Fix me */
cfg.skip_fn(move |name| match name {
/* sigval */
"sigqueue" | "_sigqueue"
/* sighandler_t*/
| "signal"
/* not used in static linking by default */
| "dlerror" => true,
_ => false,
});

cfg.generate("../src/lib.rs", "main.rs");
}

fn test_linux(target: &str) {
assert!(target.contains("linux"));

Expand Down
Loading