@@ -744,6 +744,8 @@ pub(super) struct TestBoardCollectionBuilder<'a> {
744
744
sp_active_version_exceptions : BTreeMap < SpIdentifier , ArtifactVersion > ,
745
745
rot_active_version_exceptions : BTreeMap < SpIdentifier , ArtifactVersion > ,
746
746
stage0_version_exceptions : BTreeMap < SpIdentifier , ArtifactVersion > ,
747
+ rot_active_slot_exceptions : BTreeMap < SpIdentifier , RotSlot > ,
748
+ rot_persistent_boot_preference_exceptions : BTreeMap < SpIdentifier , RotSlot > ,
747
749
748
750
// host exceptions are keyed only by slot; they only apply to sleds.
749
751
host_exceptions : BTreeMap < u16 , HostOsException > ,
@@ -774,6 +776,8 @@ impl<'a> TestBoardCollectionBuilder<'a> {
774
776
sp_active_version_exceptions : BTreeMap :: new ( ) ,
775
777
rot_active_version_exceptions : BTreeMap :: new ( ) ,
776
778
stage0_version_exceptions : BTreeMap :: new ( ) ,
779
+ rot_active_slot_exceptions : BTreeMap :: new ( ) ,
780
+ rot_persistent_boot_preference_exceptions : BTreeMap :: new ( ) ,
777
781
host_exceptions : BTreeMap :: new ( ) ,
778
782
}
779
783
}
@@ -829,6 +833,28 @@ impl<'a> TestBoardCollectionBuilder<'a> {
829
833
self
830
834
}
831
835
836
+ pub fn rot_active_slot_exception (
837
+ mut self ,
838
+ type_ : SpType ,
839
+ sp_slot : u16 ,
840
+ s : RotSlot ,
841
+ ) -> Self {
842
+ self . rot_active_slot_exceptions
843
+ . insert ( SpIdentifier { type_, slot : sp_slot } , s) ;
844
+ self
845
+ }
846
+
847
+ pub fn rot_persistent_boot_preference_exception (
848
+ mut self ,
849
+ type_ : SpType ,
850
+ sp_slot : u16 ,
851
+ s : RotSlot ,
852
+ ) -> Self {
853
+ self . rot_persistent_boot_preference_exceptions
854
+ . insert ( SpIdentifier { type_, slot : sp_slot } , s) ;
855
+ self
856
+ }
857
+
832
858
pub fn has_rot_active_version_exception (
833
859
& self ,
834
860
type_ : SpType ,
@@ -906,29 +932,6 @@ impl<'a> TestBoardCollectionBuilder<'a> {
906
932
let mut builder =
907
933
nexus_inventory:: CollectionBuilder :: new ( self . boards . test_name ) ;
908
934
909
- let dummy_sp_state = SpState {
910
- base_mac_address : [ 0 ; 6 ] ,
911
- hubris_archive_id : String :: from ( "unused" ) ,
912
- model : String :: from ( "unused" ) ,
913
- power_state : PowerState :: A0 ,
914
- revision : 0 ,
915
- rot : RotState :: V3 {
916
- active : RotSlot :: A ,
917
- pending_persistent_boot_preference : None ,
918
- persistent_boot_preference : RotSlot :: A ,
919
- slot_a_error : None ,
920
- slot_a_fwid : Default :: default ( ) ,
921
- slot_b_error : None ,
922
- slot_b_fwid : Default :: default ( ) ,
923
- stage0_error : None ,
924
- stage0_fwid : Default :: default ( ) ,
925
- stage0next_error : None ,
926
- stage0next_fwid : Default :: default ( ) ,
927
- transient_boot_preference : None ,
928
- } ,
929
- serial_number : String :: from ( "unused" ) ,
930
- } ;
931
-
932
935
for board in & self . boards . boards {
933
936
let & TestBoard {
934
937
id : sp_id,
@@ -939,6 +942,40 @@ impl<'a> TestBoardCollectionBuilder<'a> {
939
942
rot_sign : rkth,
940
943
} = board;
941
944
945
+ let rot_active_slot = self
946
+ . rot_active_slot_exceptions
947
+ . get ( & sp_id)
948
+ . cloned ( )
949
+ . unwrap_or ( RotSlot :: A ) ;
950
+ let rot_persistent_boot_preference = self
951
+ . rot_persistent_boot_preference_exceptions
952
+ . get ( & sp_id)
953
+ . cloned ( )
954
+ . unwrap_or ( RotSlot :: A ) ;
955
+
956
+ let dummy_sp_state = SpState {
957
+ base_mac_address : [ 0 ; 6 ] ,
958
+ hubris_archive_id : String :: from ( "unused" ) ,
959
+ model : String :: from ( "unused" ) ,
960
+ power_state : PowerState :: A0 ,
961
+ revision : 0 ,
962
+ rot : RotState :: V3 {
963
+ active : rot_active_slot,
964
+ pending_persistent_boot_preference : None ,
965
+ persistent_boot_preference : rot_persistent_boot_preference,
966
+ slot_a_error : None ,
967
+ slot_a_fwid : Default :: default ( ) ,
968
+ slot_b_error : None ,
969
+ slot_b_fwid : Default :: default ( ) ,
970
+ stage0_error : None ,
971
+ stage0_fwid : Default :: default ( ) ,
972
+ stage0next_error : None ,
973
+ stage0next_fwid : Default :: default ( ) ,
974
+ transient_boot_preference : None ,
975
+ } ,
976
+ serial_number : String :: from ( "unused" ) ,
977
+ } ;
978
+
942
979
let sp_state = SpState {
943
980
model : format ! ( "dummy_{}" , sp_id. type_) ,
944
981
serial_number : serial. to_string ( ) ,
@@ -985,7 +1022,7 @@ impl<'a> TestBoardCollectionBuilder<'a> {
985
1022
builder
986
1023
. found_caboose (
987
1024
& baseboard_id,
988
- CabooseWhich :: RotSlotA ,
1025
+ CabooseWhich :: from_rot_slot ( rot_active_slot ) ,
989
1026
"test" ,
990
1027
SpComponentCaboose {
991
1028
board : caboose_rot_board. to_string ( ) ,
@@ -1040,7 +1077,7 @@ impl<'a> TestBoardCollectionBuilder<'a> {
1040
1077
builder
1041
1078
. found_caboose (
1042
1079
& baseboard_id,
1043
- CabooseWhich :: RotSlotB ,
1080
+ CabooseWhich :: from_rot_slot ( rot_active_slot . toggled ( ) ) ,
1044
1081
"test" ,
1045
1082
SpComponentCaboose {
1046
1083
board : caboose_rot_board. to_string ( ) ,
0 commit comments