summaryrefslogtreecommitdiff
path: root/libc-test/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc-test/build.rs')
-rw-r--r--libc-test/build.rs110
1 files changed, 110 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index d6982fc952..b2512b85d6 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -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),
}
}
@@ -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,
+ _ => 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"));