@@ -200,15 +200,17 @@ def _decorateTest(
200
200
):
201
201
def fn (self ):
202
202
skip_for_os = _match_decorator_property (
203
- lldbplatform .translate (oslist ), self .getPlatform ()
203
+ lldbplatform .translate (oslist ), lldbplatformutil .getPlatform ()
204
204
)
205
205
skip_for_hostos = _match_decorator_property (
206
206
lldbplatform .translate (hostoslist ), lldbplatformutil .getHostPlatform ()
207
207
)
208
208
skip_for_compiler = _match_decorator_property (
209
- compiler , self .getCompiler ()
210
- ) and self .expectedCompilerVersion (compiler_version )
211
- skip_for_arch = _match_decorator_property (archs , self .getArchitecture ())
209
+ compiler , lldbplatformutil .getCompiler ()
210
+ ) and lldbplatformutil .expectedCompilerVersion (compiler_version )
211
+ skip_for_arch = _match_decorator_property (
212
+ archs , lldbplatformutil .getArchitecture ()
213
+ )
212
214
skip_for_debug_info = _match_decorator_property (debug_info , self .getDebugInfo ())
213
215
skip_for_triple = _match_decorator_property (
214
216
triple , lldb .selected_platform .GetTriple ()
@@ -241,7 +243,7 @@ def fn(self):
241
243
)
242
244
skip_for_dwarf_version = (dwarf_version is None ) or (
243
245
_check_expected_version (
244
- dwarf_version [0 ], dwarf_version [1 ], self .getDwarfVersion ()
246
+ dwarf_version [0 ], dwarf_version [1 ], lldbplatformutil .getDwarfVersion ()
245
247
)
246
248
)
247
249
skip_for_setting = (setting is None ) or (setting in configuration .settings )
@@ -380,7 +382,9 @@ def skipIf(
380
382
def _skip_for_android (reason , api_levels , archs ):
381
383
def impl (obj ):
382
384
result = lldbplatformutil .match_android_device (
383
- obj .getArchitecture (), valid_archs = archs , valid_api_levels = api_levels
385
+ lldbplatformutil .getArchitecture (),
386
+ valid_archs = archs ,
387
+ valid_api_levels = api_levels ,
384
388
)
385
389
return reason if result else None
386
390
@@ -542,7 +546,10 @@ def wrapper(*args, **kwargs):
542
546
543
547
def expectedFlakeyOS (oslist , bugnumber = None , compilers = None ):
544
548
def fn (self ):
545
- return self .getPlatform () in oslist and self .expectedCompiler (compilers )
549
+ return (
550
+ lldbplatformutil .getPlatform () in oslist
551
+ and lldbplatformutil .expectedCompiler (compilers )
552
+ )
546
553
547
554
return expectedFlakey (fn , bugnumber )
548
555
@@ -623,9 +630,11 @@ def are_sb_headers_missing():
623
630
def skipIfRosetta (bugnumber ):
624
631
"""Skip a test when running the testsuite on macOS under the Rosetta translation layer."""
625
632
626
- def is_running_rosetta (self ):
633
+ def is_running_rosetta ():
627
634
if lldbplatformutil .getPlatform () in ["darwin" , "macosx" ]:
628
- if (platform .uname ()[5 ] == "arm" ) and (self .getArchitecture () == "x86_64" ):
635
+ if (platform .uname ()[5 ] == "arm" ) and (
636
+ lldbplatformutil .getArchitecture () == "x86_64"
637
+ ):
629
638
return "skipped under Rosetta"
630
639
return None
631
640
@@ -699,7 +708,7 @@ def skipIfWindows(func):
699
708
def skipIfWindowsAndNonEnglish (func ):
700
709
"""Decorate the item to skip tests that should be skipped on non-English locales on Windows."""
701
710
702
- def is_Windows_NonEnglish (self ):
711
+ def is_Windows_NonEnglish ():
703
712
if sys .platform != "win32" :
704
713
return None
705
714
kernel = ctypes .windll .kernel32
@@ -763,11 +772,15 @@ def is_not_swift_compatible(self):
763
772
def skipIfHostIncompatibleWithRemote (func ):
764
773
"""Decorate the item to skip tests if binaries built on this host are incompatible."""
765
774
766
- def is_host_incompatible_with_remote (self ):
767
- host_arch = self . getLldbArchitecture ()
775
+ def is_host_incompatible_with_remote ():
776
+ host_arch = lldbplatformutil . getLLDBArchitecture ()
768
777
host_platform = lldbplatformutil .getHostPlatform ()
769
- target_arch = self .getArchitecture ()
770
- target_platform = "darwin" if self .platformIsDarwin () else self .getPlatform ()
778
+ target_arch = lldbplatformutil .getArchitecture ()
779
+ target_platform = (
780
+ "darwin"
781
+ if lldbplatformutil .platformIsDarwin ()
782
+ else lldbplatformutil .getPlatform ()
783
+ )
771
784
if (
772
785
not (target_arch == "x86_64" and host_arch == "i386" )
773
786
and host_arch != target_arch
@@ -810,8 +823,8 @@ def skipUnlessPlatform(oslist):
810
823
def skipUnlessArch (arch ):
811
824
"""Decorate the item to skip tests unless running on the specified architecture."""
812
825
813
- def arch_doesnt_match (self ):
814
- target_arch = self .getArchitecture ()
826
+ def arch_doesnt_match ():
827
+ target_arch = lldbplatformutil .getArchitecture ()
815
828
if arch != target_arch :
816
829
return "Test only runs on " + arch + ", but target arch is " + target_arch
817
830
return None
@@ -836,8 +849,8 @@ def skipIfTargetAndroid(bugnumber=None, api_levels=None, archs=None):
836
849
def skipUnlessAppleSilicon (func ):
837
850
"""Decorate the item to skip tests unless running on Apple Silicon."""
838
851
839
- def not_apple_silicon (test ):
840
- if platform .system () != "Darwin" or test .getArchitecture () not in [
852
+ def not_apple_silicon ():
853
+ if platform .system () != "Darwin" or lldbplatformutil .getArchitecture () not in [
841
854
"arm64" ,
842
855
"arm64e" ,
843
856
]:
@@ -850,10 +863,10 @@ def not_apple_silicon(test):
850
863
def skipUnlessSupportedTypeAttribute (attr ):
851
864
"""Decorate the item to skip test unless Clang supports type __attribute__(attr)."""
852
865
853
- def compiler_doesnt_support_struct_attribute (self ):
854
- compiler_path = self .getCompiler ()
866
+ def compiler_doesnt_support_struct_attribute ():
867
+ compiler_path = lldbplatformutil .getCompiler ()
855
868
f = tempfile .NamedTemporaryFile ()
856
- cmd = [self .getCompiler (), "-x" , "c++" , "-c" , "-o" , f .name , "-" ]
869
+ cmd = [lldbplatformutil .getCompiler (), "-x" , "c++" , "-c" , "-o" , f .name , "-" ]
857
870
p = subprocess .Popen (
858
871
cmd ,
859
872
stdin = subprocess .PIPE ,
@@ -872,8 +885,8 @@ def compiler_doesnt_support_struct_attribute(self):
872
885
def skipUnlessHasCallSiteInfo (func ):
873
886
"""Decorate the function to skip testing unless call site info from clang is available."""
874
887
875
- def is_compiler_clang_with_call_site_info (self ):
876
- compiler_path = self .getCompiler ()
888
+ def is_compiler_clang_with_call_site_info ():
889
+ compiler_path = lldbplatformutil .getCompiler ()
877
890
compiler = os .path .basename (compiler_path )
878
891
if not compiler .startswith ("clang" ):
879
892
return "Test requires clang as compiler"
@@ -900,18 +913,21 @@ def is_compiler_clang_with_call_site_info(self):
900
913
def skipUnlessThreadSanitizer (func ):
901
914
"""Decorate the item to skip test unless Clang -fsanitize=thread is supported."""
902
915
903
- def is_compiler_clang_with_thread_sanitizer (self ):
916
+ def is_compiler_clang_with_thread_sanitizer ():
904
917
if is_running_under_asan ():
905
918
return "Thread sanitizer tests are disabled when runing under ASAN"
906
919
907
- compiler_path = self .getCompiler ()
920
+ compiler_path = lldbplatformutil .getCompiler ()
908
921
compiler = os .path .basename (compiler_path )
909
922
if not compiler .startswith ("clang" ):
910
923
return "Test requires clang as compiler"
911
924
if lldbplatformutil .getPlatform () == "windows" :
912
925
return "TSAN tests not compatible with 'windows'"
913
926
# rdar://28659145 - TSAN tests don't look like they're supported on i386
914
- if self .getArchitecture () == "i386" and platform .system () == "Darwin" :
927
+ if (
928
+ lldbplatformutil .getArchitecture () == "i386"
929
+ and platform .system () == "Darwin"
930
+ ):
915
931
return "TSAN tests not compatible with i386 targets"
916
932
if not _compiler_supports (compiler_path , "-fsanitize=thread" ):
917
933
return "Compiler cannot compile with -fsanitize=thread"
@@ -923,7 +939,7 @@ def is_compiler_clang_with_thread_sanitizer(self):
923
939
def skipUnlessUndefinedBehaviorSanitizer (func ):
924
940
"""Decorate the item to skip test unless -fsanitize=undefined is supported."""
925
941
926
- def is_compiler_clang_with_ubsan (self ):
942
+ def is_compiler_clang_with_ubsan ():
927
943
if is_running_under_asan ():
928
944
return (
929
945
"Undefined behavior sanitizer tests are disabled when runing under ASAN"
@@ -934,7 +950,7 @@ def is_compiler_clang_with_ubsan(self):
934
950
935
951
# Try to compile with ubsan turned on.
936
952
if not _compiler_supports (
937
- self .getCompiler (),
953
+ lldbplatformutil .getCompiler (),
938
954
"-fsanitize=undefined" ,
939
955
"int main() { int x = 0; return x / x; }" ,
940
956
outputf ,
@@ -949,7 +965,10 @@ def is_compiler_clang_with_ubsan(self):
949
965
950
966
# Find the ubsan dylib.
951
967
# FIXME: This check should go away once compiler-rt gains support for __ubsan_on_report.
952
- cmd = "%s -fsanitize=undefined -x c - -o - -### 2>&1" % self .getCompiler ()
968
+ cmd = (
969
+ "%s -fsanitize=undefined -x c - -o - -### 2>&1"
970
+ % lldbplatformutil .getCompiler ()
971
+ )
953
972
with os .popen (cmd ) as cc_output :
954
973
driver_jobs = cc_output .read ()
955
974
m = re .search (r'"([^"]+libclang_rt.ubsan_osx_dynamic.dylib)"' , driver_jobs )
@@ -981,7 +1000,7 @@ def is_running_under_asan():
981
1000
def skipUnlessAddressSanitizer (func ):
982
1001
"""Decorate the item to skip test unless Clang -fsanitize=thread is supported."""
983
1002
984
- def is_compiler_with_address_sanitizer (self ):
1003
+ def is_compiler_with_address_sanitizer ():
985
1004
# Also don't run tests that use address sanitizer inside an
986
1005
# address-sanitized LLDB. The tests don't support that
987
1006
# configuration.
@@ -990,7 +1009,7 @@ def is_compiler_with_address_sanitizer(self):
990
1009
991
1010
if lldbplatformutil .getPlatform () == "windows" :
992
1011
return "ASAN tests not compatible with 'windows'"
993
- if not _compiler_supports (self .getCompiler (), "-fsanitize=address" ):
1012
+ if not _compiler_supports (lldbplatformutil .getCompiler (), "-fsanitize=address" ):
994
1013
return "Compiler cannot compile with -fsanitize=address"
995
1014
return None
996
1015
@@ -1043,8 +1062,8 @@ def skipIfAsan(func):
1043
1062
def skipUnlessAArch64MTELinuxCompiler (func ):
1044
1063
"""Decorate the item to skip test unless MTE is supported by the test compiler."""
1045
1064
1046
- def is_toolchain_with_mte (self ):
1047
- compiler_path = self .getCompiler ()
1065
+ def is_toolchain_with_mte ():
1066
+ compiler_path = lldbplatformutil .getCompiler ()
1048
1067
compiler = os .path .basename (compiler_path )
1049
1068
f = tempfile .NamedTemporaryFile ()
1050
1069
if lldbplatformutil .getPlatform () == "windows" :
@@ -1130,7 +1149,7 @@ def skipIfLLVMTargetMissing(target):
1130
1149
1131
1150
# Call sysctl on darwin to see if a specified hardware feature is available on this machine.
1132
1151
def skipUnlessFeature (feature ):
1133
- def is_feature_enabled (self ):
1152
+ def is_feature_enabled ():
1134
1153
if platform .system () == "Darwin" :
1135
1154
try :
1136
1155
DEVNULL = open (os .devnull , "w" )
0 commit comments