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