aboutsummaryrefslogtreecommitdiff
path: root/cmd/callgraph/main_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/callgraph/main_test.go')
-rw-r--r--cmd/callgraph/main_test.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/cmd/callgraph/main_test.go b/cmd/callgraph/main_test.go
index 7e838f774..c8bee87e2 100644
--- a/cmd/callgraph/main_test.go
+++ b/cmd/callgraph/main_test.go
@@ -15,6 +15,7 @@ import (
"log"
"os"
"path/filepath"
+ "runtime"
"strings"
"testing"
@@ -34,8 +35,8 @@ func init() {
}
func TestCallgraph(t *testing.T) {
- if b := os.Getenv("GO_BUILDER_NAME"); b == "windows-arm64-10" {
- t.Skipf("skipping due to suspected file corruption bug on %s builder (https://go.dev/issue/50706)", b)
+ if runtime.GOOS == "windows" && runtime.GOARCH == "arm64" {
+ t.Skipf("skipping due to suspected file corruption bug on windows/arm64 (https://go.dev/issue/50706)")
}
testenv.NeedsTool(t, "go")
@@ -58,6 +59,12 @@ func TestCallgraph(t *testing.T) {
`pkg.main2 --> (pkg.C).f`,
`pkg.main2 --> (pkg.D).f`,
}},
+ {"vta", false, []string{
+ // vta distinguishes main->C, main2->D.
+ "pkg.main --> (pkg.C).f",
+ "pkg.main --> pkg.main2",
+ "pkg.main2 --> (pkg.D).f",
+ }},
{"pta", false, []string{
// pta distinguishes main->C, main2->D. Also has a root node.
`<root> --> pkg.init`,
@@ -74,6 +81,12 @@ func TestCallgraph(t *testing.T) {
`pkg.Example --> (pkg.C).f`,
`pkg.main --> (pkg.C).f`,
}},
+ {"vta", true, []string{
+ `pkg.test.main --> testing.MainStart`,
+ `testing.runExample --> pkg.Example`,
+ `pkg.Example --> (pkg.C).f`,
+ `pkg.main --> (pkg.C).f`,
+ }},
{"pta", true, []string{
`<root> --> pkg.test.main`,
`<root> --> pkg.main`,
@@ -94,13 +107,15 @@ func TestCallgraph(t *testing.T) {
for _, line := range strings.Split(fmt.Sprint(stdout), "\n") {
edges[line] = true
}
+ ok := true
for _, edge := range test.want {
if !edges[edge] {
+ ok = false
t.Errorf("callgraph(%q, %t): missing edge: %s",
test.algo, test.tests, edge)
}
}
- if t.Failed() {
+ if !ok {
t.Log("got:\n", stdout)
}
}