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 @@ -607,6 +607,17 @@ def skipUnlessDarwin(func):
607
607
return skipUnlessPlatform (lldbplatformutil .getDarwinOSTriples ())(func )
608
608
609
609
610
+ def skipUnlessRustInstalled (func ):
611
+ """Decorate the item to skip tests when no Rust compiler is available."""
612
+
613
+ def is_rust_missing (self ):
614
+ compiler = self .getRustCompilerVersion ()
615
+ if not compiler :
616
+ return "skipping because rust compiler not found"
617
+ return None
618
+ return skipTestIfFn (is_rust_missing )(func )
619
+
620
+
610
621
def skipIfHostIncompatibleWithRemote (func ):
611
622
"""Decorate the item to skip tests if binaries built on this host are incompatible."""
612
623
Original file line number Diff line number Diff line change @@ -1300,6 +1300,18 @@ def getDwarfVersion(self):
1300
1300
except : pass
1301
1301
return '0'
1302
1302
1303
+ def getRustCompilerVersion (self ):
1304
+ """ Returns a string that represents the rust compiler version, or None if rust is not found.
1305
+ """
1306
+ compiler = which ("rustc" )
1307
+ if compiler :
1308
+ version_output = system ([[compiler , "--version" ]])[0 ]
1309
+ for line in version_output .split (os .linesep ):
1310
+ m = re .search ('rustc ([0-9\.]+)' , line )
1311
+ if m :
1312
+ return m .group (1 )
1313
+ return None
1314
+
1303
1315
def platformIsDarwin (self ):
1304
1316
"""Returns true if the OS triple for the selected platform is any valid apple OS"""
1305
1317
return lldbplatformutil .platformIsDarwin ()
@@ -1568,6 +1580,11 @@ def buildGModules(
1568
1580
dictionary , testdir , testname ):
1569
1581
raise Exception ("Don't know how to build binary with gmodules" )
1570
1582
1583
+ def buildRust (self ):
1584
+ """Build the default rust binary.
1585
+ """
1586
+ system ([[which ('rustc' ), '-g main.rs' ]])
1587
+
1571
1588
def signBinary (self , binary_path ):
1572
1589
if sys .platform .startswith ("darwin" ):
1573
1590
codesign_cmd = "codesign --force --sign \" %s\" %s" % (
You can’t perform that action at this time.
0 commit comments