Skip to content

Commit 8cb8efa

Browse files
committed
feat: mark not implemented tests as NOT IMPLEMENTED
Signed-off-by: Christian Walter <christian.walter@9elements.com>
1 parent 1a60950 commit 8cb8efa

3 files changed

Lines changed: 37 additions & 28 deletions

File tree

cmd/core/amd-suite/cmd.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,29 @@ func run(testGroup string, tests []*test.Test, preset *test.PreSet) bool {
101101
for index := range tests {
102102
var s string
103103

104-
if tests[index].Status == test.NotImplemented {
105-
continue
106-
}
107104
if tests[index].Result == test.ResultNotRun {
108105
continue
109106
}
110107
s += fmt.Sprintf("%02d - ", index)
111108
s += fmt.Sprintf("%-40s: ", a.Bold(tests[index].Name))
112109

113-
if tests[index].Result == test.ResultPass {
110+
if tests[index].Status == test.NotImplemented {
111+
s += fmt.Sprintf("%-20s", a.Bold(a.Yellow(tests[index].Status)))
112+
log.Infof("%s", s)
113+
continue
114+
}
115+
116+
switch tests[index].Result {
117+
case test.ResultPass:
114118
s += fmt.Sprintf("%-20s", a.Bold(a.Green(tests[index].Result)))
115-
} else {
119+
default:
116120
s += fmt.Sprintf("%-20s", a.Bold(a.Red(tests[index].Result)))
117121
result = false
118-
}
119-
if tests[index].ErrorText != "" {
120-
s += fmt.Sprintf(" (%s)", tests[index].ErrorText)
121-
} else if len(tests[index].ErrorText) == 0 && tests[index].Result == test.ResultFail {
122-
s += " (No error text given)"
122+
if tests[index].ErrorText != "" {
123+
s += fmt.Sprintf(" (%s)", tests[index].ErrorText)
124+
} else if len(tests[index].ErrorText) == 0 && tests[index].Result == test.ResultFail {
125+
s += " (No error text given)"
126+
}
123127
}
124128
log.Infof("%s", s)
125129

pkg/test/amd_tests.go

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ var (
130130
Name: "PSB Policy Hash",
131131
Required: true,
132132
function: PSBPolicyHash,
133-
Status: Implemented,
133+
Status: NotImplemented,
134134
SpecificationChapter: "",
135135
SpecificiationTitle: AMDPSBSpecificationTitle,
136136
dependencies: []*Test{&testAMDFamilyModel},
@@ -151,7 +151,7 @@ var (
151151
Name: "SME Support",
152152
Required: true,
153153
function: SMESupport,
154-
Status: Implemented,
154+
Status: NotImplemented,
155155
SpecificationChapter: "",
156156
SpecificiationTitle: "AMD Secure Memory Encryption",
157157
dependencies: []*Test{&testAMDFamilyModel},
@@ -161,7 +161,7 @@ var (
161161
Name: "SME Enabled",
162162
Required: true,
163163
function: SMEEnabled,
164-
Status: Implemented,
164+
Status: NotImplemented,
165165
SpecificationChapter: "",
166166
SpecificiationTitle: "AMD Secure Memory Encryption",
167167
dependencies: []*Test{&testAMDFamilyModel},
@@ -171,7 +171,7 @@ var (
171171
Name: "SME Kernel Option Set",
172172
Required: true,
173173
function: SMEKernelOption,
174-
Status: Implemented,
174+
Status: NotImplemented,
175175
SpecificationChapter: "",
176176
SpecificiationTitle: "AMD Secure Memory Encryption",
177177
dependencies: []*Test{&testAMDFamilyModel},
@@ -181,7 +181,7 @@ var (
181181
Name: "SME Kernel Commandline",
182182
Required: true,
183183
function: SMEKernelCommandline,
184-
Status: Implemented,
184+
Status: NotImplemented,
185185
SpecificationChapter: "",
186186
SpecificiationTitle: "AMD Secure Memory Encryption",
187187
dependencies: []*Test{&testAMDFamilyModel},
@@ -191,7 +191,7 @@ var (
191191
Name: "Verify SME Functionality",
192192
Required: true,
193193
function: SMEFunctionality,
194-
Status: Implemented,
194+
Status: NotImplemented,
195195
SpecificationChapter: "",
196196
SpecificiationTitle: "AMD Secure Memory Encryption",
197197
dependencies: []*Test{&testAMDFamilyModel},
@@ -202,7 +202,7 @@ var (
202202
Name: "SEV Support",
203203
Required: true,
204204
function: SEVSupport,
205-
Status: Implemented,
205+
Status: NotImplemented,
206206
SpecificationChapter: "",
207207
SpecificiationTitle: "AMD Secure Encrypted Virtualization",
208208
dependencies: []*Test{&testAMDFamilyModel},
@@ -212,7 +212,7 @@ var (
212212
Name: "SEV Enabled",
213213
Required: true,
214214
function: SEVEnabled,
215-
Status: Implemented,
215+
Status: NotImplemented,
216216
SpecificationChapter: "",
217217
SpecificiationTitle: "AMD Secure Encrypted Virtualization",
218218
dependencies: []*Test{&testAMDFamilyModel},
@@ -222,7 +222,7 @@ var (
222222
Name: "SEV Firmware Version Validation",
223223
Required: true,
224224
function: SEVFirmwareVersion,
225-
Status: Implemented,
225+
Status: NotImplemented,
226226
SpecificationChapter: "",
227227
SpecificiationTitle: "AMD Secure Encrypted Virtualization",
228228
dependencies: []*Test{&testAMDFamilyModel},
@@ -232,7 +232,7 @@ var (
232232
Name: "SEV Guest Configuration Validation",
233233
Required: true,
234234
function: SEVGuestConfig,
235-
Status: Implemented,
235+
Status: NotImplemented,
236236
SpecificationChapter: "",
237237
SpecificiationTitle: "AMD Secure Encrypted Virtualization",
238238
dependencies: []*Test{&testAMDFamilyModel},
@@ -253,7 +253,7 @@ var (
253253
Name: "SEV-SNP Enabled",
254254
Required: true,
255255
function: SEVSNPEnabled,
256-
Status: Implemented,
256+
Status: NotImplemented,
257257
SpecificationChapter: "",
258258
SpecificiationTitle: "AMD Secure Encrypted Virtualization-Secure Nested Paging",
259259
dependencies: []*Test{&testAMDFamilyModel},
@@ -263,7 +263,7 @@ var (
263263
Name: "SEV-SNP Debug Registers disabled",
264264
Required: true,
265265
function: SEVSNPDebugRegisters,
266-
Status: Implemented,
266+
Status: NotImplemented,
267267
SpecificationChapter: "",
268268
SpecificiationTitle: "AMD Secure Encrypted Virtualization-Secure Nested Paging",
269269
dependencies: []*Test{&testAMDFamilyModel},
@@ -273,7 +273,7 @@ var (
273273
Name: "Side-Channel Protection enabled",
274274
Required: true,
275275
function: SEVSNPSideChannelProtection,
276-
Status: Implemented,
276+
Status: NotImplemented,
277277
SpecificationChapter: "",
278278
SpecificiationTitle: "AMD Secure Encrypted Virtualization-Secure Nested Paging",
279279
dependencies: []*Test{&testAMDFamilyModel},
@@ -283,7 +283,7 @@ var (
283283
Name: "SEV-SNP Firmware Version Validation",
284284
Required: true,
285285
function: SEVSNPFirmwareVersion,
286-
Status: Implemented,
286+
Status: NotImplemented,
287287
SpecificationChapter: "",
288288
SpecificiationTitle: "AMD Secure Encrypted Virtualization-Secure Nested Paging",
289289
dependencies: []*Test{&testAMDFamilyModel},
@@ -293,7 +293,7 @@ var (
293293
Name: "Measurement of SNP Protected VM Boot",
294294
Required: true,
295295
function: SEVSNPVMBoot,
296-
Status: Implemented,
296+
Status: NotImplemented,
297297
SpecificationChapter: "",
298298
SpecificiationTitle: "AMD Secure Encrypted Virtualization-Secure Nested Paging",
299299
dependencies: []*Test{&testAMDFamilyModel},
@@ -303,7 +303,7 @@ var (
303303
Name: "SNP Attestation Reporting",
304304
Required: true,
305305
function: SEVSNPAttestation,
306-
Status: Implemented,
306+
Status: NotImplemented,
307307
SpecificationChapter: "",
308308
SpecificiationTitle: "AMD Secure Encrypted Virtualization-Secure Nested Paging",
309309
dependencies: []*Test{&testAMDFamilyModel},
@@ -376,6 +376,9 @@ var (
376376
&testSEVSNPVMBoot,
377377
&testSEVSNPAttestation,
378378
}
379+
TestsAMDGeneral = []*Test{
380+
&testAMDFamilyModel,
381+
}
379382
)
380383

381384
// SME Tests

pkg/test/test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ const (
2424

2525
// ResultPass indicates that the test succeeded.
2626
ResultPass
27+
28+
// ResultNotImplemented indicates that the test is not implemented
29+
ResultNotImplemented
2730
)
2831

2932
func (t Result) String() string {
@@ -72,7 +75,7 @@ type Test struct {
7275

7376
// Run implements the genereal test function and exposes it.
7477
func (t *Test) Run(hw hwapi.LowLevelHardwareInterfaces, preset *PreSet) bool {
75-
var DepsPassed = true
78+
DepsPassed := true
7679
// Make sure all dependencies have run and passed
7780
for idx := range t.dependencies {
7881
if t.dependencies[idx].Status == NotImplemented {
@@ -138,7 +141,6 @@ func (t *Test) Run(hw hwapi.LowLevelHardwareInterfaces, preset *PreSet) bool {
138141

139142
// RunTestsSilent Runs the specified tests and returns false on the first error encountered
140143
func RunTestsSilent(hw hwapi.LowLevelHardwareInterfaces, preset *PreSet, Tests []*Test) (bool, string, error) {
141-
142144
intErr := fmt.Errorf("internal error running test")
143145

144146
for i := range Tests {

0 commit comments

Comments
 (0)