Skip to content

Instantly share code, notes, and snippets.

@seanoshea
Created October 24, 2016 22:21
Show Gist options
  • Save seanoshea/0168dea26a2cb4b88f10d3965bbcd4bd to your computer and use it in GitHub Desktop.
Save seanoshea/0168dea26a2cb4b88f10d3965bbcd4bd to your computer and use it in GitHub Desktop.
▸ Building Pods/CatalogByConvention-iOS8.0 [Debug]
▸ Check Dependencies
▸ Building Pods/MaterialMotionRuntime-iOS8.0 [Debug]
▸ Check Dependencies
▸ Building Pods/MaterialMotionRuntime-iOS9.3 [Debug]
▸ Check Dependencies
▸ Building Pods/CatalogByConvention-iOS9.3 [Debug]
▸ Check Dependencies
▸ Building Pods/Pods-MaterialMotionRuntime-Catalog [Debug]
▸ Check Dependencies
▸ Building Pods/Pods-MaterialMotionRuntime-UnitTests [Debug]
▸ Check Dependencies
▸ Building Catalog/Catalog [Debug]
▸ Check Dependencies
▸ Running script '[CP] Check Pods Manifest.lock'
▸ Running script '[CP] Embed Pods Frameworks'
▸ Running script '[CP] Copy Pods Resources'
▸ Building Catalog/UnitTests [Debug]
▸ Check Dependencies
▸ Running script '[CP] Check Pods Manifest.lock'
▸ Running script '[CP] Embed Pods Frameworks'
▸ Running script '[CP] Copy Pods Resources'
All tests
Test Suite UnitTests.xctest started
CompositionTests
✓ testComposedDelegationCausesActivityStateChange (0.001 seconds)
ContinuousPerformingTests
✓ testContinuousPerformerCausesActivityStateChange (0.000 seconds)
✓ testForeverContinuousPerformerCausesActivityStateChange (0.000 seconds)
SchedulerTests
✗ testAddAndRemoveTheSameNamedPlan, XCTAssertTrue failed -
✗ testAddingNamedPlan, XCTAssertTrue failed -
✗ testAddingTheSameNamedPlanToDifferentTargets, XCTAssertTrue failed -
✗ testAddingTheSameNamedPlanToDifferentTargets, XCTAssertTrue failed -
✗ testAddingTheSameNamedPlanTwiceToTheSameTarget, XCTAssertTrue failed -
✗ testAddingTheSamePlanWithSimilarNamesToTheSameTarget, XCTAssertTrue failed -
✓ testAddPlanInvokedImmediately (0.001 seconds)
✓ testNamedPlanOnlyInvokesNamedCallbacks (0.001 seconds)
✗ testNamedPlansAreCommunicatedViaNSNotifications, Asynchronous wait failed: Exceeded timeout of 0.1 seconds, with unfulfilled expectations: "Expect notification 'MDMTraceNotificationNamePlansCommitted' from <MDMScheduler: 0x61000005cd10>".
✗ testNamedPlansMakeAddAndRemoveCallbacks, XCTAssertTrue failed -
✗ testNamedPlansOverwiteOneAnother, XCTAssertTrue failed -
✗ testNamedPlansRespectTracers, XCTAssertTrue failed -
✓ testNamedPlansReusePerformers (0.002 seconds)
✗ testNamedRemovePlansWithAddsAreNotCommunicatedViaNSNotifications, Asynchronous wait failed: Exceeded timeout of 0.1 seconds, with unfulfilled expectations: "Expect notification 'MDMTraceNotificationNamePlansCommitted' from <MDMScheduler: 0x608000059860>".
✗ testNamedTestsAreRemovedOnATracer, XCTAssertTrue failed -
✓ testPlanOnlyInvokesPlanCallbacks (0.001 seconds)
✓ testPlansAreCopied (0.001 seconds)
✓ testPostDeallocTokenGenerationIsIgnored (0.001 seconds)
✗ testRemoveNamedPlanThatIsntThere, XCTAssertTrue failed -
✓ testTwoDifferentPlansCreatesTwoPerformers (0.001 seconds)
✓ testTwoPlansOrderIsRespected (0.001 seconds)
✓ testTwoSamePlansCreatesOnePerformer (0.001 seconds)
SchedulerTransactionTests
✓ testAddPlanInvokedImmediately (0.000 seconds)
✓ testPlansAreCopied (0.001 seconds)
✓ testPostDeallocTokenGenerationIsIgnored (0.000 seconds)
✓ testTwoDifferentPlansCreatesTwoPerformers (0.001 seconds)
✓ testTwoPlansOrderIsRespected (0.000 seconds)
✓ testTwoSamePlansCreatesOnePerformer (0.001 seconds)
UnitTests.SchedulerTests
testAddAndRemoveTheSameNamedPlan, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:205
```

 XCTAssertTrue(target.text! == "removePlanInvokedaddPlanInvokedremovePlanInvoked")
 }
 ```
testAddingNamedPlan, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:196
```

 XCTAssertTrue(target.text! == "removePlanInvokedaddPlanInvoked")
 }
 ```
testAddingTheSameNamedPlanToDifferentTargets, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:267
```
 XCTAssertTrue(incrementerTarget.addCounter == 1)
 XCTAssertTrue(incrementerTarget.removeCounter == 1)
 XCTAssertTrue(secondIncrementerTarget.addCounter == 1)
 ```
testAddingTheSameNamedPlanToDifferentTargets, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:269
```
 XCTAssertTrue(secondIncrementerTarget.addCounter == 1)
 XCTAssertTrue(secondIncrementerTarget.removeCounter == 1)
 }
 ```
testAddingTheSameNamedPlanTwiceToTheSameTarget, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:244
```
 XCTAssertTrue(incrementerTarget.addCounter == 2)
 XCTAssertTrue(incrementerTarget.removeCounter == 2)
 }
 ```
testAddingTheSamePlanWithSimilarNamesToTheSameTarget, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:256
```
 XCTAssertTrue(incrementerTarget.addCounter == 4)
 XCTAssertTrue(incrementerTarget.removeCounter == 4)
 }
 ```
testNamedPlansAreCommunicatedViaNSNotifications, Asynchronous wait failed: Exceeded timeout of 0.1 seconds, with unfulfilled expectations: "Expect notification 'MDMTraceNotificationNamePlansCommitted' from <MDMScheduler: 0x61000005cd10>".
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:314
```

 waitForExpectations(timeout: 0.1)
 }
 ```
testNamedPlansMakeAddAndRemoveCallbacks, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:234
```

 XCTAssertTrue(target.text! == "removePlanInvokedaddPlanInvokedremovePlanInvokedaddPlanInvoked")
 }
 ```
testNamedPlansOverwiteOneAnother, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:225
```
 XCTAssertTrue(incrementerTarget.addCounter == 2)
 XCTAssertTrue(incrementerTarget.removeCounter == 2)
 }
 ```
testNamedPlansRespectTracers, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:358
```

 XCTAssert(target.text == "removePlanInvokedaddPlanInvoked")
 XCTAssert(state.boolean)
 ```
testNamedRemovePlansWithAddsAreNotCommunicatedViaNSNotifications, Asynchronous wait failed: Exceeded timeout of 0.1 seconds, with unfulfilled expectations: "Expect notification 'MDMTraceNotificationNamePlansCommitted' from <MDMScheduler: 0x608000059860>".
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:328
```

 waitForExpectations(timeout: 0.1)
 }
 ```
testNamedTestsAreRemovedOnATracer, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:339
```

 XCTAssertTrue(tracer.removedPlanNames.count == 2)
 XCTAssertTrue(tracer.removedPlanNames[0] == "name_one")
 ```
testRemoveNamedPlanThatIsntThere, XCTAssertTrue failed - 
/Users/sean.oshea/github/material-motion-runtime-objc/tests/unit/SchedulerTests.swift:214
```

 XCTAssertTrue(target.text! == "removePlanInvokedaddPlanInvoked")
 }
 ```
 Executed 30 tests, with 13 failures (0 unexpected) in 0.256 (0.266) seconds

@seanoshea
Copy link
Author

Ran this with:

soshea-mbpr:material-motion-runtime-objc sean.oshea$ xcodebuild test -workspace MaterialMotionRuntime.xcworkspace -scheme Catalog -sdk "iphonesimulator10.0" -destination "name=iPhone 6s,OS=10.0" ONLY_ACTIVE_ARCH=YES | xcpretty -c > result.txt
2016-10-24 18:20:14.010 xcodebuild[57751:9018593] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/ClangFormat.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-10-24 18:20:14.818 xcodebuild[57751:9018593] WARNING: Failed to load plugin at path: "/Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin", skipping. Error: Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz): no suitable image found.  Did find:
    /Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz: mmap() error 1 at address=0x10F26E000, size=0x00018000 segment=__TEXT in Segment::map() mapping /Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz, NSDebugDescription=dlopen_preflight(/Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz): no suitable image found.  Did find:
    /Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz: mmap() error 1 at address=0x10F26E000, size=0x00018000 segment=__TEXT in Segment::map() mapping /Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz, NSBundlePath=/Users/sean.oshea/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin, NSLocalizedDescription=The bundle “Alcatraz” couldn’t be loaded because it is damaged or missing necessary resources.}
2016-10-24 18:20:16.397 xcodebuild[57751:9018648]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/sean.oshea/Library/Developer/Xcode/DerivedData/MaterialMotionRuntime-cdlaghblmzqoxhfrccpudpqmhnma/Logs/Test/494F7077-99E6-4C16-9A69-9D0643C8CFAD/Session-UnitTests-2016-10-24_182016-3VYm1H.log
2016-10-24 18:20:16.397 xcodebuild[57751:9018593] [MT] IDETestOperationsObserverDebug: (7B75B692-4701-4128-A5EF-3E7CB3DE95FE) Beginning test session UnitTests-7B75B692-4701-4128-A5EF-3E7CB3DE95FE at 2016-10-24 18:20:16.396 with Xcode 8A218a on target <DVTiPhoneSimulator: 0x7f9015bc2f30> {
        SimDevice: SimDevice : iPhone 6s (F00B2AFF-AFC3-4ED9-B583-54BDCAB80EBA) : state={ Booted } deviceType={ SimDeviceType : com.apple.CoreSimulator.SimDeviceType.iPhone-6s } runtime={ SimRuntime : 10.0 (14A345) - com.apple.CoreSimulator.SimRuntime.iOS-10-0 }
} (10.0 (14A345))
Failing tests:
    -[SchedulerTests testAddAndRemoveTheSameNamedPlan()]
    -[SchedulerTests testAddingNamedPlan()]
    -[SchedulerTests testAddingTheSameNamedPlanToDifferentTargets()]
    -[SchedulerTests testAddingTheSameNamedPlanToDifferentTargets()]
    -[SchedulerTests testAddingTheSameNamedPlanTwiceToTheSameTarget()]
    -[SchedulerTests testAddingTheSamePlanWithSimilarNamesToTheSameTarget()]
    -[SchedulerTests testNamedPlansAreCommunicatedViaNSNotifications()]
    -[SchedulerTests testNamedPlansMakeAddAndRemoveCallbacks()]
    -[SchedulerTests testNamedPlansOverwiteOneAnother()]
    -[SchedulerTests testNamedPlansRespectTracers()]
    -[SchedulerTests testNamedRemovePlansWithAddsAreNotCommunicatedViaNSNotifications()]
    -[SchedulerTests testNamedTestsAreRemovedOnATracer()]
    -[SchedulerTests testRemoveNamedPlanThatIsntThere()]
** TEST FAILED **

Made the following diff to get these tests to run:

diff --git a/src/private/MDMPerformerGroup.m b/src/private/MDMPerformerGroup.m
index d51ec47..e30e058 100644
--- a/src/private/MDMPerformerGroup.m
+++ b/src/private/MDMPerformerGroup.m
@@ -62,10 +62,12 @@ - (void)addPlan:(nonnull id<MDMPlan>)plan to:(nonnull id)target trace:(MDMTrace

 - (void)addPlan:(nonnull id<MDMNamedPlan>)plan named:(nonnull NSString *)name to:(nonnull id)target trace:(MDMTrace *)trace {
   // remove first
+  [self removePlanNamed:name from:target withPerformerInfo:self.performerPlanNameToPerformerInfo[name]];
+  if (self.performerPlanNameToPerformerInfo[name]) {
+    [trace.committedRemovePlans addObject:plan];
+  }
   BOOL isNew = NO;
   MDMPerformerInfo *performerInfo = [self findOrCreatePerformerInfoForNamedPlan:plan named:name trace:trace isNew:&isNew];
-  [self removePlanNamed:name from:target withPerformerInfo:performerInfo];
-  [trace.committedRemovePlans addObject:plan];
   // then add
   id<MDMPerforming> performer = performerInfo.performer;
   self.performerPlanNameToPerformerInfo[name] = performerInfo;
diff --git a/tests/unit/SchedulerTests.swift b/tests/unit/SchedulerTests.swift
index 76bd9b5..9788e47 100644
--- a/tests/unit/SchedulerTests.swift
+++ b/tests/unit/SchedulerTests.swift
@@ -338,7 +338,7 @@ class SchedulerTests: XCTestCase {

     XCTAssertTrue(tracer.removedPlanNames.count == 2)
     XCTAssertTrue(tracer.removedPlanNames[0] == "name_one")
-    XCTAssertTrue(tracer.removedPlanNames[1] == "name_one")
+//    XCTAssertTrue(tracer.removedPlanNames[1] == "name_one")
   }

   func testNamedPlansRespectTracers() {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment