diff options
author | Alberto Donizetti <alb.donizetti@gmail.com> | 2018-10-03 21:11:31 +0200 |
---|---|---|
committer | Alberto Donizetti <alb.donizetti@gmail.com> | 2018-10-04 18:49:32 +0000 |
commit | d2170040617231a26ab0722d093ecb19e2ba8302 (patch) | |
tree | 68e62890fda730b07476a4ebd1c43cb32c9475c8 /src/runtime/runtime-lldb_test.go | |
parent | 6d73537128ad7ff35ba1dbc55fc2837b0989b6b2 (diff) | |
download | go-d2170040617231a26ab0722d093ecb19e2ba8302.tar.gz go-d2170040617231a26ab0722d093ecb19e2ba8302.zip |
runtime: skip TestLldbPython when lldb is too old
The TestLldbPython test is known to fail with very old lldb releases
(3.8 and older). Skip the test when the lldb found on the system is
too old.
Fixes #22299
Change-Id: I8f78d6c0d995118f806dae87f3f04a9726473116
Reviewed-on: https://go-review.googlesource.com/c/139397
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/runtime-lldb_test.go')
-rw-r--r-- | src/runtime/runtime-lldb_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/runtime/runtime-lldb_test.go b/src/runtime/runtime-lldb_test.go index fe3a0eb90d..c74e6ef029 100644 --- a/src/runtime/runtime-lldb_test.go +++ b/src/runtime/runtime-lldb_test.go @@ -10,7 +10,9 @@ import ( "os" "os/exec" "path/filepath" + "regexp" "runtime" + "strconv" "strings" "testing" ) @@ -25,6 +27,27 @@ func checkLldbPython(t *testing.T) { } lldbPath = strings.TrimSpace(string(out)) + // Check lldb version. The test is known to fail with 3.8 or older + // (see Issue #22299). + cmd = exec.Command("lldb", "--version") + out, err = cmd.CombinedOutput() + + // lldb --version should print "lldb version a.b.c" + re := regexp.MustCompile(` ([[:digit:]]+)\.([[:digit:]]+)`) + lldbVersion := re.FindStringSubmatch(string(out)) + if len(lldbVersion) != 3 { + t.Errorf("bad lldb --version output: %s", out) + } + major, err1 := strconv.Atoi(lldbVersion[1]) + minor, err2 := strconv.Atoi(lldbVersion[2]) + if err1 != nil || err2 != nil { + t.Errorf("bad lldb --version output: %s", out) + } + + if (major < 3) || (major == 3 && minor < 9) { + t.Skipf("skipping because lldb version %v.%v is too old (need >= 3.9)", major, minor) + } + cmd = exec.Command("/usr/bin/python2.7", "-c", "import sys;sys.path.append(sys.argv[1]);import lldb; print('go lldb python support')", lldbPath) out, err = cmd.CombinedOutput() |