Skip to content

Commit

Permalink
Merge e6a698b into 1102891
Browse files Browse the repository at this point in the history
  • Loading branch information
LanderlYoung committed Dec 5, 2021
2 parents 1102891 + e6a698b commit 5713327
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- main
paths-ignore:
- 'docs/**'
workflow_dispatch:

jobs:
mac-clang-run:
Expand All @@ -20,7 +21,7 @@ jobs:
backends: [ V8, JavaScriptCore, QuickJs, Lua, Empty ]
build_type:
- Debug
# mac runner seems to be slow and less
# mac runner seems to be slow and rear
# - Release
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -117,19 +118,28 @@ jobs:
path: |
build/ScriptXTestLibs
build/googletest-src
- name: Install Dependencies
run: |
sudo apt-get install -y liblua5.3-dev
- name: Configure cmake
env:
SCRIPTX_TEST_FORCE_UPDATE_DEPS: ON
SCRIPTX_TEST_BUILD_ONLY: ON
# SCRIPTX_TEST_BUILD_ONLY: ON
run: |
mkdir -p build && cd build
cmake ../test \
-DSCRIPTX_BACKEND=${{ matrix.backends }} \
-DTEST_FLAG_ENABLE_ASAN=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: Compile UnitTests
run: |
cd build
cmake --build . -j $(nproc) --target UnitTests
- name: Run UnitTests
if: matrix.backends != 'Empty'
run: |
cd build
./UnitTests
android-clang-build:
# disable for now
Expand Down
10 changes: 7 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ enable_testing()
add_executable(UnitTests)
include(cmake/TestEnv.cmake)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O3 -flto")

if (TEST_FLAG_ENABLE_ASAN)
# macOS doesn't support -fsanitize=memory
string(APPEND CMAKE_CXX_FLAGS_DEBUG
string(APPEND UNIT_TEST_ASAN_FLAGS
" -fsanitize=address"
" -fsanitize-recover=address"
" -fno-omit-frame-pointer")
Expand All @@ -26,11 +26,15 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (TEST_FLAG_ENABLE_UBSAN)
# UBSan make UnitTests runs very slow
# enable as need
string(APPEND CMAKE_CXX_FLAGS_DEBUG
string(APPEND UNIT_TEST_ASAN_FLAGS
" -fsanitize=undefined"
" -fsanitize-recover=undefined")
endif ()

string(APPEND CMAKE_C_FLAGS ${UNIT_TEST_ASAN_FLAGS})
string(APPEND CMAKE_CXX_FLAGS ${UNIT_TEST_ASAN_FLAGS})
string(APPEND CMAKE_EXE_LINKER ${UNIT_TEST_ASAN_FLAGS})

if (DEVOPS_ENABLE_COVERAGE)
# devops support gcov only
string(APPEND CMAKE_CXX_FLAGS_DEBUG " --coverage -g3")
Expand Down
11 changes: 11 additions & 0 deletions test/cmake/TestEnv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ elseif (${SCRIPTX_BACKEND} STREQUAL Lua)
set(DEVOPS_LIBS_LIBPATH
"${SCRIPTX_TEST_LIBS}/win64/lua/Lua54.lib"
CACHE STRING "" FORCE)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# apt install liblua5.3-dev
set(DEVOPS_LIBS_INCLUDE
"/usr/include/lua5.3"
CACHE STRING "" FORCE)

#/usr/lib/x86_64-linux-gnu/liblua5.3.a
set(DEVOPS_LIBS_LIBPATH
"lua5.3"
"lua5.3-c++"
CACHE STRING "" FORCE)
endif ()

elseif (${SCRIPTX_BACKEND} STREQUAL WebAssembly)
Expand Down

0 comments on commit 5713327

Please sign in to comment.