1# Copyright (c) 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 14add_custom_target(ets_test_suite_containers) 15 16# Add ets containers tests targets 17# 18# Example usage: 19# 20# add_ets_containers_test(FILE ets_file 21# [SKIP_ARM32_COMPILER] 22# [OPTIONS "--gc-type=epsilon"] 23# IMPL "THREADED" "STACKFUL" 24# OPTION_SETS_THREADED "DEFAULT" 25# OPTION_SETS_STACKFUL "DEFAULT" "JS" "POOL" "JS_POOL" 26# WORKERS "AUTO" "ONE" 27# MODE "INT" "JIT" "AOT" "LLVMAOT" "JITOSR" 28# ) 29# SKIP_ARM32_COMPILER and OPTIONS will apply to all tests 30function(add_ets_containers_test) 31 set(prefix ARG) 32 set(noValues SKIP_ARM32_COMPILER) 33 set(singleValues FILE) 34 set(multiValues OPTIONS IMPL OPTION_SETS_THREADED OPTION_SETS_STACKFUL WORKERS MODE) 35 cmake_parse_arguments(${prefix} "${noValues}" "${singleValues}" "${multiValues}" ${ARGN}) 36 37 if (ARG_SKIP_ARM32_COMPILER) 38 set(SKIP_ARM32_COMPILER "SKIP_ARM32_COMPILER") 39 endif() 40 41 get_filename_component(test_name "${ARG_FILE}" NAME_WE) 42 43 foreach(impl ${ARG_IMPL}) 44 string(TOLOWER "${impl}" impl_name) 45 set(impl_option "--coroutine-impl=${impl_name}") 46 if(impl STREQUAL "STACKFUL" AND 47 (CMAKE_BUILD_TYPE STREQUAL "Debug" OR PANDA_ENABLE_ADDRESS_SANITIZER OR PANDA_ENABLE_THREAD_SANITIZER)) 48 list(APPEND impl_option "--coroutine-stack-size-pages=128") 49 endif() 50 51 foreach(workers_count ${ARG_WORKERS}) 52 set(workers_option "--coroutine-workers-count=0") 53 if (workers_count STREQUAL "ONE") 54 set(workers_option "--coroutine-workers-count=1") 55 endif() 56 string(TOLOWER "${workers_count}" workers_count) 57 58 foreach(option_set ${ARG_OPTION_SETS_${impl}}) 59 set(additional_options "") 60 if(option_set STREQUAL "JS") 61 set(additional_options "--coroutine-js-mode=true") 62 elseif(option_set STREQUAL "POOL") 63 set(additional_options "--use-coroutine-pool=true") 64 elseif(option_set STREQUAL "JS_POOL") 65 set(additional_options "--coroutine-js-mode=true" "--use-coroutine-pool=true") 66 endif() 67 string(TOLOWER "${option_set}" options_name) 68 69 add_ets_test(ets_test_suite_containers 70 FILE ${ARG_FILE} 71 ${SKIP_ARM32_COMPILER} 72 TEST_NAME "${test_name}_${impl_name}_${options_name}_workers_${workers_count}" 73 OPTIONS ${ARG_OPTIONS} ${impl_option} ${additional_options} ${workers_option} 74 MODE ${ARG_MODE} 75 ) 76 endforeach() 77 endforeach() 78 endforeach() 79endfunction() 80 81add_ets_containers_test(FILE blocking_queue.sts 82 SKIP_ARM32_COMPILER 83 OPTIONS "--gc-type=g1-gc" "--run-gc-in-place" "--gc-trigger-type=debug-never" "--compiler-ignore-failures=true" 84 IMPL "THREADED" "STACKFUL" 85 OPTION_SETS_THREADED "DEFAULT" 86 OPTION_SETS_STACKFUL "DEFAULT" "JS" "POOL" 87 WORKERS "ONE" "AUTO" 88 MODE "INT" "JIT" "AOT" 89) 90