From 5eb14326f0dc236795b1a1015686b2f2c7697f68 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Tue, 14 Apr 2020 10:32:20 -0700 Subject: [PATCH] [build-script] Add sanitizer options to sourcekit-lsp For now, default to no sanitizers. --- utils/build-presets.ini | 20 +++++++++++++++++-- .../build_swift/driver_arguments.py | 3 +++ utils/build_swift/tests/expected_options.py | 3 +++ .../products/sourcekitlsp.py | 3 ++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/utils/build-presets.ini b/utils/build-presets.ini index 5375ccf522152..4a851ac0d9900 100644 --- a/utils/build-presets.ini +++ b/utils/build-presets.ini @@ -1712,18 +1712,34 @@ install-swiftevolve # Test SourceKit-LSP #===------------------------------------------------------------------------===# -[preset: buildbot_sourcekitlsp_macos] +[preset: buildbot_sourcekitlsp_macos,no_sanitize] mixin-preset=mixin_swiftpm_package_macos_platform release assertions sourcekit-lsp -[preset: buildbot_sourcekitlsp_linux] +[preset: buildbot_sourcekitlsp_linux,no_sanitize] mixin-preset=mixin_swiftpm_package_linux_platform release assertions sourcekit-lsp +[preset: buildbot_sourcekitlsp_macos,sanitize] +mixin-preset=buildbot_sourcekitlsp_macos,no_sanitize +test-sourcekit-lsp-sanitize-all + +[preset: buildbot_sourcekitlsp_linux,sanitize] +mixin-preset=buildbot_sourcekitlsp_linux,no_sanitize +test-sourcekit-lsp-sanitize-all + +# Default: no sanitizers +[preset: buildbot_sourcekitlsp_macos] +mixin-preset=buildbot_sourcekitlsp_macos,no_sanitize + +# Default: no sanitizers +[preset: buildbot_sourcekitlsp_linux] +mixin-preset=buildbot_sourcekitlsp_linux,no_sanitize + #===------------------------------------------------------------------------===# # Test IndexStore-DB #===------------------------------------------------------------------------===# diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py index c6588946be7ee..0fdd61854427a 100644 --- a/utils/build_swift/build_swift/driver_arguments.py +++ b/utils/build_swift/build_swift/driver_arguments.py @@ -572,6 +572,9 @@ def create_argument_parser(): help='run indexstore-db tests under all sanitizers') option(['--sourcekit-lsp'], toggle_true('build_sourcekitlsp'), help='build SourceKitLSP') + option('--test-sourcekit-lsp-sanitize-all', + toggle_true('test_sourcekitlsp_sanitize_all'), + help='run sourcekit-lsp tests under all sanitizers') option('--install-swiftsyntax', toggle_true('install_swiftsyntax'), help='install SwiftSyntax') option('--swiftsyntax-verify-generated-files', diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py index 3b3660ed5770e..08daafda65cf0 100644 --- a/utils/build_swift/tests/expected_options.py +++ b/utils/build_swift/tests/expected_options.py @@ -92,6 +92,7 @@ 'build_swiftevolve': False, 'build_indexstoredb': False, 'test_indexstoredb_sanitize_all': False, + 'test_sourcekitlsp_sanitize_all': False, 'build_sourcekitlsp': False, 'install_swiftpm': False, 'install_swiftsyntax': False, @@ -507,6 +508,8 @@ class BuildScriptImplOption(_BaseOption): EnableOption('--test-indexstore-db-sanitize-all', dest='test_indexstoredb_sanitize_all'), EnableOption('--sourcekit-lsp', dest='build_sourcekitlsp'), + EnableOption('--test-sourcekit-lsp-sanitize-all', + dest='test_sourcekitlsp_sanitize_all'), EnableOption('--install-swiftsyntax', dest='install_swiftsyntax'), EnableOption('--swiftsyntax-verify-generated-files', dest='swiftsyntax_verify_generated_files'), diff --git a/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py b/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py index d51e68d6259da..92b121f17a56c 100644 --- a/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py +++ b/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py @@ -35,7 +35,8 @@ def should_test(self, host_target): def test(self, host_target): indexstoredb.run_build_script_helper( - 'test', host_target, self, self.args) + 'test', host_target, self, self.args, + self.args.test_sourcekitlsp_sanitize_all) def should_install(self, host_target): return self.args.install_sourcekitlsp