@@ -12,6 +12,7 @@ use bootsim::{
12
12
ImagesBuilder ,
13
13
Images ,
14
14
NO_DEPS ,
15
+ REV_DEPS ,
15
16
testlog,
16
17
} ;
17
18
use std:: {
@@ -54,6 +55,7 @@ sim_test!(perm_with_random_fails, make_image(&NO_DEPS, true), run_perm_with_rand
54
55
sim_test ! ( norevert, make_image( & NO_DEPS , true ) , run_norevert( ) ) ;
55
56
sim_test ! ( status_write_fails_complete, make_image( & NO_DEPS , true ) , run_with_status_fails_complete( ) ) ;
56
57
sim_test ! ( status_write_fails_with_reset, make_image( & NO_DEPS , true ) , run_with_status_fails_with_reset( ) ) ;
58
+ sim_test ! ( downgrade_prevention, make_image( & REV_DEPS , true ) , run_nodowngrade( ) ) ;
57
59
58
60
// Test various combinations of incorrect dependencies.
59
61
test_shell ! ( dependency_combos, r, {
@@ -75,18 +77,21 @@ pub static TEST_DEPS: &[DepTest] = &[
75
77
DepTest {
76
78
depends : [ DepType :: Nothing , DepType :: Nothing ] ,
77
79
upgrades : [ UpgradeInfo :: Upgraded , UpgradeInfo :: Upgraded ] ,
80
+ downgrade : false ,
78
81
} ,
79
82
80
83
// If all of the dependencies are met, we should also upgrade.
81
84
DepTest {
82
85
depends : [ DepType :: Correct , DepType :: Correct ] ,
83
86
upgrades : [ UpgradeInfo :: Upgraded , UpgradeInfo :: Upgraded ] ,
87
+ downgrade : false ,
84
88
} ,
85
89
86
90
// If none of the dependencies are met, the images should be held.
87
91
DepTest {
88
92
depends : [ DepType :: Newer , DepType :: Newer ] ,
89
93
upgrades : [ UpgradeInfo :: Held , UpgradeInfo :: Held ] ,
94
+ downgrade : false ,
90
95
} ,
91
96
92
97
// If the first image is not met, we should hold back on the
@@ -95,50 +100,58 @@ pub static TEST_DEPS: &[DepTest] = &[
95
100
DepTest {
96
101
depends : [ DepType :: Newer , DepType :: Correct ] ,
97
102
upgrades : [ UpgradeInfo :: Held , UpgradeInfo :: Held ] ,
103
+ downgrade : false ,
98
104
} ,
99
105
100
106
// Test the variant in the other direction.
101
107
DepTest {
102
108
depends : [ DepType :: Correct , DepType :: Newer ] ,
103
109
upgrades : [ UpgradeInfo :: Held , UpgradeInfo :: Held ] ,
110
+ downgrade : false ,
104
111
} ,
105
112
106
113
// Test where only the first image is upgraded, and there are no
107
114
// dependencies.
108
115
DepTest {
109
116
depends : [ DepType :: Nothing , DepType :: NoUpgrade ] ,
110
117
upgrades : [ UpgradeInfo :: Upgraded , UpgradeInfo :: Held ] ,
118
+ downgrade : false ,
111
119
} ,
112
120
113
121
// Test one image with a valid dependency on the first image.
114
122
DepTest {
115
123
depends : [ DepType :: OldCorrect , DepType :: NoUpgrade ] ,
116
124
upgrades : [ UpgradeInfo :: Upgraded , UpgradeInfo :: Held ] ,
125
+ downgrade : false ,
117
126
} ,
118
127
119
128
// Test one image with an invalid dependency on the first image.
120
129
DepTest {
121
130
depends : [ DepType :: Newer , DepType :: NoUpgrade ] ,
122
131
upgrades : [ UpgradeInfo :: Held , UpgradeInfo :: Held ] ,
132
+ downgrade : false ,
123
133
} ,
124
134
125
135
// Test where only the second image is upgraded, and there are no
126
136
// dependencies.
127
137
DepTest {
128
138
depends : [ DepType :: NoUpgrade , DepType :: Nothing ] ,
129
139
upgrades : [ UpgradeInfo :: Held , UpgradeInfo :: Upgraded ] ,
140
+ downgrade : false ,
130
141
} ,
131
142
132
143
// Test one image with a valid dependency on the second image.
133
144
DepTest {
134
145
depends : [ DepType :: NoUpgrade , DepType :: OldCorrect ] ,
135
146
upgrades : [ UpgradeInfo :: Held , UpgradeInfo :: Upgraded ] ,
147
+ downgrade : false ,
136
148
} ,
137
149
138
150
// Test one image with an invalid dependency on the second image.
139
151
DepTest {
140
152
depends : [ DepType :: NoUpgrade , DepType :: Newer ] ,
141
153
upgrades : [ UpgradeInfo :: Held , UpgradeInfo :: Held ] ,
154
+ downgrade : false ,
142
155
} ,
143
156
] ;
144
157
0 commit comments