Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lthrockm/final+shim #558

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Lipo xctest executable when required for arch mismatches
  • Loading branch information
lthrockmorton committed Jun 28, 2023
commit 3de4a2a9b19efe055001ea1de390917446a4486c
1 change: 1 addition & 0 deletions BPSampleApp/BPSampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.4;
MTL_ENABLE_DEBUG_INFO = NO;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBD772B32A33E15D0098CEFD"
BuildableName = "BPPassingLogicTests.xctest"
BlueprintName = "BPPassingLogicTests"
ReferencedContainer = "container:BPSampleApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBD772B32A33E15D0098CEFD"
BuildableName = "BPPassingLogicTests.xctest"
BlueprintName = "BPPassingLogicTests"
ReferencedContainer = "container:BPSampleApp.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
viewDebuggingEnabled = "No">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBD772B32A33E15D0098CEFD"
BuildableName = "BPPassingLogicTests.xctest"
BlueprintName = "BPPassingLogicTests"
ReferencedContainer = "container:BPSampleApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
8 changes: 8 additions & 0 deletions bluepill/bluepill.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
C4D6861A2267ABEF007D4237 /* bplib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4D686192267ABEF007D4237 /* bplib.framework */; };
C4FD8C581DB6E09B000ED28C /* BPPacker.m in Sources */ = {isa = PBXBuildFile; fileRef = C4FD8C571DB6E09B000ED28C /* BPPacker.m */; };
E49235FF22EA847700395D98 /* times.json in Resources */ = {isa = PBXBuildFile; fileRef = E49235FE22EA847700395D98 /* times.json */; };
FBA69FA72A45F889003BADBF /* BPLogicTestFixture_arm64.xctest in Resources */ = {isa = PBXBuildFile; fileRef = FBA69FA52A45F889003BADBF /* BPLogicTestFixture_arm64.xctest */; };
FBA69FA82A45F889003BADBF /* BPLogicTestFixture_x86_64.xctest in Resources */ = {isa = PBXBuildFile; fileRef = FBA69FA62A45F889003BADBF /* BPLogicTestFixture_x86_64.xctest */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -85,6 +87,8 @@
C4FD8C561DB6E09B000ED28C /* BPPacker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPPacker.h; sourceTree = "<group>"; };
C4FD8C571DB6E09B000ED28C /* BPPacker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BPPacker.m; sourceTree = "<group>"; };
E49235FE22EA847700395D98 /* times.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = times.json; sourceTree = "<group>"; };
FBA69FA52A45F889003BADBF /* BPLogicTestFixture_arm64.xctest */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = BPLogicTestFixture_arm64.xctest; sourceTree = "<group>"; };
FBA69FA62A45F889003BADBF /* BPLogicTestFixture_x86_64.xctest */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = BPLogicTestFixture_x86_64.xctest; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -142,6 +146,8 @@
0173521223679E87008BFA4E /* TEST-FinalReport.xml */,
E49235FE22EA847700395D98 /* times.json */,
BA9C2DB01DD67B66007CB967 /* testScheme.xcscheme */,
FBA69FA52A45F889003BADBF /* BPLogicTestFixture_arm64.xctest */,
FBA69FA62A45F889003BADBF /* BPLogicTestFixture_x86_64.xctest */,
BA9C2DAE1DD674AD007CB967 /* BPSampleAppTests.xctest */,
C415174C273AE3CE00646740 /* Expected-TEST-FinalReport-for-invalid-xml.xml */,
);
Expand Down Expand Up @@ -272,8 +278,10 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FBA69FA72A45F889003BADBF /* BPLogicTestFixture_arm64.xctest in Resources */,
BA9C2DB11DD67B66007CB967 /* testScheme.xcscheme in Resources */,
BA9C2DAF1DD674AD007CB967 /* BPSampleAppTests.xctest in Resources */,
FBA69FA82A45F889003BADBF /* BPLogicTestFixture_x86_64.xctest in Resources */,
E49235FF22EA847700395D98 /* times.json in Resources */,
C415174F273AEAC400646740 /* simulator in Resources */,
0173521323679E87008BFA4E /* TEST-FinalReport.xml in Resources */,
Expand Down
2 changes: 1 addition & 1 deletion bluepill/src/BPApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ + (instancetype)appWithConfig:(BPConfiguration *)config
andTestBundlePath:config.testBundlePath
andUITargetAppPath:config.testRunnerAppPath
withError:errPtr]];
} else if (config.isLogicTestTarget) {
} else if (config.isLogicTestTarget && config.testBundlePath) {
BPXCTestFile *testFile = [BPXCTestFile BPXCTestFileFromXCTestBundle:config.testBundlePath
andHostAppBundle:nil
andUITargetAppPath:nil
Expand Down
5 changes: 5 additions & 0 deletions bluepill/src/BPPacker.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ @implementation BPPacker
andXCTestFiles:xcTestFiles];

NSMutableArray<BPXCTestFile *> *bundles = [[NSMutableArray alloc] init];

NSInteger counter = 0;
for (BPXCTestFile *xctFile in xcTestFiles) {
counter += 1;
[BPUtils printInfo:INFO withString:@"%@: Looping through... counter = %@", xctFile.testBundlePath, @(counter)];

NSArray *bundleTestsToRun = [[testsToRunByFilePath[xctFile.testBundlePath] allObjects] sortedArrayUsingSelector:@selector(compare:)];
NSNumber *estimatedBundleTime = testEstimatesByFilePath[xctFile.testBundlePath];
// If the bundle is small enough, do not split. Also do not split if the bundle is in no_split list.
Expand Down
45 changes: 43 additions & 2 deletions bluepill/tests/BPIntegrationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,55 @@ - (void)tearDown {
[super tearDown];
}

- (void)testLogicTestBundles {
- (void)testArchitecture_x86_64 {
NSString *bundlePath = BPTestHelper.logicTestBundlePath_x86_64;

BPConfiguration *config = [BPTestUtils makeUnhostedTestConfiguration];
config.stuckTimeout = @(2);
config.testCaseTimeout = @(10);
// Test multiple test bundles, while skipping any failing tests so that we
// can still validate that we get a success code..
config.testBundlePath = bundlePath;

NSString *bpPath = [BPTestHelper bpExecutablePath];
BPRunner *runner = [BPRunner BPRunnerWithConfig:config withBpPath:bpPath];
NSError *error;
BPApp *app = [BPApp appWithConfig:config withError:&error];

XCTAssert(runner != nil);
int rc = [runner runWithBPXCTestFiles:app.testBundles];
XCTAssert(rc == 0, @"Wanted 0, got %d", rc);
XCTAssert([runner busySwimlaneCount] == 0);
}

- (void)testArchitecture_arm64 {
NSString *bundlePath = BPTestHelper.logicTestBundlePath_arm64;

BPConfiguration *config = [BPTestUtils makeUnhostedTestConfiguration];
config.stuckTimeout = @(2);
config.testCaseTimeout = @(10);
// Test multiple test bundles, while skipping any failing tests so that we
// can still validate that we get a success code..
config.testBundlePath = bundlePath;

NSString *bpPath = [BPTestHelper bpExecutablePath];
BPRunner *runner = [BPRunner BPRunnerWithConfig:config withBpPath:bpPath];
NSError *error;
BPApp *app = [BPApp appWithConfig:config withError:&error];

XCTAssert(runner != nil);
int rc = [runner runWithBPXCTestFiles:app.testBundles];
XCTAssert(rc == 0, @"Wanted 0, got %d", rc);
XCTAssert([runner busySwimlaneCount] == 0);
}

- (void)testLogicTestBundles {
BPConfiguration *config = [BPTestUtils makeUnhostedTestConfiguration];
config.stuckTimeout = @(2);
config.testCaseTimeout = @(10);
// Test multiple test bundles, while skipping any failing tests so that we
// can still validate that we get a success code..
config.testBundlePath = BPTestHelper.passingLogicTestBundlePath;
config.testBundlePath = BPTestHelper.logicTestBundlePath;
config.additionalUnitTestBundles = @[BPTestHelper.logicTestBundlePath];
config.testCasesToSkip = @[
@"BPLogicTests/testFailingLogicTest",
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?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>
GbcklTveKC3Dq/Hd5o0K0x80WcA=
</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>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</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>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</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>^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 not shown.
Binary file not shown.
Loading