aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-07-15 16:26:01 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-07-16 07:47:28 +0000
commitc118d7362b5a72c17c53a1c0171e45d398605b93 (patch)
tree10a87118fd0db2ffb3dab50d02add487a29cc3a3 /syz-cluster
parent87f957b57e3245660bc69f8c122d823fc96a3abd (diff)
syz-cluster: make single finding emails look more natural
Include a list of findings only if there are several of them.
Diffstat (limited to 'syz-cluster')
-rw-r--r--syz-cluster/pkg/report/email_test.go9
-rw-r--r--syz-cluster/pkg/report/template.txt7
-rw-r--r--syz-cluster/pkg/report/testdata/2.in.json33
-rw-r--r--syz-cluster/pkg/report/testdata/2.moderation.txt40
-rw-r--r--syz-cluster/pkg/report/testdata/2.upstream.txt33
5 files changed, 117 insertions, 5 deletions
diff --git a/syz-cluster/pkg/report/email_test.go b/syz-cluster/pkg/report/email_test.go
index ff5c13398..ca509d593 100644
--- a/syz-cluster/pkg/report/email_test.go
+++ b/syz-cluster/pkg/report/email_test.go
@@ -6,14 +6,13 @@ package report
import (
"encoding/json"
"flag"
+ "github.com/google/syzkaller/syz-cluster/pkg/api"
+ "github.com/google/syzkaller/syz-cluster/pkg/app"
+ "github.com/stretchr/testify/assert"
"os"
"path/filepath"
"strings"
"testing"
-
- "github.com/google/syzkaller/syz-cluster/pkg/api"
- "github.com/google/syzkaller/syz-cluster/pkg/app"
- "github.com/stretchr/testify/assert"
)
var flagWrite = flag.Bool("write", false, "overwrite out.txt files")
@@ -63,7 +62,7 @@ func TestRender(t *testing.T) {
} else {
expected, err := os.ReadFile(outPath)
assert.NoError(t, err)
- assert.Equal(t, expected, output)
+ assert.Equal(t, string(expected), string(output))
}
})
}
diff --git a/syz-cluster/pkg/report/template.txt b/syz-cluster/pkg/report/template.txt
index 955fd2444..f22666967 100644
--- a/syz-cluster/pkg/report/template.txt
+++ b/syz-cluster/pkg/report/template.txt
@@ -6,10 +6,17 @@
* {{.Title}}
{{- end}}
+{{- if gt (len .Report.Findings) 1 }}
+
and found the following issues:
{{- range .Report.Findings}}
* {{.Title}}
{{- end}}
+{{- else }}
+
+and found the following issue:
+{{ (index .Report.Findings 0).Title }}
+{{- end }}
Full report is available here:
{{.Report.Link}}
diff --git a/syz-cluster/pkg/report/testdata/2.in.json b/syz-cluster/pkg/report/testdata/2.in.json
new file mode 100644
index 000000000..527f50a61
--- /dev/null
+++ b/syz-cluster/pkg/report/testdata/2.in.json
@@ -0,0 +1,33 @@
+{
+ "id": "abcd",
+ "series": {
+ "title": "Series title",
+ "version": 2,
+ "link": "http://link/to/series",
+ "patches": [
+ {
+ "title": "first patch"
+ },
+ {
+ "title": "second patch"
+ }
+ ]
+ },
+ "findings": [
+ {
+ "title": "WARNING in abcd",
+ "report": "Report Line A\nReport Line B\nReport Line C",
+ "c_repro": "http://link/to/c/repro",
+ "syz_repro": "http://link/to/syz/repro",
+ "build": {
+ "repo": "http://kernel/repo1",
+ "base_commit": "base_commit1",
+ "arch": "amd64",
+ "config_link": "http://link/to/config/1",
+ "compiler": "clang"
+ }
+ }
+ ],
+ "cc": ["a@a.com", "b@b.com"],
+ "link": "http://some/link/to/report"
+}
diff --git a/syz-cluster/pkg/report/testdata/2.moderation.txt b/syz-cluster/pkg/report/testdata/2.moderation.txt
new file mode 100644
index 000000000..a614f691e
--- /dev/null
+++ b/syz-cluster/pkg/report/testdata/2.moderation.txt
@@ -0,0 +1,40 @@
+syzbot has tested the following series
+
+[v2] Series title
+http://link/to/series
+* first patch
+* second patch
+
+and found the following issue:
+WARNING in abcd
+
+Full report is available here:
+http://some/link/to/report
+
+***
+
+WARNING in abcd
+
+tree: http://kernel/repo1
+base: base_commit1
+arch: amd64
+compiler: clang
+config: http://link/to/config/1
+C repro: http://link/to/c/repro
+syz repro: http://link/to/syz/repro
+
+Report Line A
+Report Line B
+Report Line C
+
+---
+This report is generated by a bot. It may contain errors.
+See http://docs/link for more information about syzbot.
+syzbot engineers can be reached at support@email.com.
+
+The email will later be sent to:
+[a@a.com b@b.com]
+
+If the report looks fine to you, reply with:
+#syz upstream
+
diff --git a/syz-cluster/pkg/report/testdata/2.upstream.txt b/syz-cluster/pkg/report/testdata/2.upstream.txt
new file mode 100644
index 000000000..adddb20af
--- /dev/null
+++ b/syz-cluster/pkg/report/testdata/2.upstream.txt
@@ -0,0 +1,33 @@
+syzbot has tested the following series
+
+[v2] Series title
+http://link/to/series
+* first patch
+* second patch
+
+and found the following issue:
+WARNING in abcd
+
+Full report is available here:
+http://some/link/to/report
+
+***
+
+WARNING in abcd
+
+tree: http://kernel/repo1
+base: base_commit1
+arch: amd64
+compiler: clang
+config: http://link/to/config/1
+C repro: http://link/to/c/repro
+syz repro: http://link/to/syz/repro
+
+Report Line A
+Report Line B
+Report Line C
+
+---
+This report is generated by a bot. It may contain errors.
+See http://docs/link for more information about syzbot.
+syzbot engineers can be reached at support@email.com.