This repository was archived by the owner on May 21, 2019. It is now read-only.
File tree 2 files changed +28
-0
lines changed
packages/Python/lldbsuite/test
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -600,6 +600,17 @@ def skipUnlessDarwin(func):
600
600
return skipUnlessPlatform (lldbplatformutil .getDarwinOSTriples ())(func )
601
601
602
602
603
+ def skipUnlessRustInstalled (func ):
604
+ """Decorate the item to skip tests when no Rust compiler is available."""
605
+
606
+ def is_rust_missing (self ):
607
+ compiler = self .getRustCompilerVersion ()
608
+ if not compiler :
609
+ return "skipping because rust compiler not found"
610
+ return None
611
+ return skipTestIfFn (is_rust_missing )(func )
612
+
613
+
603
614
def skipIfHostIncompatibleWithRemote (func ):
604
615
"""Decorate the item to skip tests if binaries built on this host are incompatible."""
605
616
Original file line number Diff line number Diff line change @@ -1307,6 +1307,18 @@ def getCompilerVersion(self):
1307
1307
version = m .group (1 )
1308
1308
return version
1309
1309
1310
+ def getRustCompilerVersion (self ):
1311
+ """ Returns a string that represents the rust compiler version, or None if rust is not found.
1312
+ """
1313
+ compiler = which ("rustc" )
1314
+ if compiler :
1315
+ version_output = system ([[compiler , "--version" ]])[0 ]
1316
+ for line in version_output .split (os .linesep ):
1317
+ m = re .search ('rustc ([0-9\.]+)' , line )
1318
+ if m :
1319
+ return m .group (1 )
1320
+ return None
1321
+
1310
1322
def platformIsDarwin (self ):
1311
1323
"""Returns true if the OS triple for the selected platform is any valid apple OS"""
1312
1324
return lldbplatformutil .platformIsDarwin ()
@@ -1575,6 +1587,11 @@ def buildGModules(
1575
1587
dictionary , testdir , testname ):
1576
1588
raise Exception ("Don't know how to build binary with gmodules" )
1577
1589
1590
+ def buildRust (self ):
1591
+ """Build the default rust binary.
1592
+ """
1593
+ system ([[which ('rustc' ), '-g main.rs' ]])
1594
+
1578
1595
def signBinary (self , binary_path ):
1579
1596
if sys .platform .startswith ("darwin" ):
1580
1597
codesign_cmd = "codesign --force --sign \" %s\" %s" % (
You can’t perform that action at this time.
0 commit comments