diff options
author | Keith Winstein <keithw@cs.stanford.edu> | 2023-01-27 18:37:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-27 18:37:14 -0800 |
commit | c831b98d2ed0571cda9b3ed7acaddd0df2c5a934 (patch) | |
tree | 8e763d059d9d4217ba2cd6f4eaf5fcde1111d8a4 | |
parent | 38a76ebf4108f3044139b6662666575b1117a07c (diff) | |
download | wabt-c831b98d2ed0571cda9b3ed7acaddd0df2c5a934.tar.gz wabt-c831b98d2ed0571cda9b3ed7acaddd0df2c5a934.tar.bz2 wabt-c831b98d2ed0571cda9b3ed7acaddd0df2c5a934.zip |
Speed up tests by matrixing asan/ubsan x debug/release (#2081)
Will shorten the critical path after wasm2c is running SIMD tests
-rw-r--r-- | .github/workflows/build.yml | 37 | ||||
-rw-r--r-- | CMakeLists.txt | 15 |
2 files changed, 23 insertions, 29 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3067c173..dd4cf987 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,33 +79,16 @@ jobs: docker exec emscripten emcmake cmake . docker exec emscripten make -j 2 VERBOSE=1 - build-asan: - name: asan + sanitize: + name: sanitize runs-on: ubuntu-22.04 env: USE_NINJA: "1" - CC: "clang" # used by the wasm2c tests - WASM2C_CFLAGS: "-fsanitize=address" - steps: - - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - uses: actions/checkout@v1 - with: - submodules: true - - run: sudo apt-get install ninja-build - - run: make clang-debug-asan - - run: make clang-release-asan - - run: make test-clang-debug-asan - - run: make test-clang-release-asan - - build-ubsan: - name: ubsan - runs-on: ubuntu-22.04 - env: - USE_NINJA: "1" - CC: "clang" # used by the wasm2c tests - WASM2C_CFLAGS: "-fno-sanitize-recover=undefined" + CC: "clang" + strategy: + matrix: + sanitizer: [asan, ubsan] + type: [debug, release] steps: - uses: actions/setup-python@v1 with: @@ -114,10 +97,8 @@ jobs: with: submodules: true - run: sudo apt-get install ninja-build - - run: make clang-debug-ubsan - - run: make clang-release-ubsan - - run: make test-clang-debug-ubsan - - run: make test-clang-release-ubsan + - run: make clang-${{ matrix.type }}-${{ matrix.sanitizer }} + - run: make test-clang-${{ matrix.type }}-${{ matrix.sanitizer }} build-wasm2c-memchecked: name: wasm2c-memchecked diff --git a/CMakeLists.txt b/CMakeLists.txt index c02bebf4..28f1c43d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,6 +217,7 @@ function(sanitizer NAME FLAGS) set(USE_SANITIZER TRUE PARENT_SCOPE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}" PARENT_SCOPE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}" PARENT_SCOPE) + set(WASM2C_CFLAGS "${WASM2C_CFLAGS} ${FLAGS}" PARENT_SCOPE) endif () endfunction() sanitizer(USE_ASAN "-fsanitize=address") @@ -618,6 +619,18 @@ if (BUILD_TOOLS) endif () if (BUILD_TESTS) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(WASM2C_CFLAGS "${WASM2C_CFLAGS} -g -O0") + endif () + + if (DEFINED CMAKE_OSX_SYSROOT) + set(WASM2C_CFLAGS "${WASM2C_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}") + endif () + + if (DEFINED ENV{WASM2C_CFLAGS}) + set(WASM2C_CFLAGS "${WASM2C_CFLAGS} $ENV{WASM2C_CFLAGS}") + endif () + set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) @@ -681,7 +694,7 @@ if (BUILD_TESTS) set(RUN_TESTS_PY ${WABT_SOURCE_DIR}/test/run-tests.py) add_custom_target(run-tests - COMMAND ${PYTHON_EXECUTABLE} ${RUN_TESTS_PY} --bindir $<TARGET_FILE_DIR:wat2wasm> + COMMAND ${CMAKE_COMMAND} -E env WASM2C_CC=${CMAKE_C_COMPILER} WASM2C_CFLAGS=${WASM2C_CFLAGS} ${PYTHON_EXECUTABLE} ${RUN_TESTS_PY} --bindir $<TARGET_FILE_DIR:wat2wasm> DEPENDS ${WABT_EXECUTABLES} WORKING_DIRECTORY ${WABT_SOURCE_DIR} USES_TERMINAL |