1# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14# target to test compilation issue on arm32 platforms
15# see issue https://gitee.com/openharmony-sig/arkcompiler_ets_frontend/issues/I84VFY
16if (PANDA_TARGET_ARM32)
17  add_custom_target(ets_tests_arm32_punctuator_any_equal
18      COMMAND ${PANDA_ROOT}/tests/tests-u-runner/runner.sh
19              --build-dir ${PANDA_BINARY_ROOT}
20              --arm32-qemu
21              --ets-runtime
22              --test-file PunctuatorAnyEqual.sts
23  )
24endif()
25
26# ignore ARM32 because some files (not gnueabi or gnueabihf) are incompatible with 32x processors
27# this will be fixed in the future
28if(PANDA_TARGET_ARM32 OR PANDA_ARM64_TESTS_WITH_SANITIZER)
29    return()
30endif()
31
32add_custom_target(es2panda_tests COMMENT "Running es2panda test suites")
33
34function(ets2panda_add_gtest TARGET)
35    # Parse arguments
36    cmake_parse_arguments(
37            ARG
38            ""
39            ""
40            "CPP_SOURCES"
41            ${ARGN}
42    )
43
44    MESSAGE(${TARGET})
45
46    panda_add_gtest(
47            NAME ${TARGET}
48            SOURCES
49                ${ARG_CPP_SOURCES}
50            LIBRARIES
51                es2panda-public
52                es2panda-lib
53                arkassembler
54                arkbytecodeopt
55            INCLUDE_DIRS
56                ${ES2PANDA_PATH}
57                ${ES2PANDA_BINARY_ROOT}
58            SANITIZERS
59                ${PANDA_SANITIZERS_LIST}
60    )
61endfunction(ets2panda_add_gtest)
62
63
64if(PANDA_WITH_ETS)
65    if (NOT (PANDA_ENABLE_ADDRESS_SANITIZER OR PANDA_ENABLE_THREAD_SANITIZER) OR
66        NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR
67        PANDA_CI_TESTING_MODE STREQUAL "Nightly")
68            set(PANDA_REGRESSION_TESTS 1)
69    endif()
70endif()
71
72add_subdirectory(tsconfig)
73add_subdirectory(options)
74add_subdirectory(unit)
75