Skip to content

Commit

Permalink
Re-Add Fixutres for a Stalling Test
Browse files Browse the repository at this point in the history
Summary: This adds the necessary test methods in the Test Fixture. This can then be used for testing stalling.

Reviewed By: marekcirkos

Differential Revision: D4232783

fbshipit-source-id: 99498cdc88f8cafd6a61eacec4a40632bff3062b
  • Loading branch information
lawrencelomax authored and Facebook Github Bot committed Nov 28, 2016
1 parent fa7a1db commit be36350
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Fixtures/Binaries/MacUnitTestFixture.xctest/Contents/Info.plist
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15G31</string>
<string>15G1004</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -29,16 +29,16 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7D1014</string>
<string>8A218a</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15E60</string>
<string>16A300</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<string>macosx10.12</string>
<key>DTXcode</key>
<string>0731</string>
<string>0800</string>
<key>DTXcodeBuild</key>
<string>7D1014</string>
<string>8A218a</string>
</dict>
</plist>
Binary file not shown.
Binary file modified Fixtures/Binaries/iOSUnitTestFixture.xctest/Info.plist
Binary file not shown.
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Info.plist</key>
<data>
qaGHmb2Bkgbn64N0OiPsyFFve7g=
</data>
</dict>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
Binary file modified Fixtures/Binaries/iOSUnitTestFixture.xctest/iOSUnitTestFixture
Binary file not shown.
8 changes: 8 additions & 0 deletions Fixtures/Source/MacUnitTestFixture/MacUnitTestFixtureTests.m
Expand Up @@ -58,6 +58,14 @@ - (void)testPossibleCrashingOfHostProcess
}
}

- (void)testPossibleStallingOfHostProcess
{
if ([NSProcessInfo.processInfo.environment[@"TEST_FIXTURE_SHOULD_STALL"] boolValue]) {
NSLog(@"'TEST_FIXTURE_SHOULD_STALL' is True, stalling");
sleep(INT_MAX);
}
}

- (void)testWillAlwaysPass
{
// do nothing
Expand Down
8 changes: 8 additions & 0 deletions Fixtures/Source/iOSUnitTestFixture/iOSUnitTestFixtureTests.m
Expand Up @@ -58,6 +58,14 @@ - (void)testPossibleCrashingOfHostProcess
}
}

- (void)testPossibleStallingOfHostProcess
{
if ([NSProcessInfo.processInfo.environment[@"TEST_FIXTURE_SHOULD_STALL"] boolValue]) {
NSLog(@"'TEST_FIXTURE_SHOULD_STALL' is True, stalling");
sleep(INT_MAX);
}
}

- (void)testWillAlwaysPass
{
// do nothing
Expand Down
Expand Up @@ -61,6 +61,7 @@ - (void)testRunsiOSUnitTestInApplication
@[@"iOSUnitTestFixtureTests", @"testIsRunningOnIOS"],
@[@"iOSUnitTestFixtureTests", @"testIsRunningOnMacOSX"],
@[@"iOSUnitTestFixtureTests", @"testPossibleCrashingOfHostProcess"],
@[@"iOSUnitTestFixtureTests", @"testPossibleStallingOfHostProcess"],
@[@"iOSUnitTestFixtureTests", @"testWillAlwaysFail"],
@[@"iOSUnitTestFixtureTests", @"testWillAlwaysPass"],
];
Expand All @@ -69,6 +70,7 @@ - (void)testRunsiOSUnitTestInApplication
@[@"iOSUnitTestFixtureTests", @"testIsRunningInIOSApp"],
@[@"iOSUnitTestFixtureTests", @"testIsRunningOnIOS"],
@[@"iOSUnitTestFixtureTests", @"testPossibleCrashingOfHostProcess"],
@[@"iOSUnitTestFixtureTests", @"testPossibleStallingOfHostProcess"],
@[@"iOSUnitTestFixtureTests", @"testWillAlwaysPass"],
];
XCTAssertEqualObjects(expected, self.reporter.passedTests);
Expand Down Expand Up @@ -129,8 +131,8 @@ - (void)testRunsiOSLogicTestsWithoutApplication
XCTAssertTrue(self.reporter.printReportWasCalled);
XCTAssertEqual([self.reporter eventsWithName:@"begin-test-suite"].count, 1u);
XCTAssertEqual([self.reporter eventsWithName:@"end-test-suite"].count, 1u);
XCTAssertEqual([self.reporter eventsWithName:@"begin-test"].count, 9u);
XCTAssertEqual([self.reporter eventsWithName:@"end-test"].count, 9u);
XCTAssertEqual([self.reporter eventsWithName:@"begin-test"].count, 10u);
XCTAssertEqual([self.reporter eventsWithName:@"end-test"].count, 10u);
}

- (void)testiOSLogicTestEndsOnCrashingTest
Expand Down Expand Up @@ -187,8 +189,8 @@ - (void)testMacOSXLogicTest
XCTAssertTrue(self.reporter.printReportWasCalled);
XCTAssertEqual([self.reporter eventsWithName:@"begin-test-suite"].count, 1u);
XCTAssertEqual([self.reporter eventsWithName:@"end-test-suite"].count, 1u);
XCTAssertEqual([self.reporter eventsWithName:@"begin-test"].count, 9u);
XCTAssertEqual([self.reporter eventsWithName:@"end-test"].count, 9u);
XCTAssertEqual([self.reporter eventsWithName:@"begin-test"].count, 10u);
XCTAssertEqual([self.reporter eventsWithName:@"end-test"].count, 10u);
}

- (void)testMacOSXLogicTestEndsOnCrashingTest
Expand Down Expand Up @@ -251,6 +253,7 @@ - (void)testReportsMacOSXTestList
@[@"MacUnitTestFixtureTests", @"testIsRunningOnIOS"],
@[@"MacUnitTestFixtureTests", @"testIsRunningOnMacOSX"],
@[@"MacUnitTestFixtureTests", @"testPossibleCrashingOfHostProcess"],
@[@"MacUnitTestFixtureTests", @"testPossibleStallingOfHostProcess"],
@[@"MacUnitTestFixtureTests", @"testWillAlwaysFail"],
@[@"MacUnitTestFixtureTests", @"testWillAlwaysPass"],
];
Expand Down

0 comments on commit be36350

Please sign in to comment.