testing

Testing instrumentation

Instrument testing.M.Run

Join Point
All of
  • Import path testing
  • Function body
    • Function declaration
Advice
Introduce new declarations:
//go:linkname __dd_civisibility_instrumentTestingM gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/integrations/gotesting.instrumentTestingM
func __dd_civisibility_instrumentTestingM(*M) func(int)
Record link-time dependencies on:
Advice
Prepend statements produced by the following template:
exitFunc := __dd_civisibility_instrumentTestingM({{ .Function.Receiver }})
defer exitFunc({{ .Function.Receiver }}.exitCode)

Instrument testing.T.Run

Join Point
All of
  • Import path testing
  • Function body
    • Function declaration
Advice
Introduce new declarations:
//go:linkname __dd_civisibility_instrumentTestingTFunc gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/integrations/gotesting.instrumentTestingTFunc
func __dd_civisibility_instrumentTestingTFunc(func(*T)) func(*T)

//go:linkname __dd_civisibility_instrumentSetErrorInfo gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/integrations/gotesting.instrumentSetErrorInfo
func __dd_civisibility_instrumentSetErrorInfo(tb TB, errType string, errMessage string, skip int)

//go:linkname __dd_civisibility_instrumentCloseAndSkip gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/integrations/gotesting.instrumentCloseAndSkip
func __dd_civisibility_instrumentCloseAndSkip(tb TB, skipReason string)

//go:linkname __dd_civisibility_instrumentSkipNow gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/integrations/gotesting.instrumentSkipNow
func __dd_civisibility_instrumentSkipNow(tb TB)

//go:linkname __dd_civisibility_ExitCiVisibility gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/integrations.ExitCiVisibility
func __dd_civisibility_ExitCiVisibility()
Record link-time dependencies on:
Advice
Prepend statements produced by the following template:
{{ .Function.Argument 1 }} = __dd_civisibility_instrumentTestingTFunc({{ .Function.Argument 1 }})

Instrument testing.B.Run

Join Point
All of
  • Import path testing
  • Function body
    • Function declaration
Advice
Introduce new declarations:
//go:linkname __dd_civisibility_instrumentTestingBFunc gopkg.in/DataDog/dd-trace-go.v1/internal/civisibility/integrations/gotesting.instrumentTestingBFunc
func __dd_civisibility_instrumentTestingBFunc(*B, string, func(*B)) (string, func(*B))
Record link-time dependencies on:
Advice
Prepend statements produced by the following template:
{{ .Function.Argument 0 }}, {{ .Function.Argument 1 }} = __dd_civisibility_instrumentTestingBFunc({{ .Function.Receiver }}, {{ .Function.Argument 0 }}, {{ .Function.Argument 1 }})

Instrument testing.common.Fail

Join Point
All of
Advice
Prepend statements produced by the following template:
__dd_civisibility_instrumentSetErrorInfo({{ .Function.Receiver }}, "Fail", "failed test", 0)

Instrument testing.common.FailNow

Join Point
All of
Advice
Prepend statements produced by the following template:
__dd_civisibility_instrumentSetErrorInfo({{ .Function.Receiver }}, "FailNow", "failed test", 0)
__dd_civisibility_ExitCiVisibility()

Instrument testing.common.Error

Join Point
All of
Advice
Prepend statements produced by the following template:
// Using the following synthetic imports:
import (
	fmt "fmt"
)
__dd_civisibility_instrumentSetErrorInfo({{ .Function.Receiver }}, "Error", fmt.Sprint({{ .Function.Argument 0 }}...), 0)

Instrument testing.common.Errorf

Join Point
All of
Advice
Prepend statements produced by the following template:
// Using the following synthetic imports:
import (
	fmt "fmt"
)
__dd_civisibility_instrumentSetErrorInfo({{ .Function.Receiver }}, "Errorf", fmt.Sprintf({{ .Function.Argument 0 }}, {{ .Function.Argument 1 }}...), 0)

Instrument testing.common.Fatal

Join Point
All of
Advice
Prepend statements produced by the following template:
// Using the following synthetic imports:
import (
	fmt "fmt"
)
__dd_civisibility_instrumentSetErrorInfo({{ .Function.Receiver }}, "Fatal", fmt.Sprint({{ .Function.Argument 0 }}...), 0)

Instrument testing.common.Fatalf

Join Point
All of
Advice
Prepend statements produced by the following template:
// Using the following synthetic imports:
import (
	fmt "fmt"
)
__dd_civisibility_instrumentSetErrorInfo({{ .Function.Receiver }}, "Fatalf", fmt.Sprintf({{ .Function.Argument 0 }}, {{ .Function.Argument 1 }}...), 0)

Instrument testing.common.Skip

Join Point
All of
Advice
Prepend statements produced by the following template:
// Using the following synthetic imports:
import (
	fmt "fmt"
)
__dd_civisibility_instrumentCloseAndSkip({{ .Function.Receiver }}, fmt.Sprint({{ .Function.Argument 0 }}...))

Instrument testing.common.Skipf

Join Point
All of
Advice
Prepend statements produced by the following template:
// Using the following synthetic imports:
import (
	fmt "fmt"
)
__dd_civisibility_instrumentCloseAndSkip({{ .Function.Receiver }}, fmt.Sprintf({{ .Function.Argument 0 }}, {{ .Function.Argument 1 }}...))

Instrument testing.common.SkipNow

Join Point
All of
Advice
Prepend statements produced by the following template:
__dd_civisibility_instrumentSkipNow({{ .Function.Receiver }})