@@ -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,115 @@ 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+ /* Fix me */
1994+ cfg. skip_const ( move |name| match name {
1995+ // sighandler_t weirdness
1996+ "SIG_DFL" | "SIG_ERR" | "SIG_IGN"
1997+ // This is not defined in vxWorks
1998+ | "RTLD_DEFAULT" => true ,
1999+ _ => false ,
2000+ } ) ;
2001+ /* Fix me */
2002+ cfg. skip_type ( move |ty| match ty {
2003+ "stat64" | "sighandler_t" | "off64_t" => true ,
2004+ _ => false ,
2005+ } ) ;
2006+
2007+ cfg. skip_field_type ( move |struct_, field| match ( struct_, field) {
2008+ ( "siginfo_t" , "si_value" )
2009+ | ( "stat" , "st_size" )
2010+ | ( "sigaction" , "sa_u" ) => true ,
2011+ _ => false ,
2012+ } ) ;
2013+
2014+ cfg. skip_roundtrip ( move |s| match s {
2015+ _ => false ,
2016+ } ) ;
2017+
2018+ cfg. type_name ( move |ty, is_struct, is_union| match ty {
2019+ "DIR" | "FILE" | "Dl_info" | "RTP_DESC" => ty. to_string ( ) ,
2020+ t if is_union => format ! ( "union {}" , t) ,
2021+ t if t. ends_with ( "_t" ) => t. to_string ( ) ,
2022+ t if is_struct => format ! ( "struct {}" , t) ,
2023+ t => t. to_string ( ) ,
2024+ } ) ;
2025+
2026+ /* Fix me */
2027+ cfg. skip_fn ( move |name| match name {
2028+ /* sigval */
2029+ "sigqueue" | "_sigqueue"
2030+ /* sighandler_t*/
2031+ | "signal"
2032+ /* not used in static linking by default */
2033+ | "dlerror" => true ,
2034+ _ => false ,
2035+ } ) ;
2036+
2037+ cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
2038+ }
2039+
19302040fn test_linux ( target : & str ) {
19312041 assert ! ( target. contains( "linux" ) ) ;
19322042
0 commit comments