Only run Objective-C tests on Apple platforms

This commit is contained in:
Jacob Dufault 2017-12-22 09:07:21 -08:00
parent fd7c01796c
commit b4b45d36b5
4 changed files with 23 additions and 0 deletions

View File

@ -55,3 +55,6 @@ std::vector<std::string> GetPlatformClangArguments();
// Free any unused memory and return it to the system.
void FreeUnusedMemory();
// If true objective-c index tests will be run.
bool RunObjectiveCIndexTests();

View File

@ -356,4 +356,12 @@ void FreeUnusedMemory() {
#endif
}
bool RunObjectiveCIndexTests() {
#if defined(__APPLE__)
return true;
#else
return false;
#endif
}
#endif

View File

@ -248,4 +248,8 @@ std::vector<std::string> GetPlatformClangArguments() {
void FreeUnusedMemory() {}
bool RunObjectiveCIndexTests() {
return false;
}
#endif

View File

@ -5,6 +5,8 @@
#include "serializer.h"
#include "utils.h"
#include <loguru.hpp>
void Write(const std::vector<std::string>& strs) {
for (const std::string& str : strs)
std::cout << str << std::endl;
@ -116,6 +118,12 @@ void RunIndexTests(const std::string& filter_path) {
for (std::string path : GetFilesInFolder("tests", true /*recursive*/,
true /*add_folder_to_path*/)) {
if (!RunObjectiveCIndexTests() && EndsWithAny(path, {".m", ".mm"})) {
LOG_S(INFO) << "Skipping \"" << path
<< "\" since this platform does not support running "
"Objective-C tests.";
}
float memory_before = GetProcessMemoryUsedInMb();
float memory_after = -1.;