aboutsummaryrefslogtreecommitdiffstats
path: root/test/Bindings/Go
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-12-01 14:51:49 -0800
committerStephen Hines <srhines@google.com>2014-12-02 16:08:10 -0800
commit37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch)
tree8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /test/Bindings/Go
parentd2327b22152ced7bc46dc629fc908959e8a52d03 (diff)
downloadexternal_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip
external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz
external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'test/Bindings/Go')
-rw-r--r--test/Bindings/Go/go.test3
-rw-r--r--test/Bindings/Go/lit.local.cfg57
2 files changed, 60 insertions, 0 deletions
diff --git a/test/Bindings/Go/go.test b/test/Bindings/Go/go.test
new file mode 100644
index 0000000..3951483
--- /dev/null
+++ b/test/Bindings/Go/go.test
@@ -0,0 +1,3 @@
+; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
+
+; REQUIRES: shell
diff --git a/test/Bindings/Go/lit.local.cfg b/test/Bindings/Go/lit.local.cfg
new file mode 100644
index 0000000..e86595b
--- /dev/null
+++ b/test/Bindings/Go/lit.local.cfg
@@ -0,0 +1,57 @@
+import os
+import pipes
+import shlex
+import sys
+
+if not 'go' in config.root.llvm_bindings:
+ config.unsupported = True
+
+def find_executable(executable, path=None):
+ if path is None:
+ path = os.environ['PATH']
+ paths = path.split(os.pathsep)
+ base, ext = os.path.splitext(executable)
+
+ if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'):
+ executable = executable + '.exe'
+
+ if not os.path.isfile(executable):
+ for p in paths:
+ f = os.path.join(p, executable)
+ if os.path.isfile(f):
+ return f
+ return None
+ else:
+ return executable
+
+# Resolve certain symlinks in the first word of compiler.
+#
+# This is a Go-specific hack. cgo and other Go tools check $CC and $CXX for the
+# substring 'clang' to determine if the compiler is Clang. This won't work if
+# $CC is cc and cc is a symlink pointing to clang, as it is on Darwin.
+#
+# Go tools also have problems with ccache, so we disable it.
+def fixup_compiler_path(compiler):
+ args = shlex.split(compiler)
+ if args[0].endswith('ccache'):
+ args = args[1:]
+
+ path = find_executable(args[0])
+
+ try:
+ if path.endswith('/cc') and os.readlink(path) == 'clang':
+ args[0] = path[:len(path)-2] + 'clang'
+ except (AttributeError, OSError):
+ pass
+
+ try:
+ if path.endswith('/c++') and os.readlink(path) == 'clang++':
+ args[0] = path[:len(path)-3] + 'clang++'
+ except (AttributeError, OSError):
+ pass
+
+ return ' '.join([pipes.quote(arg) for arg in args])
+
+config.environment['CC'] = fixup_compiler_path(config.host_cc)
+config.environment['CXX'] = fixup_compiler_path(config.host_cxx)
+config.environment['CGO_LDFLAGS'] = config.host_ldflags