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. --- prog/test_util.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'prog/test_util.go') diff --git a/prog/test_util.go b/prog/test_util.go index eb15539ea..fb45a8566 100644 --- a/prog/test_util.go +++ b/prog/test_util.go @@ -36,7 +36,7 @@ func TestDeserializeHelper(t *testing.T, OS, arch string, transform func(*Target t.Errorf("both Err and Out are set") } if test.In == test.Out { - t.Errorf("In and Out are equal, remove Out in such case\n%v", test.In) + t.Errorf("in and out are equal, remove Out in such case\n%v", test.In) } if test.Out == "" { test.Out = test.In @@ -49,7 +49,7 @@ func TestDeserializeHelper(t *testing.T, OS, arch string, transform func(*Target } if err != nil { if wantErr == "" { - t.Fatalf("deserialization failed with\n%s\ndata:\n%s\n", + t.Fatalf("deserialization failed with\n%s\ndata:\n%s", err, test.In) } if !strings.Contains(err.Error(), wantErr) { @@ -58,7 +58,7 @@ func TestDeserializeHelper(t *testing.T, OS, arch string, transform func(*Target } } else { if wantErr != "" { - t.Fatalf("deserialization should have failed with:\n%s\ndata:\n%s\n", + t.Fatalf("deserialization should have failed with:\n%s\ndata:\n%s", wantErr, test.In) } if transform != nil { @@ -72,7 +72,7 @@ func TestDeserializeHelper(t *testing.T, OS, arch string, transform func(*Target // the verbose and non-verbose output don't match -- the strict parsing // mode does not accept the non-verbose output as input. if want != output && want != outputVerbose { - t.Fatalf("wrong serialized data:\n%s\nexpect:\n%s\n", outputVerbose, want) + t.Fatalf("wrong serialized data:\n%s\nexpect:\n%s", outputVerbose, want) } p.SerializeForExec() } -- cgit mrf-deployment