mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
NOISSUE - Fix SEVSNPEnabled function to check for 'Y' instead of '1' in kernel parameter (#461)
CI / ci (push) Has been cancelled
CI / ci (push) Has been cancelled
* Fix SEVSNPEnabled function to check for 'Y' instead of '1' in kernel parameter Signed-off-by: Sammy Oina <sammyoina@gmail.com> * Fix TestSEVSNPEnabled to check for 'Y' instead of '1' in KVM parameter Signed-off-by: Sammy Oina <sammyoina@gmail.com> --------- Signed-off-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
committed by
GitHub
parent
bd59a4a617
commit
64bf7a56ac
+1
-1
@@ -205,7 +205,7 @@ func SEVEnabled(cpuinfo string, sevPresent bool) bool {
|
||||
}
|
||||
|
||||
func SEVSNPEnabled(cpuinfo, kernelParam string) bool {
|
||||
return strings.Contains(cpuinfo, "sev_snp") && strings.TrimSpace(kernelParam) == "1"
|
||||
return strings.Contains(cpuinfo, "sev_snp") && strings.TrimSpace(kernelParam) == "Y"
|
||||
}
|
||||
|
||||
func TDXEnabled(cpuinfo, kernelParam string) bool {
|
||||
|
||||
@@ -178,7 +178,7 @@ func TestSEVEnabled(t *testing.T) {
|
||||
|
||||
func TestSEVSNPEnabled(t *testing.T) {
|
||||
t.Run("cpuinfo and kvm param correct", func(t *testing.T) {
|
||||
assert.True(t, SEVSNPEnabled("flags: sev_snp abc", "1"))
|
||||
assert.True(t, SEVSNPEnabled("flags: sev_snp abc", "Y"))
|
||||
})
|
||||
|
||||
t.Run("missing sev_snp in cpuinfo", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user