aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt/test/cfi/lit.cfg.py
diff options
context:
space:
mode:
authorTobias Hieta <tobias@hieta.se>2023-05-17 16:59:41 +0200
committerTobias Hieta <tobias@hieta.se>2023-05-25 11:17:05 +0200
commitf98ee40f4b5d7474fc67e82824bf6abbaedb7b1c (patch)
tree98a310ca2d529f568804993c98d6a301f9f2886e /compiler-rt/test/cfi/lit.cfg.py
parent35ea4e2dbf32b338c14a2facfc603812e78c8239 (diff)
downloadllvm-f98ee40f4b5d7474fc67e82824bf6abbaedb7b1c.zip
llvm-f98ee40f4b5d7474fc67e82824bf6abbaedb7b1c.tar.gz
llvm-f98ee40f4b5d7474fc67e82824bf6abbaedb7b1c.tar.bz2
[NFC][Py Reformat] Reformat python files in the rest of the dirs
This is an ongoing series of commits that are reformatting our Python code. This catches the last of the python files to reformat. Since they where so few I bunched them together. Reformatting is done with `black`. If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run git checkout --ours <yourfile> and then reformat it with black. If you run into any problems, post to discourse about it and we will try to help. RFC Thread below: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Reviewed By: jhenderson, #libc, Mordante, sivachandra Differential Revision: https://reviews.llvm.org/D150784
Diffstat (limited to 'compiler-rt/test/cfi/lit.cfg.py')
-rw-r--r--compiler-rt/test/cfi/lit.cfg.py78
1 files changed, 44 insertions, 34 deletions
diff --git a/compiler-rt/test/cfi/lit.cfg.py b/compiler-rt/test/cfi/lit.cfg.py
index 2f2d1dd..f9afc6b 100644
--- a/compiler-rt/test/cfi/lit.cfg.py
+++ b/compiler-rt/test/cfi/lit.cfg.py
@@ -1,50 +1,60 @@
import lit.formats
import os
-config.name = 'cfi' + config.name_suffix
-config.suffixes = ['.c', '.cpp', '.test']
+config.name = "cfi" + config.name_suffix
+config.suffixes = [".c", ".cpp", ".test"]
config.test_source_root = os.path.dirname(__file__)
+
def build_invocation(compile_flags):
- return " " + " ".join([config.clang] + compile_flags) + " "
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
clang = build_invocation([config.target_cflags])
clangxx = build_invocation([config.target_cflags] + config.cxx_mode_flags)
-config.substitutions.append((r"%clang ", clang + ' '))
-config.substitutions.append((r"%clangxx ", clangxx + ' '))
+config.substitutions.append((r"%clang ", clang + " "))
+config.substitutions.append((r"%clangxx ", clangxx + " "))
-if 'darwin' in config.available_features:
- # -fsanitize=cfi is not supported on Darwin hosts
- config.unsupported = True
+if "darwin" in config.available_features:
+ # -fsanitize=cfi is not supported on Darwin hosts
+ config.unsupported = True
elif config.lto_supported:
- clang_cfi = clang + '-fsanitize=cfi '
-
- if config.cfi_lit_test_mode == "Devirt":
- config.available_features.add('devirt')
- clang_cfi += '-fwhole-program-vtables '
- config.substitutions.append((r"%expect_crash_unless_devirt ", ""))
- else:
- config.substitutions.append((r"%expect_crash_unless_devirt ", config.expect_crash))
-
- cxx = ' '.join(config.cxx_mode_flags) + ' '
- diag = '-fno-sanitize-trap=cfi -fsanitize-recover=cfi '
- non_dso = '-fvisibility=hidden '
- dso = '-fsanitize-cfi-cross-dso -fvisibility=default '
- if config.android:
- dso += '-include ' + config.test_source_root + '/cross-dso/util/cfi_stubs.h '
- config.substitutions.append((r"%clang_cfi ", clang_cfi + non_dso))
- config.substitutions.append((r"%clangxx_cfi ", clang_cfi + cxx + non_dso))
- config.substitutions.append((r"%clang_cfi_diag ", clang_cfi + non_dso + diag))
- config.substitutions.append((r"%clangxx_cfi_diag ", clang_cfi + cxx + non_dso + diag))
- config.substitutions.append((r"%clangxx_cfi_dso ", clang_cfi + cxx + dso))
- config.substitutions.append((r"%clangxx_cfi_dso_diag ", clang_cfi + cxx + dso + diag))
- config.substitutions.append((r"%debug_info_flags", ' '.join(config.debug_info_flags)))
+ clang_cfi = clang + "-fsanitize=cfi "
+
+ if config.cfi_lit_test_mode == "Devirt":
+ config.available_features.add("devirt")
+ clang_cfi += "-fwhole-program-vtables "
+ config.substitutions.append((r"%expect_crash_unless_devirt ", ""))
+ else:
+ config.substitutions.append(
+ (r"%expect_crash_unless_devirt ", config.expect_crash)
+ )
+
+ cxx = " ".join(config.cxx_mode_flags) + " "
+ diag = "-fno-sanitize-trap=cfi -fsanitize-recover=cfi "
+ non_dso = "-fvisibility=hidden "
+ dso = "-fsanitize-cfi-cross-dso -fvisibility=default "
+ if config.android:
+ dso += "-include " + config.test_source_root + "/cross-dso/util/cfi_stubs.h "
+ config.substitutions.append((r"%clang_cfi ", clang_cfi + non_dso))
+ config.substitutions.append((r"%clangxx_cfi ", clang_cfi + cxx + non_dso))
+ config.substitutions.append((r"%clang_cfi_diag ", clang_cfi + non_dso + diag))
+ config.substitutions.append(
+ (r"%clangxx_cfi_diag ", clang_cfi + cxx + non_dso + diag)
+ )
+ config.substitutions.append((r"%clangxx_cfi_dso ", clang_cfi + cxx + dso))
+ config.substitutions.append(
+ (r"%clangxx_cfi_dso_diag ", clang_cfi + cxx + dso + diag)
+ )
+ config.substitutions.append(
+ (r"%debug_info_flags", " ".join(config.debug_info_flags))
+ )
else:
- config.unsupported = True
+ config.unsupported = True
if config.default_sanitizer_opts:
- config.environment['UBSAN_OPTIONS'] = ':'.join(config.default_sanitizer_opts)
+ config.environment["UBSAN_OPTIONS"] = ":".join(config.default_sanitizer_opts)
-if lit_config.params.get('check_supported', None) and config.unsupported:
- raise BaseException("Tests unsupported")
+if lit_config.params.get("check_supported", None) and config.unsupported:
+ raise BaseException("Tests unsupported")