diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-26 19:16:32 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-27 10:37:45 +0900 |
| commit | 8c7109a2d58c40b86ad97ed520aff6b00bbf1667 (patch) | |
| tree | 547f611b77e98f5df433ba513cbcbc9dc47e4b8e /cmd/earlyinit/uevent_test.go | |
| parent | caf3e0db4b92d859599ee199b32051fae8c99016 (diff) | |
cmd/earlyinit: mount system device
This currently relies on a trusted bootloader to determine the boot device.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/earlyinit/uevent_test.go')
| -rw-r--r-- | cmd/earlyinit/uevent_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cmd/earlyinit/uevent_test.go b/cmd/earlyinit/uevent_test.go new file mode 100644 index 00000000..d4b77141 --- /dev/null +++ b/cmd/earlyinit/uevent_test.go @@ -0,0 +1,35 @@ +package main + +import ( + "testing" + "testing/synctest" + "time" +) + +func TestRejectColdboot(t *testing.T) { + t.Parallel() + + synctest.Test(t, func(t *testing.T) { + nextColdboot := newRejectColdboot() + want := func(want bool) { + if got := nextColdboot(); got != want { + t.Fatalf("nextColdboot: %v, want %v", got, want) + } + } + + synctest.Wait() + want(true) + time.Sleep(time.Hour) + synctest.Wait() + want(true) + want(true) + time.Sleep(5 * time.Minute) + synctest.Wait() + want(true) + want(false) + time.Sleep(time.Hour) + synctest.Wait() + want(false) + want(false) + }) +} |
