@@ -718,6 +718,31 @@ fn threads_support() {
718718 }
719719}
720720
721+ #[ test]
722+ fn target_has_atomic_support ( ) {
723+ let atomics = [
724+ ( "aarch64-unknown-linux-gnu" , & [ "8" , "16" , "32" , "64" , "128" , "ptr" ] [ ..] , & [ ] [ ..] ) ,
725+ ( "aarch64-apple-darwin" , & [ "8" , "16" , "32" , "64" , "128" , "ptr" ] , & [ ] ) ,
726+ ( "i686-pc-windows-gnu" , & [ "8" , "16" , "32" , "64" , "ptr" ] , & [ "128" ] ) ,
727+ ( "i686-pc-windows-msvc" , & [ "8" , "16" , "32" , "64" , "ptr" ] , & [ "128" ] ) ,
728+ ( "i686-unknown-linux-gnu" , & [ "8" , "16" , "32" , "64" , "ptr" ] , & [ "128" ] ) ,
729+ ( "x86_64-apple-darwin" , & [ "8" , "16" , "32" , "64" , "128" , "ptr" ] , & [ ] ) ,
730+ ( "x86_64-pc-windows-gnu" , & [ "8" , "16" , "32" , "64" , "128" , "ptr" ] , & [ ] ) ,
731+ ( "x86_64-pc-windows-msvc" , & [ "8" , "16" , "32" , "64" , "128" , "ptr" ] , & [ ] ) ,
732+ ( "x86_64-unknown-linux-gnu" , & [ "8" , "16" , "32" , "64" , "ptr" ] , & [ "128" ] ) ,
733+ ] ;
734+
735+ for ( target, supported, not_supported) in atomics {
736+ let config = cfg ( ) . target ( target) . build ( ) ;
737+ for size in supported {
738+ assert ! ( config. has_atomic( size) ) ;
739+ }
740+ for size in not_supported {
741+ assert ! ( !config. has_atomic( size) ) ;
742+ }
743+ }
744+ }
745+
721746fn run_path ( poisoned : & mut bool , path : & Path , buf : & [ u8 ] ) {
722747 let rdr = std:: io:: Cursor :: new ( & buf) ;
723748 iter_header ( Mode :: Ui , "ui" , poisoned, path, rdr, & mut |_| { } ) ;
0 commit comments