mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
This change updates the kcov implementation to use the new Go coverage interface provided by the `internal/coverage` package. The previous implementation relied on `coverdata.Blocks`, which is part of the older coverage tooling. The new implementation uses `runtime/coverage.WriteCounters` to get the raw coverage data and then decodes it using `decodecounter.NewDecoder`. This approach is aligned with the modern Go coverage infrastructure. This change requires a patched Go compiler that allows importing internal packages. This is a temporary measure until the golang team provides a public API. More details can be found here: https://github.com/golang/go/issues/51430 PiperOrigin-RevId: 828145693
66 lines
1.8 KiB
Go
66 lines
1.8 KiB
Go
// Copyright 2020 The gVisor Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
//go:build !kcov && !false
|
|
// +build !kcov,!false
|
|
|
|
// Package coverage provides an interface through which Go coverage data can
|
|
// be collected, converted to kcov format, and exposed to userspace.
|
|
package coverage
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
// Available returns whether any coverage data is available.
|
|
func Available() bool {
|
|
return false
|
|
}
|
|
|
|
// EnableReport sets up coverage reporting.
|
|
func EnableReport(w io.WriteCloser) {
|
|
}
|
|
|
|
// Report writes out a coverage report with all blocks that have been covered.
|
|
func Report() error {
|
|
return nil
|
|
}
|
|
|
|
// KcovSupported returns whether the kcov interface should be made available.
|
|
func KcovSupported() bool {
|
|
return false
|
|
}
|
|
|
|
// InitCoverageData initializes global kcov-related data structures.
|
|
func InitCoverageData() {}
|
|
|
|
// ClearCoverageData clears existing coverage data.
|
|
func ClearCoverageData() {}
|
|
|
|
// ConsumeCoverageData builds the collection of covered PCs.
|
|
func ConsumeCoverageData(w io.Writer) int {
|
|
return 0
|
|
}
|
|
|
|
// Symbolize writes out information about the block corresponding to pc.
|
|
func Symbolize(out io.Writer, pc uint64) error {
|
|
return nil
|
|
}
|
|
|
|
// WriteAllBlocks writes out all PCs along with their corresponding position in the
|
|
// source code.
|
|
func WriteAllBlocks(out io.Writer) error {
|
|
return nil
|
|
}
|