mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-24 11:59:58 +00:00
syz-dash: move patch parsing to pkg/kernel
Patch parsing is not dashboard-specific and can be reused by other programs.
This commit is contained in:
parent
b41e96b421
commit
54e36636a1
@ -1,7 +1,7 @@
|
||||
// Copyright 2017 syzkaller project authors. All rights reserved.
|
||||
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
||||
|
||||
package dash
|
||||
package kernel
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func parsePatch(text string) (title string, diff string, err error) {
|
||||
func ParsePatch(text string) (title string, diff string, err error) {
|
||||
s := bufio.NewScanner(strings.NewReader(text))
|
||||
parsingDiff := false
|
||||
diffStarted := false
|
@ -1,7 +1,7 @@
|
||||
// Copyright 2017 syzkaller project authors. All rights reserved.
|
||||
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
||||
|
||||
package dash
|
||||
package kernel
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -10,7 +10,7 @@ import (
|
||||
func TestParsePatch(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.title, func(t *testing.T) {
|
||||
title, diff, err := parsePatch(test.text)
|
||||
title, diff, err := ParsePatch(test.text)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to parse patch: %v", err)
|
||||
}
|
@ -16,6 +16,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/syzkaller/pkg/kernel"
|
||||
"appengine"
|
||||
ds "appengine/datastore"
|
||||
"appengine/user"
|
||||
@ -412,7 +413,7 @@ func handleBug(c appengine.Context, w http.ResponseWriter, r *http.Request) erro
|
||||
}
|
||||
dropCached(c)
|
||||
case "Add patch":
|
||||
title, diff, err := parsePatch(r.FormValue("patch"))
|
||||
title, diff, err := kernel.ParsePatch(r.FormValue("patch"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse patch: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user