<commit_before>cmake_policy(SET CMP0012 NEW)

## these tests shouldn't run with valgrind
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
  brtloader-test-extractor-1
  brtloader-test-extractor-2
  brtloader-test-extractor-3
  brt-serialize-benchmark
  bnc-insert-benchmark
  test_groupcommit_perf.tdb
  test_groupcommit_perf.bdb
  diskfull.tdb
  stress-gc.tdb
  insert-dup-prelock.tdb
  test_3645.tdb
  test_large_update_broadcast_small_cachetable.tdb
  test_update_broadcast_stress.tdb
  test_update_stress.tdb
  stress-test.tdb
  stress-test.bdb
  hot-optimize-table-tests.tdb
  test4573-logtrim.tdb
  test-xa-prepare.tdb
  test-recover1.tdb
  test-recover2.tdb
  test-recover3.tdb
  test-prepare.tdb
  test-prepare2.tdb
  test-prepare3.tdb
  filesize.tdb
  preload-db-nested.tdb
  upgrade-test-4.tdb
  recovery_fileops_unit.tdb
  helgrind_helgrind1.tdb
  helgrind2.tdb
  helgrind3.tdb
  drd_test_groupcommit_count.tdb
  helgrind_test_groupcommit_count.tdb
  loader-cleanup-test2.tdb
  loader-cleanup-test3.tdb
  loader-stress-test4.tdb
  maxsize-for-loader-B.tdb
  try-leak-lost
  try-leak-reachable
  try-leak-uninit
  )

## tests that are supposed to crash will generate memcheck failures
set(tests_that_should_fail
  try-assert0
  try-assert-zero
  test-assertA
  test-assertB
  test_truncate_txn_abort.tdb
  test_db_no_env.tdb
  recover-missing-dbfile.abortrecover
  recover-missing-dbfile-2.abortrecover
  )
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${tests_that_should_fail})

## don't run drd stress tests with valgrind either (because that would do valgrind twice)
set(stress_tests
  test_stress1.tdb
  test_stress2.tdb
  test_stress3.tdb
  test_stress4.tdb
  test_stress5.tdb
  test_stress6.tdb
  test_stress7.tdb
  test_stress_with_verify.tdb
  )
foreach(test ${stress_tests})
  list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
    drd_tiny_${test}
    drd_mid_${test}
    drd_large_${test}
    )
  if(NOT test MATCHES "test_stress(1|3).tdb")
    list(APPEND CTEST_CUSTOM_TESTS_IGNORE
      drd_large_${test}
      )
  endif()
  if(NOT @RUN_LONG_TESTS@)
    list(APPEND CTEST_CUSTOM_TESTS_IGNORE
      drd_mid_${test}
      drd_large_${test}
      )
  endif()
endforeach(test)

set(recover_stress_tests
  recover-test_stress1.abortrecover
  recover-test_stress2.abortrecover
  recover-test_stress3.abortrecover
  )

## we run stress tests separately, only run them if asked to
if(NOT @RUN_STRESS_TESTS@)
  list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${stress_tests} ${recover_stress_tests})
  list(APPEND CTEST_CUSTOM_TESTS_IGNORE ${stress_tests} ${recover_stress_tests})
endif()

set(perf_tests
  perf_checkpoint_var.tdb
  perf_cursor_nop.tdb
  perf_malloc_free.tdb
  perf_nop.tdb
  perf_ptquery.tdb
  perf_ptquery2.tdb
  perf_xmalloc_free.tdb
  )

## we also don't need to run perf tests every time
if(NOT @RUN_PERF_TESTS@)
  list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${perf_tests})
  list(APPEND CTEST_CUSTOM_TESTS_IGNORE ${perf_tests})
endif()

## don't run perf tests with valgrind (that's slow)
file(GLOB perf_test_srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/tests" perf_*.c)
string(REGEX REPLACE "\\.c(;|$)" ".tdb\\1" perf_tests "${perf_test_srcs}")
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${perf_tests})

## these tests fail often and aren't helpful
set(known_failing_tests
  diskfull.tdb
  recovery_fileops_unit.tdb
  )
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${known_failing_tests})
list(APPEND CTEST_CUSTOM_TESTS_IGNORE ${known_failing_tests})

## these tests take a long time, only run them if asked to
set(long_running_tests
  recover_stress.tdb
  checkpoint_stress.tdb
  root_fifo_1.tdb
  root_fifo_2.tdb
  root_fifo_31.tdb<commit_msg>[t:4814] don't patch out recovery_fileops_unit.tdb, we want it to run and need to fix it<commit_after>cmake_policy(SET CMP0012 NEW)

## these tests shouldn't run with valgrind
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
  brtloader-test-extractor-1
  brtloader-test-extractor-2
  brtloader-test-extractor-3
  brt-serialize-benchmark
  bnc-insert-benchmark
  test_groupcommit_perf.tdb
  test_groupcommit_perf.bdb
  diskfull.tdb
  stress-gc.tdb
  insert-dup-prelock.tdb
  test_3645.tdb
  test_large_update_broadcast_small_cachetable.tdb
  test_update_broadcast_stress.tdb
  test_update_stress.tdb
  stress-test.tdb
  stress-test.bdb
  hot-optimize-table-tests.tdb
  test4573-logtrim.tdb
  test-xa-prepare.tdb
  test-recover1.tdb
  test-recover2.tdb
  test-recover3.tdb
  test-prepare.tdb
  test-prepare2.tdb
  test-prepare3.tdb
  filesize.tdb
  preload-db-nested.tdb
  upgrade-test-4.tdb
  recovery_fileops_unit.tdb
  helgrind_helgrind1.tdb
  helgrind2.tdb
  helgrind3.tdb
  drd_test_groupcommit_count.tdb
  helgrind_test_groupcommit_count.tdb
  loader-cleanup-test2.tdb
  loader-cleanup-test3.tdb
  loader-stress-test4.tdb
  maxsize-for-loader-B.tdb
  try-leak-lost
  try-leak-reachable
  try-leak-uninit
  )

## tests that are supposed to crash will generate memcheck failures
set(tests_that_should_fail
  try-assert0
  try-assert-zero
  test-assertA
  test-assertB
  test_truncate_txn_abort.tdb
  test_db_no_env.tdb
  recover-missing-dbfile.abortrecover
  recover-missing-dbfile-2.abortrecover
  )
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${tests_that_should_fail})

## don't run drd stress tests with valgrind either (because that would do valgrind twice)
set(stress_tests
  test_stress1.tdb
  test_stress2.tdb
  test_stress3.tdb
  test_stress4.tdb
  test_stress5.tdb
  test_stress6.tdb
  test_stress7.tdb
  test_stress_with_verify.tdb
  )
foreach(test ${stress_tests})
  list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
    drd_tiny_${test}
    drd_mid_${test}
    drd_large_${test}
    )
  if(NOT test MATCHES "test_stress(1|3).tdb")
    list(APPEND CTEST_CUSTOM_TESTS_IGNORE
      drd_large_${test}
      )
  endif()
  if(NOT @RUN_LONG_TESTS@)
    list(APPEND CTEST_CUSTOM_TESTS_IGNORE
      drd_mid_${test}
      drd_large_${test}
      )
  endif()
endforeach(test)

set(recover_stress_tests
  recover-test_stress1.abortrecover
  recover-test_stress2.abortrecover
  recover-test_stress3.abortrecover
  )

## we run stress tests separately, only run them if asked to
if(NOT @RUN_STRESS_TESTS@)
  list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${stress_tests} ${recover_stress_tests})
  list(APPEND CTEST_CUSTOM_TESTS_IGNORE ${stress_tests} ${recover_stress_tests})
endif()

set(perf_tests
  perf_checkpoint_var.tdb
  perf_cursor_nop.tdb
  perf_malloc_free.tdb
  perf_nop.tdb
  perf_ptquery.tdb
  perf_ptquery2.tdb
  perf_xmalloc_free.tdb
  )

## we also don't need to run perf tests every time
if(NOT @RUN_PERF_TESTS@)
  list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${perf_tests})
  list(APPEND CTEST_CUSTOM_TESTS_IGNORE ${perf_tests})
endif()

## don't run perf tests with valgrind (that's slow)
file(GLOB perf_test_srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/tests" perf_*.c)
string(REGEX REPLACE "\\.c(;|$)" ".tdb\\1" perf_tests "${perf_test_srcs}")
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${perf_tests})

## these tests fail often and aren't helpful
set(known_failing_tests
  diskfull.tdb
  )
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE ${known_failing_tests})
list(APPEND CTEST_CUSTOM_TESTS_IGNORE ${known_failing_tests})

## these tests take a long time, only run them if asked to
set(long_running_tests
  recover_stress.tdb
  checkpoint_stress.tdb
  root_fifo_1.tdb
  root_fifo_2.tdb
  root_fifo_31.tdb
{'fraction_non_alphanumeric': 0.08459337964854924, 'fraction_numerical': 0.013349679880125323, 'mean_word_length': 4.8548644338118025, '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': '7102900', 'n_tokens_mistral': 3096, 'n_tokens_neox': 2982, 'n_words': 470}