This repository was archived by the owner on Apr 23, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
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 @@ -615,6 +615,17 @@ def is_go_missing(self):
615
615
return skipTestIfFn (is_go_missing )(func )
616
616
617
617
618
+ def skipUnlessRustInstalled (func ):
619
+ """Decorate the item to skip tests when no Rust compiler is available."""
620
+
621
+ def is_rust_missing (self ):
622
+ compiler = self .getRustCompilerVersion ()
623
+ if not compiler :
624
+ return "skipping because rust compiler not found"
625
+ return None
626
+ return skipTestIfFn (is_rust_missing )(func )
627
+
628
+
618
629
def skipIfHostIncompatibleWithRemote (func ):
619
630
"""Decorate the item to skip tests if binaries built on this host are incompatible."""
620
631
Original file line number Diff line number Diff line change @@ -1304,6 +1304,18 @@ def getGoCompilerVersion(self):
1304
1304
return m .group (1 )
1305
1305
return None
1306
1306
1307
+ def getRustCompilerVersion (self ):
1308
+ """ Returns a string that represents the rust compiler version, or None if rust is not found.
1309
+ """
1310
+ compiler = which ("rustc" )
1311
+ if compiler :
1312
+ version_output = system ([[compiler , "--version" ]])[0 ]
1313
+ for line in version_output .split (os .linesep ):
1314
+ m = re .search ('rustc ([0-9\.]+)' , line )
1315
+ if m :
1316
+ return m .group (1 )
1317
+ return None
1318
+
1307
1319
def platformIsDarwin (self ):
1308
1320
"""Returns true if the OS triple for the selected platform is any valid apple OS"""
1309
1321
return lldbplatformutil .platformIsDarwin ()
@@ -1575,6 +1587,11 @@ def buildGo(self):
1575
1587
"""
1576
1588
system ([[which ('go' ), 'build -gcflags "-N -l" -o a.out main.go' ]])
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