Skip to content

Commit 8bba799

Browse files
committed
Make address sanitizer only present if the env variable is set, and add additional, optional step in the default action.
1 parent 8732e7f commit 8bba799

File tree

2 files changed

+5
-40
lines changed

2 files changed

+5
-40
lines changed

.github/workflows/swift.yml

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -91,53 +91,16 @@ jobs:
9191
RUST_BACKTRACE: 1
9292
- name: Test Swift bindings package without address sanitizer
9393
run: |
94-
python ci/toggle_address_sanitation_library.py off
9594
cd ci/LDKSwift
9695
../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift test -v
9796
env:
9897
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ci/ldk-c-bindings
99-
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
10098
RUST_BACKTRACE: 1
101-
- name: Archive code coverage results
102-
uses: actions/upload-artifact@v3
103-
with:
104-
name: ci_archive
105-
path: ci
106-
107-
test_bindings_with_sanitizer:
108-
name: Test Bindings with Sanitizer
109-
runs-on: ubuntu-20.04
110-
needs: check_bindings
111-
steps:
112-
- name: Download code coverage results archive
113-
uses: actions/download-artifact@v3
114-
with:
115-
name: ci_archive
116-
path: ci
117-
- name: Set up Python
118-
uses: actions/setup-python@v2
119-
- name: Install Swift Toolchain
120-
run: |
121-
curl --verbose -L -o swift-5.6-RELEASE-ubuntu20.04.tar.gz https://download.swift.org/swift-5.6-release/ubuntu2004/swift-5.6-RELEASE/swift-5.6-RELEASE-ubuntu20.04.tar.gz
122-
echo "Sha sum: $(sha256sum swift-5.6-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')"
123-
if [ "$(sha256sum swift-5.6-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')" != "${EXPECTED_SWIFT_SHASUM}" ]; then
124-
echo "Bad hash"
125-
echo "Contents: \n$(cat swift-5.6-RELEASE-ubuntu20.04.tar.gz)"
126-
exit 1
127-
fi
128-
tar xvvf swift-5.6-RELEASE-ubuntu20.04.tar.gz
129-
env:
130-
EXPECTED_SWIFT_SHASUM: 3f0d926bfc08eea00a69b1d992f2ab5e08155d97476096a3ef959fe7c4cbd58b
131-
- name: Install Valgrind and build utilities
132-
run: |
133-
sudo apt-get update
134-
sudo apt-get -y dist-upgrade
135-
sudo apt-get -y install valgrind lld g++ clang
13699
- name: Test Swift bindings package with address sanitizer
100+
continue-on-error: true
137101
run: |
138-
python ci/toggle_address_sanitation_library.py on
139102
cd ci/LDKSwift
140-
../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift test -Xswiftc -suppress-warnings
103+
../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift test -v
141104
env:
142105
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ci/ldk-c-bindings
143106
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a

ci/LDKSwift/Package.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ var linkerSettings: [PackageDescription.LinkerSetting] = [
2121
]
2222

2323
#if os(Linux)
24-
linkerSettings.append(.linkedLibrary(String(utf8String: getenv("LLVM_CLANG_ASAN_PATH")!)!, .when(platforms: [.linux])))
24+
if let addressSanitizerBinaryPath = getenv("LLVM_CLANG_ASAN_PATH") {
25+
linkerSettings.append(.linkedLibrary(String(utf8String: addressSanitizerBinaryPath)!, .when(platforms: [.linux])))
26+
}
2527
#else
2628
linkerSettings = [
2729
.unsafeFlags(["-L\(bindingsDirectory)"]),

0 commit comments

Comments
 (0)