Skip to content

Commit 917fe54

Browse files
committed
add supporting for vxWorks
1 parent 36a92d5 commit 917fe54

File tree

2 files changed

+152
-193
lines changed

2 files changed

+152
-193
lines changed

libc-test/build.rs

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ fn do_ctest() {
2727
t if t.contains("solaris") => return test_solaris(t),
2828
t if t.contains("wasi") => return test_wasi(t),
2929
t if t.contains("windows") => return test_windows(t),
30+
t if t.contains("vxworks") => return test_vxworks(t),
3031
t => panic!("unknown target {}", t),
3132
}
3233
}
@@ -1927,6 +1928,111 @@ fn test_emscripten(target: &str) {
19271928
cfg.generate("../src/lib.rs", "main.rs");
19281929
}
19291930

1931+
fn test_vxworks(target: &str) {
1932+
assert!(target.contains("vxworks"));
1933+
1934+
let mut cfg = ctest::TestGenerator::new();
1935+
headers! { cfg:
1936+
"vxWorks.h",
1937+
"yvals.h",
1938+
"nfs/nfsCommon.h",
1939+
"rtpLibCommon.h",
1940+
"randomNumGen.h",
1941+
"taskLib.h",
1942+
"sysLib.h",
1943+
"ioLib.h",
1944+
"inetLib.h",
1945+
"socket.h",
1946+
"errnoLib.h",
1947+
"ctype.h",
1948+
"dirent.h",
1949+
"dlfcn.h",
1950+
"elf.h",
1951+
"fcntl.h",
1952+
"grp.h",
1953+
"sys/poll.h",
1954+
"ifaddrs.h",
1955+
"langinfo.h",
1956+
"limits.h",
1957+
"link.h",
1958+
"locale.h",
1959+
"sys/stat.h",
1960+
"netdb.h",
1961+
"pthread.h",
1962+
"pwd.h",
1963+
"sched.h",
1964+
"semaphore.h",
1965+
"signal.h",
1966+
"stddef.h",
1967+
"stdint.h",
1968+
"stdio.h",
1969+
"stdlib.h",
1970+
"string.h",
1971+
"sys/file.h",
1972+
"sys/ioctl.h",
1973+
"sys/socket.h",
1974+
"sys/time.h",
1975+
"sys/times.h",
1976+
"sys/types.h",
1977+
"sys/uio.h",
1978+
"sys/un.h",
1979+
"sys/utsname.h",
1980+
"sys/wait.h",
1981+
"netinet/tcp.h",
1982+
"syslog.h",
1983+
"termios.h",
1984+
"time.h",
1985+
"ucontext.h",
1986+
"unistd.h",
1987+
"utime.h",
1988+
"wchar.h",
1989+
"errno.h",
1990+
"sys/mman.h",
1991+
"pathLib.h",
1992+
}
1993+
cfg.skip_const(move |name| match name {
1994+
"SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness
1995+
_ => false,
1996+
});
1997+
/* Fix me */
1998+
cfg.skip_type(move |ty| match ty {
1999+
"stat64" | "sighandler_t" | "off64_t" => true,
2000+
_ => false,
2001+
});
2002+
2003+
cfg.skip_field_type(move |struct_, field| match (struct_, field) {
2004+
("siginfo_t", "si_value")
2005+
| ("stat", "st_size")
2006+
| ("sigaction", "sa_u") => true,
2007+
_ => false,
2008+
});
2009+
2010+
cfg.skip_roundtrip(move |s| match s {
2011+
_ => false,
2012+
});
2013+
2014+
cfg.type_name(move |ty, is_struct, is_union| match ty {
2015+
"DIR" | "FILE" | "Dl_info" | "RTP_DESC" => ty.to_string(),
2016+
t if is_union => format!("union {}", t),
2017+
t if t.ends_with("_t") => t.to_string(),
2018+
t if is_struct => format!("struct {}", t),
2019+
t => t.to_string(),
2020+
});
2021+
2022+
/* Fix me */
2023+
cfg.skip_fn(move |name| match name {
2024+
/* sigval */
2025+
"sigqueue" | "_sigqueue"
2026+
/* sighandler_t*/
2027+
| "signal"
2028+
/* not used in static linking by default */
2029+
| "dlerror" => true,
2030+
_ => false,
2031+
});
2032+
2033+
cfg.generate("../src/lib.rs", "main.rs");
2034+
}
2035+
19302036
fn test_linux(target: &str) {
19312037
assert!(target.contains("linux"));
19322038

0 commit comments

Comments
 (0)