def canRunLibcxxTests(): from lldbsuite.test import lldbplatformutil platform = lldbplatformutil.getPlatform() if lldbplatformutil.target_is_android( ) or lldbplatformutil.platformIsDarwin(): return True, "libc++ always present" if platform == "linux": with tempfile.NamedTemporaryFile() as f: cmd = [ configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-" ] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) _, stderr = p.communicate("#include <cassert>\nint main() {}") if not p.returncode: return True, "Compiling with -stdlib=libc++ works" return False, "Compiling with -stdlib=libc++ fails with the error: %s" % stderr return False, "Don't know how to build with libc++ on %s" % platform
def canRunLibstdcxxTests(): from lldbsuite.test import lldbplatformutil platform = lldbplatformutil.getPlatform() if lldbplatformutil.target_is_android(): platform = "android" if platform == "linux": return True, "libstdcxx always present" return False, "Don't know how to build with libstdcxx on %s" % platform
def canRunLibcxxTests(): from lldbsuite.test import lldbplatformutil platform = lldbplatformutil.getPlatform() if lldbplatformutil.target_is_android() or lldbplatformutil.platformIsDarwin(): return True, "libc++ always present" if platform == "linux": if not os.path.isdir("/usr/include/c++/v1"): return False, "Unable to find libc++ installation" return True, "Headers found, let's hope they work" return False, "Don't know how to build with libc++ on %s" % platform
def skipUnlessTargetAndroid(func): return unittest2.skipUnless(lldbplatformutil.target_is_android(), "requires target to be Android")(func)
def skipIfTargetAndroid(func): return unittest2.skipIf(lldbplatformutil.target_is_android(), "skip on target Android")(func)