12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- if(NOT EXISTS "${TEST_BINARY}")
- message(FATAL_ERROR
- "Specified test binary '${TEST_BINARY}' does not exist"
- )
- endif()
- set(other_args "")
- if (TEST_SPEC)
- set(other_args "${other_args} ${TEST_SPEC}")
- endif()
- if (REPORTER_SPEC)
- set(other_args "${other_args} --reporter ${REPORTER_SPEC}")
- endif()
- math(EXPR adjusted_shard_count "${SHARD_COUNT} - 1")
- file(WRITE "${CTEST_FILE}"
- "string(RANDOM LENGTH 8 ALPHABET \"0123456789abcdef\" rng_seed)\n"
- "\n"
- "foreach(shard_idx RANGE ${adjusted_shard_count})\n"
- " add_test(${TARGET_NAME}-shard-" [[${shard_idx}]] "/${adjusted_shard_count}\n"
- " ${TEST_BINARY}"
- " --shard-index " [[${shard_idx}]]
- " --shard-count ${SHARD_COUNT}"
- " --rng-seed " [[0x${rng_seed}]]
- " --order rand"
- "${other_args}"
- "\n"
- " )\n"
- "endforeach()\n"
- )
|