@@ -197,15 +197,17 @@ def _decorateTest(
197
197
):
198
198
def fn (self ):
199
199
skip_for_os = _match_decorator_property (
200
- lldbplatform .translate (oslist ), self .getPlatform ()
200
+ lldbplatform .translate (oslist ), lldbplatformutil .getPlatform ()
201
201
)
202
202
skip_for_hostos = _match_decorator_property (
203
203
lldbplatform .translate (hostoslist ), lldbplatformutil .getHostPlatform ()
204
204
)
205
205
skip_for_compiler = _match_decorator_property (
206
- compiler , self .getCompiler ()
207
- ) and self .expectedCompilerVersion (compiler_version )
208
- skip_for_arch = _match_decorator_property (archs , self .getArchitecture ())
206
+ compiler , lldbplatformutil .getCompiler ()
207
+ ) and lldbplatformutil .expectedCompilerVersion (compiler_version )
208
+ skip_for_arch = _match_decorator_property (
209
+ archs , lldbplatformutil .getArchitecture ()
210
+ )
209
211
skip_for_debug_info = _match_decorator_property (debug_info , self .getDebugInfo ())
210
212
skip_for_triple = _match_decorator_property (
211
213
triple , lldb .selected_platform .GetTriple ()
@@ -236,7 +238,7 @@ def fn(self):
236
238
)
237
239
skip_for_dwarf_version = (dwarf_version is None ) or (
238
240
_check_expected_version (
239
- dwarf_version [0 ], dwarf_version [1 ], self .getDwarfVersion ()
241
+ dwarf_version [0 ], dwarf_version [1 ], lldbplatformutil .getDwarfVersion ()
240
242
)
241
243
)
242
244
skip_for_setting = (setting is None ) or (setting in configuration .settings )
@@ -375,7 +377,9 @@ def skipIf(
375
377
def _skip_for_android (reason , api_levels , archs ):
376
378
def impl (obj ):
377
379
result = lldbplatformutil .match_android_device (
378
- obj .getArchitecture (), valid_archs = archs , valid_api_levels = api_levels
380
+ lldbplatformutil .getArchitecture (),
381
+ valid_archs = archs ,
382
+ valid_api_levels = api_levels ,
379
383
)
380
384
return reason if result else None
381
385
@@ -537,7 +541,10 @@ def wrapper(*args, **kwargs):
537
541
538
542
def expectedFlakeyOS (oslist , bugnumber = None , compilers = None ):
539
543
def fn (self ):
540
- return self .getPlatform () in oslist and self .expectedCompiler (compilers )
544
+ return (
545
+ lldbplatformutil .getPlatform () in oslist
546
+ and lldbplatformutil .expectedCompiler (compilers )
547
+ )
541
548
542
549
return expectedFlakey (fn , bugnumber )
543
550
@@ -618,9 +625,11 @@ def are_sb_headers_missing():
618
625
def skipIfRosetta (bugnumber ):
619
626
"""Skip a test when running the testsuite on macOS under the Rosetta translation layer."""
620
627
621
- def is_running_rosetta (self ):
628
+ def is_running_rosetta ():
622
629
if lldbplatformutil .getPlatform () in ["darwin" , "macosx" ]:
623
- if (platform .uname ()[5 ] == "arm" ) and (self .getArchitecture () == "x86_64" ):
630
+ if (platform .uname ()[5 ] == "arm" ) and (
631
+ lldbplatformutil .getArchitecture () == "x86_64"
632
+ ):
624
633
return "skipped under Rosetta"
625
634
return None
626
635
@@ -694,7 +703,7 @@ def skipIfWindows(func):
694
703
def skipIfWindowsAndNonEnglish (func ):
695
704
"""Decorate the item to skip tests that should be skipped on non-English locales on Windows."""
696
705
697
- def is_Windows_NonEnglish (self ):
706
+ def is_Windows_NonEnglish ():
698
707
if sys .platform != "win32" :
699
708
return None
700
709
kernel = ctypes .windll .kernel32
@@ -724,11 +733,15 @@ def skipUnlessTargetAndroid(func):
724
733
def skipIfHostIncompatibleWithRemote (func ):
725
734
"""Decorate the item to skip tests if binaries built on this host are incompatible."""
726
735
727
- def is_host_incompatible_with_remote (self ):
728
- host_arch = self . getLldbArchitecture ()
736
+ def is_host_incompatible_with_remote ():
737
+ host_arch = lldbplatformutil . getLLDBArchitecture ()
729
738
host_platform = lldbplatformutil .getHostPlatform ()
730
- target_arch = self .getArchitecture ()
731
- target_platform = "darwin" if self .platformIsDarwin () else self .getPlatform ()
739
+ target_arch = lldbplatformutil .getArchitecture ()
740
+ target_platform = (
741
+ "darwin"
742
+ if lldbplatformutil .platformIsDarwin ()
743
+ else lldbplatformutil .getPlatform ()
744
+ )
732
745
if (
733
746
not (target_arch == "x86_64" and host_arch == "i386" )
734
747
and host_arch != target_arch
@@ -771,8 +784,8 @@ def skipUnlessPlatform(oslist):
771
784
def skipUnlessArch (arch ):
772
785
"""Decorate the item to skip tests unless running on the specified architecture."""
773
786
774
- def arch_doesnt_match (self ):
775
- target_arch = self .getArchitecture ()
787
+ def arch_doesnt_match ():
788
+ target_arch = lldbplatformutil .getArchitecture ()
776
789
if arch != target_arch :
777
790
return "Test only runs on " + arch + ", but target arch is " + target_arch
778
791
return None
@@ -797,8 +810,8 @@ def skipIfTargetAndroid(bugnumber=None, api_levels=None, archs=None):
797
810
def skipUnlessAppleSilicon (func ):
798
811
"""Decorate the item to skip tests unless running on Apple Silicon."""
799
812
800
- def not_apple_silicon (test ):
801
- if platform .system () != "Darwin" or test .getArchitecture () not in [
813
+ def not_apple_silicon ():
814
+ if platform .system () != "Darwin" or lldbplatformutil .getArchitecture () not in [
802
815
"arm64" ,
803
816
"arm64e" ,
804
817
]:
@@ -811,10 +824,10 @@ def not_apple_silicon(test):
811
824
def skipUnlessSupportedTypeAttribute (attr ):
812
825
"""Decorate the item to skip test unless Clang supports type __attribute__(attr)."""
813
826
814
- def compiler_doesnt_support_struct_attribute (self ):
815
- compiler_path = self .getCompiler ()
827
+ def compiler_doesnt_support_struct_attribute ():
828
+ compiler_path = lldbplatformutil .getCompiler ()
816
829
f = tempfile .NamedTemporaryFile ()
817
- cmd = [self .getCompiler (), "-x" , "c++" , "-c" , "-o" , f .name , "-" ]
830
+ cmd = [lldbplatformutil .getCompiler (), "-x" , "c++" , "-c" , "-o" , f .name , "-" ]
818
831
p = subprocess .Popen (
819
832
cmd ,
820
833
stdin = subprocess .PIPE ,
@@ -833,8 +846,8 @@ def compiler_doesnt_support_struct_attribute(self):
833
846
def skipUnlessHasCallSiteInfo (func ):
834
847
"""Decorate the function to skip testing unless call site info from clang is available."""
835
848
836
- def is_compiler_clang_with_call_site_info (self ):
837
- compiler_path = self .getCompiler ()
849
+ def is_compiler_clang_with_call_site_info ():
850
+ compiler_path = lldbplatformutil .getCompiler ()
838
851
compiler = os .path .basename (compiler_path )
839
852
if not compiler .startswith ("clang" ):
840
853
return "Test requires clang as compiler"
@@ -861,18 +874,21 @@ def is_compiler_clang_with_call_site_info(self):
861
874
def skipUnlessThreadSanitizer (func ):
862
875
"""Decorate the item to skip test unless Clang -fsanitize=thread is supported."""
863
876
864
- def is_compiler_clang_with_thread_sanitizer (self ):
877
+ def is_compiler_clang_with_thread_sanitizer ():
865
878
if is_running_under_asan ():
866
879
return "Thread sanitizer tests are disabled when runing under ASAN"
867
880
868
- compiler_path = self .getCompiler ()
881
+ compiler_path = lldbplatformutil .getCompiler ()
869
882
compiler = os .path .basename (compiler_path )
870
883
if not compiler .startswith ("clang" ):
871
884
return "Test requires clang as compiler"
872
885
if lldbplatformutil .getPlatform () == "windows" :
873
886
return "TSAN tests not compatible with 'windows'"
874
887
# rdar://28659145 - TSAN tests don't look like they're supported on i386
875
- if self .getArchitecture () == "i386" and platform .system () == "Darwin" :
888
+ if (
889
+ lldbplatformutil .getArchitecture () == "i386"
890
+ and platform .system () == "Darwin"
891
+ ):
876
892
return "TSAN tests not compatible with i386 targets"
877
893
if not _compiler_supports (compiler_path , "-fsanitize=thread" ):
878
894
return "Compiler cannot compile with -fsanitize=thread"
@@ -884,7 +900,7 @@ def is_compiler_clang_with_thread_sanitizer(self):
884
900
def skipUnlessUndefinedBehaviorSanitizer (func ):
885
901
"""Decorate the item to skip test unless -fsanitize=undefined is supported."""
886
902
887
- def is_compiler_clang_with_ubsan (self ):
903
+ def is_compiler_clang_with_ubsan ():
888
904
if is_running_under_asan ():
889
905
return (
890
906
"Undefined behavior sanitizer tests are disabled when runing under ASAN"
@@ -895,7 +911,7 @@ def is_compiler_clang_with_ubsan(self):
895
911
896
912
# Try to compile with ubsan turned on.
897
913
if not _compiler_supports (
898
- self .getCompiler (),
914
+ lldbplatformutil .getCompiler (),
899
915
"-fsanitize=undefined" ,
900
916
"int main() { int x = 0; return x / x; }" ,
901
917
outputf ,
@@ -910,7 +926,10 @@ def is_compiler_clang_with_ubsan(self):
910
926
911
927
# Find the ubsan dylib.
912
928
# FIXME: This check should go away once compiler-rt gains support for __ubsan_on_report.
913
- cmd = "%s -fsanitize=undefined -x c - -o - -### 2>&1" % self .getCompiler ()
929
+ cmd = (
930
+ "%s -fsanitize=undefined -x c - -o - -### 2>&1"
931
+ % lldbplatformutil .getCompiler ()
932
+ )
914
933
with os .popen (cmd ) as cc_output :
915
934
driver_jobs = cc_output .read ()
916
935
m = re .search (r'"([^"]+libclang_rt.ubsan_osx_dynamic.dylib)"' , driver_jobs )
@@ -942,7 +961,7 @@ def is_running_under_asan():
942
961
def skipUnlessAddressSanitizer (func ):
943
962
"""Decorate the item to skip test unless Clang -fsanitize=thread is supported."""
944
963
945
- def is_compiler_with_address_sanitizer (self ):
964
+ def is_compiler_with_address_sanitizer ():
946
965
# Also don't run tests that use address sanitizer inside an
947
966
# address-sanitized LLDB. The tests don't support that
948
967
# configuration.
@@ -951,7 +970,7 @@ def is_compiler_with_address_sanitizer(self):
951
970
952
971
if lldbplatformutil .getPlatform () == "windows" :
953
972
return "ASAN tests not compatible with 'windows'"
954
- if not _compiler_supports (self .getCompiler (), "-fsanitize=address" ):
973
+ if not _compiler_supports (lldbplatformutil .getCompiler (), "-fsanitize=address" ):
955
974
return "Compiler cannot compile with -fsanitize=address"
956
975
return None
957
976
@@ -966,8 +985,8 @@ def skipIfAsan(func):
966
985
def skipUnlessAArch64MTELinuxCompiler (func ):
967
986
"""Decorate the item to skip test unless MTE is supported by the test compiler."""
968
987
969
- def is_toolchain_with_mte (self ):
970
- compiler_path = self .getCompiler ()
988
+ def is_toolchain_with_mte ():
989
+ compiler_path = lldbplatformutil .getCompiler ()
971
990
compiler = os .path .basename (compiler_path )
972
991
f = tempfile .NamedTemporaryFile ()
973
992
if lldbplatformutil .getPlatform () == "windows" :
@@ -1053,7 +1072,7 @@ def skipIfLLVMTargetMissing(target):
1053
1072
1054
1073
# Call sysctl on darwin to see if a specified hardware feature is available on this machine.
1055
1074
def skipUnlessFeature (feature ):
1056
- def is_feature_enabled (self ):
1075
+ def is_feature_enabled ():
1057
1076
if platform .system () == "Darwin" :
1058
1077
try :
1059
1078
DEVNULL = open (os .devnull , "w" )
0 commit comments