<commit_before>file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py")
string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}")
set(GC_ENVS FLAGS_eager_delete_tensor_gb=0.0)

list(REMOVE_ITEM TEST_OPS test_lac)
# NOTE(Aurelius84): In case of Windows CI, if open ON_INFER, RWLOCK of Scope will
# be removed and will cause some random failed in multi-thread.
if(NOT ON_INFER)
    py_test_modules(test_lac MODULES test_lac)
    set_tests_properties(test_lac PROPERTIES TIMEOUT 120)
endif()

if(WIN32 AND NOT WITH_GPU)
    list(REMOVE_ITEM TEST_OPS test_resnet_amp) # disable on Windows CPU CI for timeout
endif()

foreach(TEST_OP ${TEST_OPS})
    py_test_modules(${TEST_OP} MODULES ${TEST_OP} ENVS ${GC_ENVS})
endforeach(TEST_OP)

set_tests_properties(test_se_resnet PROPERTIES TIMEOUT 900)
set_tests_properties(test_yolov3 PROPERTIES TIMEOUT 900 LABELS "RUN_TYPE=EXCLUSIVE")
set_tests_properties(test_mobile_net PROPERTIES TIMEOUT 120)
set_tests_properties(test_seq2seq PROPERTIES TIMEOUT 120)
set_tests_properties(test_cycle_gan PROPERTIES TIMEOUT 150)
set_tests_properties(test_bert PROPERTIES TIMEOUT 120)
set_tests_properties(test_basic_api_transformation PROPERTIES TIMEOUT 120)
set_tests_properties(test_reinforcement_learning PROPERTIES TIMEOUT 120)
set_tests_properties(test_transformer PROPERTIES TIMEOUT 200)
set_tests_properties(test_bmn PROPERTIES TIMEOUT 120)
#set_tests_properties(test_mnist PROPERTIES TIMEOUT 120)
set_tests_properties(test_build_strategy PROPERTIES TIMEOUT 120)

if(NOT WIN32)
    set_tests_properties(test_resnet_v2 PROPERTIES TIMEOUT 120)
    set_tests_properties(test_tsm PROPERTIES TIMEOUT 900)
    #set_tests_properties(test_resnet PROPERTIES TIMEOUT 120)
endif()

if(APPLE)
    set_tests_properties(test_bmn PROPERTIES TIMEOUT 300)
    set_tests_properties(test_build_strategy PROPERTIES TIMEOUT 300)
    set_tests_properties(test_mobile_net PROPERTIES TIMEOUT 300)
    set_tests_properties(test_resnet_v2 PROPERTIES TIMEOUT 300)
endif()
<commit_msg>Switch dy2st UT to eager mode by cmake (#41317)<commit_after>file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py")
string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}")
set(GC_ENVS FLAGS_eager_delete_tensor_gb=0.0)
set(DY2ST_EAGER_TEST_ENVS ${GC_ENVS} FLAGS_enable_eager_mode=1)

set(TEST_EAGER_OPS test_bmn test_break_continue test_ifelse test_loop test_mnist_amp 
    test_mnist_pure_fp16 test_mobile_net test_program_translator test_ptb_lm test_reinforcement_learning 
    test_resnet test_resnet_amp test_resnet_pure_fp16 test_se_resnet test_sentiment test_seq2seq 
    test_tsm test_word2vec test_yolov3)
list(REMOVE_ITEM TEST_OPS test_lac)
# NOTE(Aurelius84): In case of Windows CI, if open ON_INFER, RWLOCK of Scope will
# be removed and will cause some random failed in multi-thread.
if(NOT ON_INFER)
    py_test_modules(test_lac MODULES test_lac ENVS FLAGS_enable_eager_mode=1)
    set_tests_properties(test_lac PROPERTIES TIMEOUT 120)
endif()

if(WIN32 AND NOT WITH_GPU)
    list(REMOVE_ITEM TEST_OPS test_resnet_amp) # disable on Windows CPU CI for timeout
endif()

foreach(TEST_OP ${TEST_OPS})
    list(FIND TEST_EAGER_OPS ${TEST_OP} WAS_FOUND)
    if (NOT WAS_FOUND EQUAL -1)
        py_test_modules(${TEST_OP} MODULES ${TEST_OP} ENVS ${DY2ST_EAGER_TEST_ENVS})
    else()
        py_test_modules(${TEST_OP} MODULES ${TEST_OP} ENVS ${GC_ENVS})
    endif()
endforeach(TEST_OP)

set_tests_properties(test_se_resnet PROPERTIES TIMEOUT 900)
set_tests_properties(test_yolov3 PROPERTIES TIMEOUT 900 LABELS "RUN_TYPE=EXCLUSIVE")
set_tests_properties(test_mobile_net PROPERTIES TIMEOUT 120)
set_tests_properties(test_seq2seq PROPERTIES TIMEOUT 120)
set_tests_properties(test_cycle_gan PROPERTIES TIMEOUT 150)
set_tests_properties(test_bert PROPERTIES TIMEOUT 120)
set_tests_properties(test_basic_api_transformation PROPERTIES TIMEOUT 120)
set_tests_properties(test_reinforcement_learning PROPERTIES TIMEOUT 120)
set_tests_properties(test_transformer PROPERTIES TIMEOUT 200)
set_tests_properties(test_bmn PROPERTIES TIMEOUT 120)
#set_tests_properties(test_mnist PROPERTIES TIMEOUT 120)
set_tests_properties(test_build_strategy PROPERTIES TIMEOUT 120)

if(NOT WIN32)
    set_tests_properties(test_resnet_v2 PROPERTIES TIMEOUT 120)
    set_tests_properties(test_tsm PROPERTIES TIMEOUT 900)
    #set_tests_properties(test_resnet PROPERTIES TIMEOUT 120)
endif()

if(APPLE)
    set_tests_properties(test_bmn PROPERTIES TIMEOUT 300)
    set_tests_properties(test_build_strategy PROPERTIES TIMEOUT 300)
    set_tests_properties(test_mobile_net PROPERTIES TIMEOUT 300)
    set_tests_properties(test_resnet_v2 PROPERTIES TIMEOUT 300)
endif()

{'fraction_non_alphanumeric': 0.061422413793103446, 'fraction_numerical': 0.034913793103448276, 'mean_word_length': 7.95945945945946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1089220', 'n_tokens_mistral': 1808, 'n_tokens_neox': 1623, 'n_words': 355}