aboutsummaryrefslogtreecommitdiff
path: root/tests/unit-core/CMakeLists.txt
blob: 45b646d5edb8fd69fe5685e1ac30c0d88c50fcde (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required (VERSION 2.8.12)
project (unit-core C)

if (NOT IS_ABSOLUTE ${FEATURE_PROFILE})
  set(FEATURE_PROFILE "${CMAKE_SOURCE_DIR}/jerry-core/profiles/${FEATURE_PROFILE}.profile")
endif()

if(${FEATURE_PROFILE} STREQUAL "${CMAKE_SOURCE_DIR}/jerry-core/profiles/minimal.profile")
  message(FATAL_ERROR "minimal profile isn't supported in unit-core")
endif()

# Unit tests main modules
set(SOURCE_UNIT_TEST_MAIN_MODULES
  test-abort.c
  test-api-binary-operations-arithmetics.c
  test-api-binary-operations-comparisons.c
  test-api-binary-operations-instanceof.c
  test-api-errortype.c
  test-api-functiontype.c
  test-api-iteratortype.c
  test-api-object-property-names.c
  test-api-objecttype.c
  test-api-promise.c
  test-api-property.c
  test-api-set-and-clear-error-flag.c
  test-api-strings.c
  test-api-value-type.c
  test-api.c
  test-arraybuffer.c
  test-backtrace.c
  test-bigint.c
  test-container.c
  test-context-data.c
  test-dataview.c
  test-date-helpers.c
  test-exec-stop.c
  test-external-string.c
  test-from-property-descriptor.c
  test-get-own-property.c
  test-has-property.c
  test-internal-properties.c
  test-jmem.c
  test-json.c
  test-lit-char-helpers.c
  test-literal-storage.c
  test-mem-stats.c
  test-module.c
  test-native-callback-nested.c
  test-native-instanceof.c
  test-native-pointer.c
  test-newtarget.c
  test-number-converter.c
  test-number-to-int32.c
  test-number-to-string.c
  test-objects-foreach.c
  test-poolman.c
  test-promise-callback.c
  test-promise.c
  test-proxy.c
  test-realm.c
  test-regexp-dotall-unicode.c
  test-error-callback.c
  test-regexp.c
  test-regression-3588.c
  test-resource-name.c
  test-snapshot.c
  test-special-proxy.c
  test-string-to-number.c
  test-stringbuilder.c
  test-strings.c
  test-symbol.c
  test-to-integer.c
  test-to-length.c
  test-to-property-descriptor.c
  test-typedarray.c
  test-unicode.c
)

# jerry_heap_stats_t.size == 0 if system allocator is used.
if(JERRY_SYSTEM_ALLOCATOR)
  list(REMOVE_ITEM SOURCE_UNIT_TEST_MAIN_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/test-mem-stats.c)
endif()

# Unit tests declaration
add_custom_target(unittests-core)

foreach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})
  get_filename_component(TARGET_NAME ${SOURCE_UNIT_TEST_MAIN} NAME_WE)
  set(TARGET_NAME unit-${TARGET_NAME})

  add_executable(${TARGET_NAME} ${SOURCE_UNIT_TEST_MAIN})
  target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_CORE_PRIVATE})
  set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "${LINKER_FLAGS_COMMON}")
  set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
  target_link_libraries(${TARGET_NAME} jerry-core jerry-port-default)

  add_dependencies(unittests-core ${TARGET_NAME})
endforeach()