aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/report
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-26 18:06:07 +0900
committerOphestra <cat@gensokyo.uk>2026-05-26 18:39:09 +0900
commitcaf3e0db4b92d859599ee199b32051fae8c99016 (patch)
treeaf7e9cb71d52b7f8b6a21ee6b9c1be417480a1fe /internal/report
parent12b9f51128b2683303bc9ea500c07d6f4417988f (diff)
internal/kobject: improve error JSON representation
This is now usable by internal/report. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/report')
-rw-r--r--internal/report/report_test.go25
1 files changed, 21 insertions, 4 deletions
diff --git a/internal/report/report_test.go b/internal/report/report_test.go
index 307968b4..6c7a4046 100644
--- a/internal/report/report_test.go
+++ b/internal/report/report_test.go
@@ -11,8 +11,10 @@ import (
"unsafe"
"hakurei.app/check"
+ "hakurei.app/internal/kobject"
"hakurei.app/internal/report"
"hakurei.app/internal/stub"
+ "hakurei.app/internal/uevent"
)
type representableUE struct{ stub.UniqueError }
@@ -38,10 +40,25 @@ func TestDispatch(t *testing.T) {
Message: "rejecting coldboot loop",
Err: stub.UniqueError(0xcafe),
},
- }, true, []string{
- `{"kind":"fatal","message":"rejecting coldboot loop","error":"unique error 51966 injected by the test suite"}
-`,
- }, "dispatch: rejecting coldboot loop: unique error 51966 injected by the test suite\n", nil},
+ {
+ Severity: report.Inconsistent,
+ Message: "processed inconsistent uevent",
+ Err: (&kobject.Event{
+ Action: uevent.KOBJ_ADD,
+ DevPath: "\x00",
+ Env: map[string]string{"V": "\xfd"},
+ Sequence: 2,
+ }).NewError(kobject.EDuplicateAdd, &kobject.Object{
+ State: kobject.StateNew,
+ DevPath: "\x00",
+ Env: map[string]string{"V": "\xff"},
+ }),
+ },
+ }, true, []string{`{"kind":"fatal","message":"rejecting coldboot loop","error":"unique error 51966 injected by the test suite"}
+`, `{"kind":"inconsistent","message":"processed inconsistent uevent","error":{"fault":1,"event":{"action":"add","devpath":"\u0000","env":{"V":"\ufffd"},"seqnum":2,"subsystem":""},"object":{"state":1,"devpath":"\u0000","subsystem":"","env":{"V":"\ufffd"}}}}
+`}, `dispatch: rejecting coldboot loop: unique error 51966 injected by the test suite
+dispatch: processed inconsistent uevent: duplicate add event on devpath "\x00"
+`, nil},
{"strict", report.DStrict, []report.Error{
{