Skip to content

Commit

Permalink
sbctl: ensure tests are working with new efivarfs detection
Browse files Browse the repository at this point in the history
Signed-off-by: Morten Linderud <[email protected]>
  • Loading branch information
Foxboron committed Oct 18, 2024
1 parent 2524baa commit 53e074d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/sbctl/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ var (
)

func TestStatusOff(t *testing.T) {
cmd := SetFS(efitest.SecureBootOff())
cmd := SetFS(
efitest.SecureBootOff(),
efitest.SetUpModeOn(),
)

if err := captureJsonOutput(&out, func() error {
return RunStatus(cmd, []string{})
Expand All @@ -28,7 +31,8 @@ func TestStatusOff(t *testing.T) {
}

func TestStatusOn(t *testing.T) {
cmd := SetFS(efitest.SecureBootOn())
cmd := SetFS(efitest.SecureBootOn(),
efitest.SetUpModeOff())

if err := captureJsonOutput(&out, func() error {
return RunStatus(cmd, []string{})
Expand All @@ -50,6 +54,7 @@ func TestFQ0001DateMethod(t *testing.T) {
fstest.MapFS{"/sys/devices/virtual/dmi/id/chassis_type": {Data: []byte("3\n")}},
fstest.MapFS{"/sys/devices/virtual/dmi/id/product_name": {Data: []byte("MS-7E07\n")}},
efitest.SecureBootOn(),
efitest.SetUpModeOff(),
)

if err := captureJsonOutput(&out, func() error {
Expand Down Expand Up @@ -81,6 +86,7 @@ func TestFQ0001DeviceMethod(t *testing.T) {
fstest.MapFS{"/sys/devices/virtual/dmi/id/chassis_type": {Data: []byte("3\n")}},
fstest.MapFS{"/sys/devices/virtual/dmi/id/product_name": {Data: []byte("MS-7C84\n")}},
efitest.SecureBootOn(),
efitest.SetUpModeOff(),
)

if err := captureJsonOutput(&out, func() error {
Expand Down Expand Up @@ -112,6 +118,7 @@ func TestFQ0001ExplicitlyUnaffected(t *testing.T) {
fstest.MapFS{"/sys/devices/virtual/dmi/id/chassis_type": {Data: []byte("3\n")}},
fstest.MapFS{"/sys/devices/virtual/dmi/id/product_name": {Data: []byte("MS-7C80\n")}},
efitest.SecureBootOn(),
efitest.SetUpModeOff(),
)

if err := captureJsonOutput(&out, func() error {
Expand Down Expand Up @@ -141,6 +148,7 @@ func TestFQ0001WrongChassis(t *testing.T) {
fstest.MapFS{"/sys/devices/virtual/dmi/id/chassis_type": {Data: []byte("5\n")}},
fstest.MapFS{"/sys/devices/virtual/dmi/id/product_name": {Data: []byte("MS-7E07\n")}},
efitest.SecureBootOn(),
efitest.SetUpModeOff(),
)

if err := captureJsonOutput(&out, func() error {
Expand Down Expand Up @@ -170,6 +178,7 @@ func TestFQ0001WrongVendor(t *testing.T) {
fstest.MapFS{"/sys/devices/virtual/dmi/id/chassis_type": {Data: []byte("3\n")}},
fstest.MapFS{"/sys/devices/virtual/dmi/id/product_name": {Data: []byte("MS-7E07\n")}},
efitest.SecureBootOn(),
efitest.SetUpModeOff(),
)

if err := captureJsonOutput(&out, func() error {
Expand Down

0 comments on commit 53e074d

Please sign in to comment.