internal/civisibility/integrations/gotesting
Those integration are enabled by having the
following import in the project’s orchestrion.tool.go file:
import (
_ "github.com/DataDog/orchestrion"
_ "github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting" // integration
//...
)Testing instrumentation
M.Run
All of
- Import path
testing - Function body
- Function declaration
- Function name
Run - Is method of
*testing.M
Introduce new declarations:
//go:linkname __dd_civisibility_instrumentTestingBuiltWithOrchestrion github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentTestingBuiltWithOrchestrion
func __dd_civisibility_instrumentTestingBuiltWithOrchestrion()
//go:linkname __dd_civisibility_instrumentTestingMWithControl github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentTestingMWithControl
func __dd_civisibility_instrumentTestingMWithControl(*M) (bool, func(int) int)
//go:linkname __dd_civisibility_instrumentTestingMAbnormalExitCode github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentTestingMAbnormalExitCode
func __dd_civisibility_instrumentTestingMAbnormalExitCode() int
func init() {
__dd_civisibility_instrumentTestingBuiltWithOrchestrion()
}Record link-time dependencies on:
Prepend statements produced by the following template:
proceed, exitFunc := __dd_civisibility_instrumentTestingMWithControl({{ .Function.Receiver }})
if !proceed {
return exitFunc(1)
}
defer func() {
if panicData := recover(); panicData != nil {
_ = exitFunc(__dd_civisibility_instrumentTestingMAbnormalExitCode())
panic(panicData)
}
{{ .Function.Result 0 }} = exitFunc({{ .Function.Result 0 }})
}()T.Run
All of
- Import path
testing - Function body
- Function declaration
- Function name
Run - Is method of
*testing.T
Introduce new declarations:
//go:linkname __dd_civisibility_instrumentTestingTFunc github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentTestingTFunc
func __dd_civisibility_instrumentTestingTFunc(func(*T)) func(*T)
//go:linkname __dd_civisibility_instrumentSetErrorInfo github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentSetErrorInfo
func __dd_civisibility_instrumentSetErrorInfo(tb TB, errType string, errMessage string, skip int)
//go:linkname __dd_civisibility_instrumentCaptureFormattedError github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentCaptureFormattedError
func __dd_civisibility_instrumentCaptureFormattedError(tb TB, errType string, errMessage string, skip int) string
//go:linkname __dd_civisibility_instrumentCaptureFormattedSkip github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentCaptureFormattedSkip
func __dd_civisibility_instrumentCaptureFormattedSkip(tb TB, skipType string, skipReason string) string
//go:linkname __dd_civisibility_instrumentCloseAndSkip github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentCloseAndSkip
func __dd_civisibility_instrumentCloseAndSkip(tb TB, skipReason string)
//go:linkname __dd_civisibility_instrumentSkipNow github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentSkipNow
func __dd_civisibility_instrumentSkipNow(tb TB)
//go:linkname __dd_civisibility_instrumentTestingParallel github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentTestingParallel
func __dd_civisibility_instrumentTestingParallel(t *T) boolRecord link-time dependencies on:
Prepend statements produced by the following template:
{{ .Function.Argument 1 }} = __dd_civisibility_instrumentTestingTFunc({{ .Function.Argument 1 }})B.Run
All of
- Import path
testing - Function body
- Function declaration
- Function name
Run - Is method of
*testing.B
Introduce new declarations:
//go:linkname __dd_civisibility_instrumentTestingBFunc github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentTestingBFunc
func __dd_civisibility_instrumentTestingBFunc(*B, string, func(*B)) (string, func(*B))Record link-time dependencies on:
Prepend statements produced by the following template:
{{ .Function.Argument 0 }}, {{ .Function.Argument 1 }} = __dd_civisibility_instrumentTestingBFunc({{ .Function.Receiver }}, {{ .Function.Argument 0 }}, {{ .Function.Argument 1 }})common.Fail
All of
- Import path
testing - Function body
- Function declaration
- Function name
Fail - Is method of
*testing.common
Prepend statements produced by the following template:
__dd_civisibility_instrumentSetErrorInfo({{ .Function.Receiver }}, "Fail", "failed test", 0)common.FailNow
All of
- Import path
testing - Function body
- Function declaration
- Function name
FailNow - Is method of
*testing.common
Prepend statements produced by the following template:
__dd_civisibility_instrumentSetErrorInfo({{ .Function.Receiver }}, "FailNow", "failed test", 0)common.formatted-sprintln
All of
- Import path
testing - Call to
fmt.Sprintln
Replace the expression using the template:
{{- $name := .Function.Name -}}
{{- if or (eq $name "Error") (eq $name "Fatal") -}}
__dd_civisibility_instrumentCaptureFormattedError({{ .Function.Receiver }}, {{ printf "%q" $name }}, {{ . }}, 0)
{{- else if eq $name "Skip" -}}
__dd_civisibility_instrumentCaptureFormattedSkip({{ .Function.Receiver }}, {{ printf "%q" $name }}, {{ . }})
{{- else -}}
{{ . }}
{{- end -}}common.formatted-sprintf
All of
- Import path
testing - Call to
fmt.Sprintf
Replace the expression using the template:
{{- $name := .Function.Name -}}
{{- if or (eq $name "Errorf") (eq $name "Fatalf") -}}
__dd_civisibility_instrumentCaptureFormattedError({{ .Function.Receiver }}, {{ printf "%q" $name }}, {{ . }}, 0)
{{- else if eq $name "Skipf" -}}
__dd_civisibility_instrumentCaptureFormattedSkip({{ .Function.Receiver }}, {{ printf "%q" $name }}, {{ . }})
{{- else -}}
{{ . }}
{{- end -}}common.SkipNow
All of
- Import path
testing - Function body
- Function declaration
- Function name
SkipNow - Is method of
*testing.common
Prepend statements produced by the following template:
__dd_civisibility_instrumentSkipNow({{ .Function.Receiver }})common.Parallel
All of
- Import path
testing - Function body
- Function declaration
- Function name
Parallel - Is method of
*testing.T
Prepend statements produced by the following template:
if __dd_civisibility_instrumentTestingParallel({{ .Function.Receiver }}) {
return
}testify.suite.Run
All of
- Import path
github.com/stretchr/ testify/ suite - Function body
- Function declaration
- Function name
Run - Signature matches
- Arguments
- Results None
Introduce new declarations:
// Using the following synthetic imports:
import (
testing "testing"
)//go:linkname __dd_civisibility_instrumentTestifySuiteRun github.com/DataDog/dd-trace-go/v2/internal/civisibility/integrations/gotesting.instrumentTestifySuiteRun
func __dd_civisibility_instrumentTestifySuiteRun(*testing.T, interface{})Record link-time dependencies on:
Prepend statements produced by the following template:
__dd_civisibility_instrumentTestifySuiteRun({{ .Function.Argument 0 }}, {{ .Function.Argument 1 }})