Skip to content

Commit fd5ea77

Browse files
authored
Prepare for macOS test support (#2623)
* Add deployment targets for osx * Fix bundle path to make spec tests work On iOS, resources are directly within the bundle so the bundlePath and the resourcePath are the same. On macOS, resources are in a Contents/Resources subfolder so enumerating from bundlePath causes us to look for names like Contents/Resources/offline_spec_test, which doesn't work. * Fix documentation warnings that show up under the macOS build
1 parent 67c35d2 commit fd5ea77

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

Firestore/Example/GoogleBenchmark.podspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Google's C++ benchmark framework.
3434
}
3535

3636
s.ios.deployment_target = '8.0'
37+
s.osx.deployment_target = '10.10'
38+
3739
s.requires_arc = false
3840

3941
s.public_header_files = [

Firestore/Example/GoogleTest.podspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Google's C++ test framework.
3434
}
3535

3636
s.ios.deployment_target = '8.0'
37+
s.osx.deployment_target = '10.10'
38+
3739
s.requires_arc = false
3840

3941
# Exclude include/gtest/internal/custom files from public headers. These

Firestore/Example/LibFuzzer.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Pod::Spec.new do |s|
3131
# LibFuzzer uses thread_local which does not appear to be supported before
3232
# iOS 9.
3333
s.ios.deployment_target = '9.0'
34+
s.osx.deployment_target = '10.10'
3435

3536
# Check out only libFuzzer folder.
3637
s.source = {

Firestore/Example/ProtobufCpp.podspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Pod::Spec.new do |s|
2929
:tag => "v#{s.version}"
3030
}
3131

32+
s.ios.deployment_target = '8.0'
33+
s.osx.deployment_target = '10.10'
34+
3235
s.source_files = 'src/**/*.{h,cc}'
3336
s.exclude_files = # skip test files. (Yes, the test files are intermixed with
3437
# the source. No there doesn't seem to be a common/simple

Firestore/Example/Tests/SpecTests/FSTSpecTests.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ - (void)testSpecTests {
728728
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
729729
NSFileManager *fs = [NSFileManager defaultManager];
730730
BOOL exclusiveMode = NO;
731-
for (NSString *file in [fs enumeratorAtPath:[bundle bundlePath]]) {
731+
for (NSString *file in [fs enumeratorAtPath:[bundle resourcePath]]) {
732732
if (![@"json" isEqual:[file pathExtension]]) {
733733
continue;
734734
}

Firestore/core/test/firebase/firestore/FSTGoogleTestTests.mm

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ @interface GoogleTests : XCTestCase
5050

5151
// If the user focuses on GoogleTests itself, this means force all C++ tests to
5252
// run.
53-
BOOL forceAllTests = NO;
53+
bool forceAllTests = false;
5454

5555
/**
5656
* Loads this XCTest runner's configuration file and figures out which tests to
@@ -216,7 +216,7 @@ void ReportTestResult(XCTestCase *self, SEL _cmd) {
216216
atLine:(part.line_number() > 0
217217
? part.line_number()
218218
: 0)
219-
expected:YES];
219+
expected:true];
220220
}
221221
}
222222

@@ -225,8 +225,9 @@ void ReportTestResult(XCTestCase *self, SEL _cmd) {
225225
* Each TestInfo (which represents an indivudal test method execution) is
226226
* translated into a method on the test case.
227227
*
228-
* @param The testing::TestCase of interest to translate.
229-
* @param A map of TestInfoKeys to testing::TestInfos, populated by this method.
228+
* @param testCase The testing::TestCase of interest to translate.
229+
* @param infoMap A map of TestInfoKeys to testing::TestInfos, populated by this
230+
* method.
230231
*
231232
* @return A new Class that's a subclass of XCTestCase, that's been registered
232233
* with the Objective-C runtime.
@@ -304,15 +305,15 @@ void RunGoogleTestTests() {
304305

305306
// Convert XCTest's testToRun set to the equivalent --gtest_filter flag.
306307
//
307-
// Note that we only set forceAllTests to YES if the user specifically focused
308-
// on GoogleTests. This prevents XCTest double-counting test cases (and
309-
// failures) when a user asks for all tests.
308+
// Note that we only set forceAllTests to true if the user specifically
309+
// focused on GoogleTests. This prevents XCTest double-counting test cases
310+
// (and failures) when a user asks for all tests.
310311
NSSet<NSString *> *allTests = [NSSet setWithObject:masterTestCaseName];
311312
NSSet<NSString *> *testsToRun = LoadXCTestConfigurationTestsToRun();
312313
if (testsToRun) {
313314
if ([allTests isEqual:testsToRun]) {
314315
NSLog(@"Forcing all tests to run");
315-
forceAllTests = YES;
316+
forceAllTests = true;
316317
} else {
317318
NSString *filters = CreateTestFiltersFromTestsToRun(testsToRun);
318319
NSLog(@"Using --gtest_filter=%@", filters);

0 commit comments

Comments
 (0)