Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ jobs:
xCodeVersion: 16.4
enableSanitizers: true

- template: jobs/macos.yml
parameters:
name: 'macOS_Xcode164_ThreadSanitizer'
vmImage: 'macOS-latest'
xCodeVersion: 16.4
enableThreadSanitizer: true

# iOS
- template: jobs/ios.yml
parameters:
Expand Down Expand Up @@ -124,3 +131,10 @@ jobs:
enableSanitizers: true
CC: clang
CXX: clang++

- template: jobs/linux.yml
parameters:
name: Ubuntu_ThreadSanitizer_clang
enableThreadSanitizer: true
CC: clang
CXX: clang++
Comment thread
bghgary marked this conversation as resolved.
4 changes: 3 additions & 1 deletion .github/jobs/linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parameters:
name: ''
enableSanitizers: false
enableThreadSanitizer: false
CC: gcc
CXX: g++

Expand All @@ -13,6 +14,7 @@ jobs:

variables:
SANITIZER_FLAG: ${{ coalesce(replace(format('{0}', parameters.enableSanitizers), 'True', 'ON'), 'OFF') }}
THREAD_SANITIZER_FLAG: ${{ coalesce(replace(format('{0}', parameters.enableThreadSanitizer), 'True', 'ON'), 'OFF') }}

steps:
- script: |
Expand All @@ -23,7 +25,7 @@ jobs:
- script: |
export CC=${{parameters.CC}}
export CXX=${{parameters.CXX}}
cmake -B Build/ubuntu -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -D ENABLE_SANITIZERS=$(SANITIZER_FLAG) -D CMAKE_C_COMPILER=${{parameters.CC}} -D CMAKE_CXX_COMPILER=${{parameters.CXX}}
cmake -B Build/ubuntu -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -D ENABLE_SANITIZERS=$(SANITIZER_FLAG) -D ENABLE_THREAD_SANITIZER=$(THREAD_SANITIZER_FLAG) -D CMAKE_C_COMPILER=${{parameters.CC}} -D CMAKE_CXX_COMPILER=${{parameters.CXX}}
displayName: 'Configure CMake'

- script: |
Expand Down
4 changes: 3 additions & 1 deletion .github/jobs/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ parameters:
vmImage: ''
xCodeVersion: ''
enableSanitizers: false
enableThreadSanitizer: false

jobs:
- job: ${{parameters.name}}
Expand All @@ -13,14 +14,15 @@ jobs:

variables:
SANITIZER_FLAG: ${{ coalesce(replace(format('{0}', parameters.enableSanitizers), 'True', 'ON'), 'OFF') }}
THREAD_SANITIZER_FLAG: ${{ coalesce(replace(format('{0}', parameters.enableThreadSanitizer), 'True', 'ON'), 'OFF') }}

steps:
- script: |
sudo xcode-select --switch /Applications/Xcode_${{parameters.xCodeVersion}}.app/Contents/Developer
displayName: 'Select Xcode ${{parameters.xCodeVersion}}'

- script: |
cmake -B Build/macOS -G Xcode -D ENABLE_SANITIZERS=$(SANITIZER_FLAG)
cmake -B Build/macOS -G Xcode -D ENABLE_SANITIZERS=$(SANITIZER_FLAG) -D ENABLE_THREAD_SANITIZER=$(THREAD_SANITIZER_FLAG)
displayName: 'Configure CMake'

- task: Xcode@5
Expand Down
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ FetchContent_Declare(AndroidExtensions
GIT_TAG 2e85a8d43b89246c460112c9e5546ad54b6e87b4
EXCLUDE_FROM_ALL)
FetchContent_Declare(arcana.cpp
GIT_REPOSITORY https://github.com/microsoft/arcana.cpp.git
GIT_TAG b9bf9d85fce37d5fc9dbfc4a4dc5e1531bee215a
GIT_REPOSITORY https://github.com/bghgary/arcana.cpp.git
GIT_TAG 941914b7504a51beb99a9d28c030467d321be1ea
EXCLUDE_FROM_ALL)
FetchContent_Declare(asio
GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git
Expand All @@ -36,8 +36,8 @@ FetchContent_Declare(llhttp
URL "https://github.com/nodejs/llhttp/archive/refs/tags/release/v8.1.0.tar.gz"
EXCLUDE_FROM_ALL)
FetchContent_Declare(UrlLib
GIT_REPOSITORY https://github.com/BabylonJS/UrlLib.git
GIT_TAG 880c2575e57ca0b59068ecc4860f185b9970e0ce
GIT_REPOSITORY https://github.com/bghgary/UrlLib.git
GIT_TAG 6868a91ec5a854909b497573e5ec75385fdde012
EXCLUDE_FROM_ALL)
# --------------------------------------------------

Expand Down Expand Up @@ -85,6 +85,11 @@ option(JSRUNTIMEHOST_POLYFILL_TEXTDECODER "Include JsRuntimeHost Polyfill TextDe

# Sanitizers
option(ENABLE_SANITIZERS "Enable AddressSanitizer and UBSan" OFF)
option(ENABLE_THREAD_SANITIZER "Enable ThreadSanitizer" OFF)

if(ENABLE_SANITIZERS AND ENABLE_THREAD_SANITIZER)
message(FATAL_ERROR "ENABLE_SANITIZERS and ENABLE_THREAD_SANITIZER cannot be used together.")
endif()

if(ENABLE_SANITIZERS)
set(ENABLE_RTTI ON CACHE BOOL "" FORCE)
Expand All @@ -111,6 +116,15 @@ if(ENABLE_SANITIZERS)
endif()
endif()

if(ENABLE_THREAD_SANITIZER)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options(-fsanitize=thread -fno-omit-frame-pointer)
add_link_options(-fsanitize=thread)
else()
message(WARNING "ThreadSanitizer not supported on this compiler.")
endif()
endif()

# --------------------------------------------------

if(JSRUNTIMEHOST_TESTS)
Expand Down
Loading