| 11 | #include "cmSystemTools.h" |
| 12 | |
| 13 | bool cmCreateTestSourceList(std::vector<std::string> const& args, |
| 14 | cmExecutionStatus& status) |
| 15 | { |
| 16 | if (args.size() < 3) { |
| 17 | status.SetError("called with wrong number of arguments."); |
| 18 | return false; |
| 19 | } |
| 20 | |
| 21 | auto i = args.begin(); |
| 22 | std::string extraInclude; |
| 23 | std::string function; |
| 24 | std::vector<std::string> tests; |
| 25 | // extract extra include and function |
| 26 | for (; i != args.end(); i++) { |
| 27 | if (*i == "EXTRA_INCLUDE") { |
| 28 | ++i; |
| 29 | if (i == args.end()) { |
| 30 | status.SetError("incorrect arguments to EXTRA_INCLUDE"); |
| 31 | return false; |
| 32 | } |
| 33 | extraInclude = cmStrCat("#include \"", *i, "\"\n"); |
| 34 | } else if (*i == "FUNCTION") { |
| 35 | ++i; |
| 36 | if (i == args.end()) { |
| 37 | status.SetError("incorrect arguments to FUNCTION"); |
| 38 | return false; |
| 39 | } |
| 40 | function = cmStrCat(*i, "(&ac, &av);\n"); |
| 41 | } else { |
| 42 | tests.push_back(*i); |
| 43 | } |
| 44 | } |
| 45 | i = tests.begin(); |
| 46 | |
| 47 | // Name of the source list |
| 48 | |
| 49 | char const* sourceList = i->c_str(); |
| 50 | ++i; |
| 51 | |
| 52 | // Name of the test driver |
| 53 | // make sure they specified an extension |
| 54 | if (cmSystemTools::GetFilenameExtension(*i).size() < 2) { |
| 55 | status.SetError( |
| 56 | "You must specify a file extension for the test driver file."); |
| 57 | return false; |
| 58 | } |
| 59 | cmMakefile& mf = status.GetMakefile(); |
| 60 | std::string driver = cmStrCat(mf.GetCurrentBinaryDirectory(), '/', *i); |
| 61 | ++i; |
| 62 | |
| 63 | std::string configFile = cmSystemTools::GetCMakeRoot(); |
| 64 | |
| 65 | configFile += "/Templates/TestDriver.cxx.in"; |
| 66 | // Create the test driver file |
| 67 | |
| 68 | auto testsBegin = i; |
| 69 | std::vector<std::string> tests_func_name; |
| 70 |
nothing calls this directly
no test coverage detected
searching dependent graphs…