aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs/git_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-03-12 12:22:13 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-03-17 18:06:44 +0100
commit5ed211ca96c6e6ab96fad7b5a495d81178ee98eb (patch)
tree352711e48e64791cda1615ca2bd6611588a23209 /pkg/vcs/git_test.go
parent5958caeafcf3d467009ae984a9be8302bf852a50 (diff)
pkg/vcs: refactor bisection support
In preparation for syz-ci bisection: - move bisection function into a separate interface they look out of place in vcs.Repo because most OSes don't implement it and most users don't case - extract author name and more CC emails for commits - move linux-specific PreviousReleaseTags into linux.go - fix inconclusive bisection (more than 1 potential commits) - add tests fr bisection - add maintainers returned from get_maintainers.pl for commits that don't have enough emails (e.g. only author email) Update #501
Diffstat (limited to 'pkg/vcs/git_test.go')
-rw-r--r--pkg/vcs/git_test.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/pkg/vcs/git_test.go b/pkg/vcs/git_test.go
index a22835a69..b2ad32b6b 100644
--- a/pkg/vcs/git_test.go
+++ b/pkg/vcs/git_test.go
@@ -7,6 +7,8 @@ import (
"reflect"
"testing"
"time"
+
+ "github.com/google/go-cmp/cmp"
)
func TestGitParseCommit(t *testing.T) {
@@ -14,6 +16,7 @@ func TestGitParseCommit(t *testing.T) {
`2075b16e32c26e4031b9fd3cbe26c54676a8fcb5
rbtree: include rcu.h
foobar@foobar.de
+Foo Bar
Fri May 11 16:02:14 2018 -0700
Since commit c1adf20052d8 ("Introduce rb_replace_node_rcu()")
rbtree_augmented.h uses RCU related data structures but does not include
@@ -30,14 +33,18 @@ Reported-and-Tested-by: Name-name <name@name.com>
Tested-by: Must be correct <mustbe@correct.com>
Signed-off-by: Linux Master <linux@linux-foundation.org>
`: {
- Hash: "2075b16e32c26e4031b9fd3cbe26c54676a8fcb5",
- Title: "rbtree: include rcu.h",
- Author: "foobar@foobar.de",
+ Hash: "2075b16e32c26e4031b9fd3cbe26c54676a8fcb5",
+ Title: "rbtree: include rcu.h",
+ Author: "foobar@foobar.de",
+ AuthorName: "Foo Bar",
CC: []string{
"and@me.com",
+ "another@email.de",
"foobar@foobar.de",
+ "linux@linux-foundation.org",
"mustbe@correct.com",
"name@name.com",
+ "somewhere@email.com",
"subsystem@reviewer.com",
"yetanother@email.org",
},
@@ -45,7 +52,7 @@ Signed-off-by: Linux Master <linux@linux-foundation.org>
},
}
for input, com := range tests {
- res, err := gitParseCommit([]byte(input), nil, nil)
+ res, err := gitParseCommit([]byte(input), nil, nil, nil)
if err != nil && com != nil {
t.Fatalf("want %+v, got error: %v", com, err)
}
@@ -64,8 +71,8 @@ Signed-off-by: Linux Master <linux@linux-foundation.org>
if com.Author != res.Author {
t.Fatalf("want author %q, got %q", com.Author, res.Author)
}
- if !reflect.DeepEqual(com.CC, res.CC) {
- t.Fatalf("want CC %q, got %q", com.CC, res.CC)
+ if diff := cmp.Diff(com.CC, res.CC); diff != "" {
+ t.Fatalf("bad CC: %v", diff)
}
if !com.Date.Equal(res.Date) {
t.Fatalf("want date %v, got %v", com.Date, res.Date)