@@ -77,7 +77,6 @@ fn ctest_cfg() -> ctest::TestGenerator {
7777 ctest:: TestGenerator :: new ( )
7878}
7979
80- #[ expect( unused) ]
8180fn ctest_next_cfg ( ) -> ctest_next:: TestGenerator {
8281 ctest_next:: TestGenerator :: new ( )
8382}
@@ -169,14 +168,6 @@ fn main() {
169168 let re = regex:: bytes:: Regex :: new ( r"(?-u:\b)crate::" ) . unwrap ( ) ;
170169 copy_dir_hotfix ( Path :: new ( "../src" ) , & hotfix_dir, & re, b"::" ) ;
171170
172- // FIXME(ctest): Only needed until ctest-next supports all tests.
173- // Provide a default for targets that don't yet use `ctest-next`.
174- std:: fs:: write (
175- format ! ( "{}/main_next.rs" , std:: env:: var( "OUT_DIR" ) . unwrap( ) ) ,
176- "\n fn main() { println!(\" test result: ok\" ); }\n " ,
177- )
178- . unwrap ( ) ;
179-
180171 do_cc ( ) ;
181172 do_ctest ( ) ;
182173 do_semver ( ) ;
@@ -812,7 +803,8 @@ fn test_windows(target: &str) {
812803 let gnu = target. contains ( "gnu" ) ;
813804 let i686 = target. contains ( "i686" ) ;
814805
815- let mut cfg = ctest_cfg ( ) ;
806+ let mut cfg = ctest_next_cfg ( ) ;
807+ cfg. skip_private ( true ) ;
816808 if target. contains ( "msvc" ) {
817809 cfg. flag ( "/wd4324" ) ;
818810 }
@@ -840,49 +832,46 @@ fn test_windows(target: &str) {
840832 [ !gnu] : "Winsock2.h" ,
841833 }
842834
843- cfg. type_name ( move |ty, is_struct , is_union | {
835+ cfg. rename_struct_ty ( |ty| {
844836 match ty {
845837 // Just pass all these through, no need for a "struct" prefix
846- "FILE" | "DIR" | "Dl_info" => ty. to_string ( ) ,
847-
838+ "FILE" | "DIR" | "Dl_info" => ty. to_string ( ) . into ( ) ,
839+ t if t. ends_with ( "_t" ) => t. to_string ( ) . into ( ) ,
840+ // Windows uppercase structs don't have `struct` in fr.into()ont:
841+ t if ty. chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( ) => t. to_string ( ) . into ( ) ,
842+ "stat" => "struct __stat64" . to_string ( ) . into ( ) ,
843+ "utimbuf" => "struct __utimbuf64" . to_string ( ) . into ( ) ,
844+ _ => None ,
845+ }
846+ } ) ;
847+ cfg. rename_type ( move |ty| {
848+ match ty {
848849 // FIXME(windows): these don't exist:
849- "time64_t" => "__time64_t" . to_string ( ) ,
850- "ssize_t" => "SSIZE_T" . to_string ( ) ,
851-
852- "sighandler_t" if !gnu => "_crt_signal_t" . to_string ( ) ,
853- "sighandler_t" if gnu => "__p_sig_fn_t" . to_string ( ) ,
854-
855- t if is_union => format ! ( "union {t}" ) ,
856- t if t. ends_with ( "_t" ) => t. to_string ( ) ,
850+ "time64_t" => "__time64_t" . to_string ( ) . into ( ) ,
851+ "ssize_t" => "SSIZE_T" . to_string ( ) . into ( ) ,
857852
858- // Windows uppercase structs don't have `struct` in front:
859- t if is_struct => {
860- if ty. chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( ) {
861- t. to_string ( )
862- } else if t == "stat" {
863- "struct __stat64" . to_string ( )
864- } else if t == "utimbuf" {
865- "struct __utimbuf64" . to_string ( )
866- } else {
867- // put `struct` in front of all structs:
868- format ! ( "struct {t}" )
869- }
870- }
871- t => t. to_string ( ) ,
853+ "sighandler_t" if !gnu => "_crt_signal_t" . to_string ( ) . into ( ) ,
854+ "sighandler_t" if gnu => "__p_sig_fn_t" . to_string ( ) . into ( ) ,
855+ _ => None ,
872856 }
873857 } ) ;
874858
875- cfg. fn_cname ( move |name, cname| cname. unwrap_or ( name) . to_string ( ) ) ;
859+ cfg. rename_fn ( move |func| {
860+ func. link_name ( )
861+ . map ( |l| l. to_string ( ) )
862+ . or ( func. ident ( ) . to_string ( ) . into ( ) )
863+ } ) ;
876864
877- cfg. skip_type ( move |name | match name {
865+ cfg. skip_alias ( move |alias | match alias . ident ( ) {
878866 "SSIZE_T" if !gnu => true ,
879867 "ssize_t" if !gnu => true ,
880868 // FIXME(windows): The size and alignment of this type are incorrect
881869 "time_t" if gnu && i686 => true ,
882870 _ => false ,
883871 } ) ;
884872
885- cfg. skip_struct ( move |ty| {
873+ cfg. skip_struct ( move |struct_| {
874+ let ty = struct_. ident ( ) ;
886875 if ty. starts_with ( "__c_anonymous_" ) {
887876 return true ;
888877 }
@@ -892,9 +881,10 @@ fn test_windows(target: &str) {
892881 _ => false ,
893882 }
894883 } ) ;
884+ cfg. skip_union ( move |union_| union_. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
895885
896- cfg. skip_const ( move |name | {
897- match name {
886+ cfg. skip_const ( move |constant | {
887+ match constant . ident ( ) {
898888 // FIXME(windows): API error:
899889 // SIG_ERR type is "void (*)(int)", not "int"
900890 "SIG_ERR" |
@@ -906,10 +896,7 @@ fn test_windows(target: &str) {
906896 }
907897 } ) ;
908898
909- cfg. skip_field ( move |s, field| match s {
910- "CONTEXT" if field == "Fp" => true ,
911- _ => false ,
912- } ) ;
899+ cfg. skip_struct_field ( move |s, field| s. ident ( ) == "CONTEXT" && field. ident ( ) == "Fp" ) ;
913900 // FIXME(windows): All functions point to the wrong addresses?
914901 cfg. skip_fn_ptrcheck ( |_| true ) ;
915902
@@ -926,7 +913,7 @@ fn test_windows(target: &str) {
926913
927914 cfg. skip_fn ( |_| false ) ;
928915
929- cfg. generate ( src_hotfix_dir ( ) . join ( " lib.rs") , "ctest_output.rs" ) ;
916+ ctest_next :: generate_test ( & mut cfg, "../src/ lib.rs", "ctest_output.rs" ) . unwrap ( ) ;
930917}
931918
932919fn test_redox ( target : & str ) {
0 commit comments