mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
There's no need to check if flushing is needed after every command is added to the variable holding the script content. It is enough to only check once per test name. This simplifies the flushing logic, removing the need for a separate flush_script() command. Previously, we were not clearing the flushed script contents in all cases, but this is now rigorously enforced at the one location where flushing is performed. Also simplify the flushing of the list of test names, since that too doesn't need a separate command. It is simpler and safer to handle that directly inline where the one call to flush_tests_buffer() was previously being made. Fixes: #26431
21 lines
774 B
C++
21 lines
774 B
C++
#include <iostream>
|
|
#include <string>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
// Note: GoogleTest.cmake doesn't actually depend on Google Test as such;
|
|
// it only requires that we produces output in the expected format when
|
|
// invoked with --gtest_list_tests. Thus, we fake that here. This allows us
|
|
// to test the module without actually needing Google Test.
|
|
if (argc > 1 && std::string(argv[1]) == "--gtest_list_tests") {
|
|
std::cout << "flush_script_test.\n";
|
|
const size_t flushThreshold = 50000;
|
|
const size_t flushAfter = 4;
|
|
const size_t testCaseNum = 3 * flushAfter;
|
|
std::string testName(flushThreshold / flushAfter, 'T');
|
|
for (size_t i = 1; i <= testCaseNum; ++i)
|
|
std::cout << " t" << i << testName.c_str() << "\n";
|
|
}
|
|
return 0;
|
|
}
|