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