From acc528cbf40c42eb112d2ce66c5f778bd4a397fb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 16 Apr 2024 16:35:18 +0200 Subject: tools/syz-linter: check t.Logf/Errorf/Fatalf messages Fix checking of Logf, it has string in 0-th arg. Add checking of t.Errorf/Fatalf. --- dashboard/app/access_test.go | 2 +- dashboard/app/api_test.go | 10 +++++----- dashboard/app/app_test.go | 4 ++-- dashboard/app/reporting_test.go | 4 ++-- dashboard/app/repro_test.go | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'dashboard') diff --git a/dashboard/app/access_test.go b/dashboard/app/access_test.go index 8652fca87..208d79a29 100644 --- a/dashboard/app/access_test.go +++ b/dashboard/app/access_test.go @@ -373,7 +373,7 @@ func TestAccess(t *testing.T) { continue } if bytes.Contains(reply, []byte(ent.ref)) { - t.Errorf("request %v at level %v contains ref %v at level %v:\n%s\n\n", + t.Errorf("request %v at level %v contains ref %v at level %v:\n%s", url, requestLevel, ent.ref, ent.level, reply) } } diff --git a/dashboard/app/api_test.go b/dashboard/app/api_test.go index 4a872231e..6897848cf 100644 --- a/dashboard/app/api_test.go +++ b/dashboard/app/api_test.go @@ -17,7 +17,7 @@ func TestClientSecretOK(t *testing.T) { }, }, "user", "secr1t", "") if err != nil || got != "" { - t.Errorf("Unexpected error %v %v", got, err) + t.Errorf("unexpected error %v %v", got, err) } } @@ -28,7 +28,7 @@ func TestClientOauthOK(t *testing.T) { }, }, "user", "", "OauthSubject:public") if err != nil || got != "" { - t.Errorf("Unexpected error %v %v", got, err) + t.Errorf("unexpected error %v %v", got, err) } } @@ -39,7 +39,7 @@ func TestClientSecretFail(t *testing.T) { }, }, "user", "wrong", "") if err != ErrAccess || got != "" { - t.Errorf("Unexpected error %v %v", got, err) + t.Errorf("unexpected error %v %v", got, err) } } @@ -48,7 +48,7 @@ func TestClientSecretMissing(t *testing.T) { Clients: map[string]string{}, }, "user", "ignored", "") if err != ErrAccess || got != "" { - t.Errorf("Unexpected error %v %v", got, err) + t.Errorf("unexpected error %v %v", got, err) } } @@ -63,7 +63,7 @@ func TestClientNamespaceOK(t *testing.T) { }, }, "user", "secr1t", "") if err != nil || got != "ns1" { - t.Errorf("Unexpected error %v %v", got, err) + t.Errorf("unexpected error %v %v", got, err) } } diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go index 4e8e4efde..99da350aa 100644 --- a/dashboard/app/app_test.go +++ b/dashboard/app/app_test.go @@ -947,7 +947,7 @@ func TestPurgeOldCrashes(t *testing.T) { // A sanity check for the test itself. if !firstCrashExists() { - t.Fatalf("The first reported crash should be present") + t.Fatalf("the first reported crash should be present") } // Unreport the first crash. @@ -970,7 +970,7 @@ func TestPurgeOldCrashes(t *testing.T) { } // Check that the unreported crash was purged. if firstCrashExists() { - t.Fatalf("The unreported crash should have been purged.") + t.Fatalf("the unreported crash should have been purged") } } diff --git a/dashboard/app/reporting_test.go b/dashboard/app/reporting_test.go index c0d419418..7515cd810 100644 --- a/dashboard/app/reporting_test.go +++ b/dashboard/app/reporting_test.go @@ -968,10 +968,10 @@ func TestUpdateBugReporting(t *testing.T) { setIDs(bug, test.After) hasError := bug.updateReportings(c.ctx, cfg, now) != nil if hasError != test.Error { - t.Errorf("Before: %#v, Expected error: %v, Got error: %v", test.Before, test.Error, hasError) + t.Errorf("before: %#v, expected error: %v, got error: %v", test.Before, test.Error, hasError) } if !test.Error && !reflect.DeepEqual(bug.Reporting, test.After) { - t.Errorf("Before: %#v, Expected After: %#v, Got After: %#v", test.Before, test.After, bug.Reporting) + t.Errorf("before: %#v, expected after: %#v, got after: %#v", test.Before, test.After, bug.Reporting) } } } diff --git a/dashboard/app/repro_test.go b/dashboard/app/repro_test.go index 8c587324e..db37046d6 100644 --- a/dashboard/app/repro_test.go +++ b/dashboard/app/repro_test.go @@ -337,7 +337,7 @@ func TestNeedReproIsolated(t *testing.T) { } funcResult := needReproForBug(c.ctx, bug) if funcResult != test.needRepro { - t.Errorf("For %#v expected needRepro=%v, got needRepro=%v", + t.Errorf("for %#v expected needRepro=%v, got needRepro=%v", bug, test.needRepro, funcResult) } } -- cgit mrf-deployment