From 2311e1c5ab225989fd4708849b6a8cafeebc93a8 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Mon, 19 Feb 2024 13:28:48 +0100 Subject: [PATCH 1/4] Swift: remove test sdk The test sdk that we were prebuilding to run ql tests is actually not needed, as the `resource-dir` we package for cross-version compatibility is enough for running qltests as well. --- swift/BUILD.bazel | 8 -------- swift/third_party/BUILD.swift-llvm-support.bazel | 9 --------- swift/third_party/swift-llvm-support/BUILD.bazel | 8 -------- swift/tools/qltest.sh | 3 +-- 4 files changed, 1 insertion(+), 27 deletions(-) diff --git a/swift/BUILD.bazel b/swift/BUILD.bazel index 57b828ef350..93d4fd9a7e4 100644 --- a/swift/BUILD.bazel +++ b/swift/BUILD.bazel @@ -75,13 +75,6 @@ pkg_filegroup( visibility = ["//visibility:public"], ) -pkg_files( - name = "swift-test-sdk-arch", - srcs = ["//swift/third_party/swift-llvm-support:swift-test-sdk"], - prefix = "qltest/" + codeql_platform, - strip_prefix = strip_prefix.from_pkg(), -) - pkg_filegroup( name = "extractor-pack-arch", srcs = select({ @@ -89,7 +82,6 @@ pkg_filegroup( "//conditions:default": [ ":extractor", ":resource-dir-arch", - ":swift-test-sdk-arch", ], }) + select({ "@platforms//os:macos": [ diff --git a/swift/third_party/BUILD.swift-llvm-support.bazel b/swift/third_party/BUILD.swift-llvm-support.bazel index 38988d020ef..91337d0aa41 100644 --- a/swift/third_party/BUILD.swift-llvm-support.bazel +++ b/swift/third_party/BUILD.swift-llvm-support.bazel @@ -32,12 +32,3 @@ cc_library( }), visibility = ["//visibility:public"], ) - -pkg_files( - name = "swift-test-sdk", - srcs = glob([ - "sdk/**/*", - ]), - strip_prefix = strip_prefix.from_pkg(), - visibility = ["//visibility:public"], -) diff --git a/swift/third_party/swift-llvm-support/BUILD.bazel b/swift/third_party/swift-llvm-support/BUILD.bazel index c14f5c54085..183f9e7a7ff 100644 --- a/swift/third_party/swift-llvm-support/BUILD.bazel +++ b/swift/third_party/swift-llvm-support/BUILD.bazel @@ -8,14 +8,6 @@ alias( }), ) -alias( - name = "swift-test-sdk", - actual = select({ - "@bazel_tools//src/conditions:linux": "@swift_prebuilt_linux//:swift-test-sdk", - "@bazel_tools//src/conditions:darwin": "@swift_prebuilt_darwin_x86_64//:swift-test-sdk", - }), -) - alias( name = "swift-resource-dir", actual = select({ diff --git a/swift/tools/qltest.sh b/swift/tools/qltest.sh index 409bc9a7d15..ba5fb779d28 100755 --- a/swift/tools/qltest.sh +++ b/swift/tools/qltest.sh @@ -5,12 +5,11 @@ mkdir -p "$CODEQL_EXTRACTOR_SWIFT_TRAP_DIR" QLTEST_LOG="$CODEQL_EXTRACTOR_SWIFT_LOG_DIR"/qltest.log EXTRACTOR="$CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor" -SDK="$CODEQL_EXTRACTOR_SWIFT_ROOT/qltest/$CODEQL_PLATFORM/sdk" RESOURCE_DIR="$CODEQL_EXTRACTOR_SWIFT_ROOT/resource-dir/$CODEQL_PLATFORM" export CODEQL_EXTRACTOR_SWIFT_LOG_LEVELS=${CODEQL_EXTRACTOR_SWIFT_LOG_LEVELS:-out:text:no_logs,out:console:info} for src in *.swift; do env=() - opts=(-sdk "$SDK" -resource-dir "$RESOURCE_DIR" -c -primary-file "$src") + opts=(-resource-dir "$RESOURCE_DIR" -c -primary-file "$src") opts+=($(sed -n '1 s=//codeql-extractor-options:==p' $src)) expected_status=$(sed -n 's=//codeql-extractor-expected-status:[[:space:]]*==p' $src) expected_status=${expected_status:-0} From 2b6f100d913a6853997c79e55dc8321ab4eeede5 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Mon, 19 Feb 2024 13:39:27 +0100 Subject: [PATCH 2/4] Swift: update qltest test --- swift/tools/test/qltest/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swift/tools/test/qltest/utils.py b/swift/tools/test/qltest/utils.py index 6e60223be9f..fc2d6582a82 100644 --- a/swift/tools/test/qltest/utils.py +++ b/swift/tools/test/qltest/utils.py @@ -60,8 +60,8 @@ def assert_extractor_executed_with(*flags): for actual, expected in itertools.zip_longest(execution, flags): if actual: actual = actual.strip() - expected_prefix = f"-sdk {swift_root}/qltest/{platform}/sdk -resource-dir {swift_root}/resource-dir/{platform} -c -primary-file " - assert actual.startswith(expected_prefix), f"correct sdk option not found in\n{actual}" + expected_prefix = f"-resource-dir {swift_root}/resource-dir/{platform} -c -primary-file " + assert actual.startswith(expected_prefix), f"correct options not found in\n{actual}" actual = actual[len(expected_prefix):] assert actual, f"\nnot encountered: {expected}" assert expected, f"\nunexpected: {actual}" From ccf7608850ebfcd4d10825d4cdb1367a909e8fe2 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Tue, 13 Feb 2024 09:54:59 +0100 Subject: [PATCH 3/4] Swift: update swift prebuilt package --- swift/third_party/load.bzl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/swift/third_party/load.bzl b/swift/third_party/load.bzl index 6e2eb6075fe..ddd4d1ce5d9 100644 --- a/swift/third_party/load.bzl +++ b/swift/third_party/load.bzl @@ -1,11 +1,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -_swift_prebuilt_version = "swift-5.9.2-RELEASE.267" +_swift_prebuilt_version = "swift-5.9.2-RELEASE.299" _swift_sha_map = { - "Linux-X64": "1f65fad75aae1b14a83e7094283db4bcc2699c2d47b193e743cc4f5879097337", - "macOS-ARM64": "d1a4f4a3516e1db6bd90a20230b1efed8ab61e005f8281e89a57111f907a35b1", - "macOS-X64": "3fdfca17296661e19137ad2f099d1a270ee43aa317c79bb6feb67e5a29cf0ba8", + "Linux-X64": "19e8150251601e7b27e76d1a405a72c459f9a3e2949a1e360fde15ebb4d87409", + "macOS-ARM64": "4aaec59489c1607be0bd9ea522c1772f9368e7e29197167d3db73e0eb4fa605f", + "macOS-X64": "16f3a248269a06b00c6a40567ca06d5494d9a0ce24e7dd7cb8534828639418e8", } _swift_arch_map = { From eb142184f3b57e1a5f4756fba8d9405a8d347372 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Mon, 19 Feb 2024 13:53:19 +0100 Subject: [PATCH 4/4] Swift: accept test changes --- swift/ql/test/extractor-tests/run_under/Strings.expected | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swift/ql/test/extractor-tests/run_under/Strings.expected b/swift/ql/test/extractor-tests/run_under/Strings.expected index 8732de344db..6d07ed624fd 100644 --- a/swift/ql/test/extractor-tests/run_under/Strings.expected +++ b/swift/ql/test/extractor-tests/run_under/Strings.expected @@ -1,2 +1,2 @@ -| run_under: $CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor -sdk $CODEQL_EXTRACTOR_SWIFT_ROOT/qltest/$CODEQL_PLATFORM/sdk -resource-dir $CODEQL_EXTRACTOR_SWIFT_ROOT/resource-dir/$CODEQL_PLATFORM -c -primary-file filtered_in.swift | -| run_under: $CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor -sdk $CODEQL_EXTRACTOR_SWIFT_ROOT/qltest/$CODEQL_PLATFORM/sdk -resource-dir $CODEQL_EXTRACTOR_SWIFT_ROOT/resource-dir/$CODEQL_PLATFORM -c -primary-file unfiltered.swift | +| run_under: $CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor -resource-dir $CODEQL_EXTRACTOR_SWIFT_ROOT/resource-dir/$CODEQL_PLATFORM -c -primary-file filtered_in.swift | +| run_under: $CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor -resource-dir $CODEQL_EXTRACTOR_SWIFT_ROOT/resource-dir/$CODEQL_PLATFORM -c -primary-file unfiltered.swift |