This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtests.cmake.in
55 lines (48 loc) · 1.89 KB
/
tests.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# This file is part of MCUSim, an XSPICE library with microcontrollers.
#
# Copyright (C) 2017-2019 MCUSim Developers, see AUTHORS.txt for contributors.
#
# MCUSim is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MCUSim is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# CMake script to run simulation tests by "make tests" command
file(GLOB_RECURSE MSIM_TESTS "@CMAKE_CURRENT_BINARY_DIR@/mcusim.conf")
foreach(MSIM_TEST ${MSIM_TESTS})
message(STATUS "[SIMULATION]: ${MSIM_TEST}")
get_filename_component(TEST_WORKING_DIR ${MSIM_TEST} DIRECTORY)
# -----------------------------------------------------------------------------
# Configure address sanitizer
# -----------------------------------------------------------------------------
set(WITH_ASAN @WITH_ASAN@)
if (WITH_ASAN)
find_program(SYMB llvm-symbolizer)
message(STATUS "using LLVM symbolizer: ${SYMB}")
set(ENV{ASAN_OPTIONS} "symbolize=1")
set(ENV{ASAN_SYMBOLIZER_PATH} ${SYMB})
endif()
# -----------------------------------------------------------------------------
# Run test
# -----------------------------------------------------------------------------
execute_process(
COMMAND @CMAKE_CURRENT_BINARY_DIR@/../mcusim
RESULT_VARIABLE test_res
WORKING_DIRECTORY ${TEST_WORKING_DIR}
TIMEOUT 30
)
if (NOT "${test_res}" STREQUAL "0")
message(FATAL_ERROR "failed: ${MSIM_TEST}")
else()
message(STATUS "[END]")
endif()
endforeach()