@@ -135,6 +135,7 @@ fn native_cache_observation(workspace: &Path) -> Result<serde_json::Value> {
135135 local_observation ( & cache, "wrapper_app" )
136136}
137137
138+ #[ cfg( target_os = "macos" ) ]
138139fn assert_native_miss ( workspace : & Path , output : & std:: process:: Output ) -> Result < serde_json:: Value > {
139140 assert_eq ! ( output. status. code( ) , Some ( 1 ) , "unexpected unify result: {output:?}" ) ;
140141 let observation = native_cache_observation ( workspace) ?;
@@ -227,6 +228,7 @@ fn cache_disabled_wrapper_preserves_clean_cargo_outputs() -> Result<()> {
227228 Ok ( ( ) )
228229}
229230
231+ #[ cfg( target_os = "macos" ) ]
230232#[ test]
231233fn compiler_observation_records_verified_native_cache_miss_and_hit ( ) -> Result < ( ) > {
232234 let workspace = wrapper_workspace ( "disabled-cache-wrapper-observation" ) ?;
@@ -324,6 +326,7 @@ fn compiler_observation_records_verified_native_cache_miss_and_hit() -> Result<(
324326 Ok ( ( ) )
325327}
326328
329+ #[ cfg( target_os = "macos" ) ]
327330#[ test]
328331fn native_cache_mutations_produce_no_false_hits ( ) -> Result < ( ) > {
329332 let workspace = wrapper_workspace ( "native-cache-mutation-matrix" ) ?;
@@ -382,6 +385,7 @@ fn native_cache_mutations_produce_no_false_hits() -> Result<()> {
382385 Ok ( ( ) )
383386}
384387
388+ #[ cfg( target_os = "macos" ) ]
385389#[ test]
386390fn corrupt_native_cache_object_falls_back_to_exact_cold_outputs ( ) -> Result < ( ) > {
387391 fn collect_blobs ( directory : & Path , blobs : & mut Vec < PathBuf > ) -> Result < ( ) > {
@@ -423,6 +427,7 @@ fn corrupt_native_cache_object_falls_back_to_exact_cold_outputs() -> Result<()>
423427 Ok ( ( ) )
424428}
425429
430+ #[ cfg( target_os = "macos" ) ]
426431#[ test]
427432fn filesystem_reading_macro_has_an_explicit_native_bypass ( ) -> Result < ( ) > {
428433 let workspace = wrapper_workspace ( "native-cache-filesystem-macro" ) ?;
@@ -444,6 +449,37 @@ fn filesystem_reading_macro_has_an_explicit_native_bypass() -> Result<()> {
444449 Ok ( ( ) )
445450}
446451
452+ #[ cfg( not( target_os = "macos" ) ) ]
453+ #[ test]
454+ fn unsupported_platform_bypasses_native_cache_and_preserves_cold_outputs ( ) -> Result < ( ) > {
455+ let workspace = wrapper_workspace ( "native-cache-unsupported-platform" ) ?;
456+ let local_cache = tempfile:: tempdir ( ) ?;
457+ let target = workspace. path . join ( "target" ) ;
458+
459+ let first = run_unify_without_ambient_wrappers ( & workspace. path , local_cache. path ( ) ) ?;
460+ assert_eq ! ( first. status. code( ) , Some ( 1 ) , "first cold run: {first:?}" ) ;
461+ let first_observation = native_cache_observation ( & workspace. path ) ?;
462+ assert_eq ! ( first_observation[ "execution" ] [ "cache_wrapper" ] [ "status" ] , "bypassed" ) ;
463+ assert_eq ! (
464+ first_observation[ "execution" ] [ "cache_wrapper" ] [ "reason" ] ,
465+ "native_cache_platform_not_graduated"
466+ ) ;
467+ let first_outputs = compiler_output_files ( & target) ?;
468+ assert ! ( !first_outputs. is_empty( ) , "fixture must produce compiler outputs" ) ;
469+
470+ fs:: remove_dir_all ( & target) ?;
471+ let second = run_unify_without_ambient_wrappers ( & workspace. path , local_cache. path ( ) ) ?;
472+ assert_eq ! ( second. status. code( ) , Some ( 1 ) , "second cold run: {second:?}" ) ;
473+ let second_observation = native_cache_observation ( & workspace. path ) ?;
474+ assert_eq ! ( second_observation[ "execution" ] [ "cache_wrapper" ] [ "status" ] , "bypassed" ) ;
475+ assert_eq ! (
476+ second_observation[ "execution" ] [ "cache_wrapper" ] [ "reason" ] ,
477+ "native_cache_platform_not_graduated"
478+ ) ;
479+ assert_eq ! ( compiler_output_files( & target) ?, first_outputs) ;
480+ Ok ( ( ) )
481+ }
482+
447483#[ cfg( unix) ]
448484#[ test]
449485fn configured_sccache_is_preserved_outside_the_diagnostic_wrapper ( ) -> Result < ( ) > {
0 commit comments