mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 11:29:46 +00:00
syz-manager: Support kernelSrc and vmlinux from different tree
If vmlinux built from different tree from kernelSrc, cover page will failed to show. So match only the path without prefix.
This commit is contained in:
parent
8cc079c3f6
commit
f69c5fcd76
@ -33,3 +33,4 @@ Mitchell Horne
|
||||
Denis Efremov
|
||||
Ondrej Mosnacek
|
||||
Daniel Borkmann
|
||||
Joey Jiao
|
||||
|
@ -70,7 +70,7 @@ func initCover(kernelObj, arch string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func generateCoverHTML(w io.Writer, kernelObj, arch string, cov cover.Cover) error {
|
||||
func generateCoverHTML(w io.Writer, kernelObj, kernelSrc, arch string, cov cover.Cover) error {
|
||||
if len(cov) == 0 {
|
||||
return fmt.Errorf("no coverage data available")
|
||||
}
|
||||
@ -106,6 +106,10 @@ func generateCoverHTML(w io.Writer, kernelObj, arch string, cov cover.Cover) err
|
||||
|
||||
var d templateData
|
||||
for f, covered := range fileSet(coveredFrames, uncoveredFrames) {
|
||||
remain := strings.TrimPrefix(f, prefix)
|
||||
if kernelSrc != "" {
|
||||
f = filepath.Join(kernelSrc, remain)
|
||||
}
|
||||
lines, err := parseFile(f)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -130,7 +134,7 @@ func generateCoverHTML(w io.Writer, kernelObj, arch string, cov cover.Cover) err
|
||||
buf.Write([]byte{'\n'})
|
||||
}
|
||||
}
|
||||
f = filepath.Clean(strings.TrimPrefix(f, prefix))
|
||||
f = filepath.Clean(remain)
|
||||
d.Files = append(d.Files, &templateFile{
|
||||
ID: hash.String([]byte(f)),
|
||||
Name: f,
|
||||
|
@ -231,7 +231,7 @@ func (mgr *Manager) httpCoverCover(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
if err := generateCoverHTML(w, mgr.cfg.KernelObj, mgr.cfg.TargetVMArch, cov); err != nil {
|
||||
if err := generateCoverHTML(w, mgr.cfg.KernelObj, mgr.cfg.KernelSrc, mgr.cfg.TargetVMArch, cov); err != nil {
|
||||
http.Error(w, fmt.Sprintf("failed to generate coverage profile: %v", err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user