From b4b45d36b5a8a863cc47a3fa08c802c0a1f81198 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Fri, 22 Dec 2017 09:07:21 -0800 Subject: [PATCH] Only run Objective-C tests on Apple platforms --- src/platform.h | 3 +++ src/platform_posix.cc | 8 ++++++++ src/platform_win.cc | 4 ++++ src/test.cc | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/src/platform.h b/src/platform.h index 8525e1d4..fe77172e 100644 --- a/src/platform.h +++ b/src/platform.h @@ -55,3 +55,6 @@ std::vector GetPlatformClangArguments(); // Free any unused memory and return it to the system. void FreeUnusedMemory(); + +// If true objective-c index tests will be run. +bool RunObjectiveCIndexTests(); \ No newline at end of file diff --git a/src/platform_posix.cc b/src/platform_posix.cc index fd883a01..00f1d747 100644 --- a/src/platform_posix.cc +++ b/src/platform_posix.cc @@ -356,4 +356,12 @@ void FreeUnusedMemory() { #endif } +bool RunObjectiveCIndexTests() { +#if defined(__APPLE__) + return true; +#else + return false; +#endif +} + #endif diff --git a/src/platform_win.cc b/src/platform_win.cc index 497518bf..1a0cfb09 100644 --- a/src/platform_win.cc +++ b/src/platform_win.cc @@ -248,4 +248,8 @@ std::vector GetPlatformClangArguments() { void FreeUnusedMemory() {} +bool RunObjectiveCIndexTests() { + return false; +} + #endif diff --git a/src/test.cc b/src/test.cc index 1b97608d..f8c27047 100644 --- a/src/test.cc +++ b/src/test.cc @@ -5,6 +5,8 @@ #include "serializer.h" #include "utils.h" +#include + void Write(const std::vector& 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.;