talk-to / Chocolate

Make Cocoa more fun
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Update check for if build is running tests #82

Closed ayushgoel closed 8 years ago

ayushgoel commented 8 years ago

The previous check (XCInjectBundle) is no more valid. Tested on Xcode 7.3.1

Environment when running app in simulator:

{
    "CFFIXED_USER_HOME" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Containers/Data/Application/4C0377F3-26E1-41CF-A24B-484C079C75E5";
    "CFLOG_FORCE_STDERR" = YES;
    CLASSIC = 0;
    "CUPS_SERVER" = "/private/tmp/com.apple.launchd.VJvD7ajXCU/Listeners";
    "DYLD_FALLBACK_FRAMEWORK_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks";
    "DYLD_FALLBACK_LIBRARY_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib";
    "DYLD_FRAMEWORK_PATH" = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator";
    "DYLD_LIBRARY_PATH" = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/system/introspection";
    "DYLD_ROOT_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "DYLD_SHARED_REGION" = avoid;
    FBSClientLogging = 0;
    HOME = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Containers/Data/Application/4C0377F3-26E1-41CF-A24B-484C079C75E5";
    "IOS_SIMULATOR_SYSLOG_SOCKET" = "/private/tmp/com.apple.CoreSimulator.SimDevice.CA519275-0F70-4826-9750-A4276C5F24E3.launchd_sim/syslogsock";
    "IPHONE_SHARED_RESOURCES_DIRECTORY" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data";
    "IPHONE_SIMULATOR_CLASS" = N61;
    "IPHONE_SIMULATOR_DEVICE" = iPhone;
    "IPHONE_SIMULATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "IPHONE_TVOUT_EXTENDED_PROPERTIES" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Library/Application Support/iPhone Simulator/com.apple.iphonesimulator/extended_display.plist";
    NSUnbufferedIO = YES;
    PATH = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/local/bin";
    "SIMULATOR_CAPABILITIES" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/DeviceTypes/iPhone 6.simdevicetype/Contents/Resources/capabilities.plist";
    "SIMULATOR_DEVICE_NAME" = "iPhone 6";
    "SIMULATOR_EXTENDED_DISPLAY_PROPERTIES" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Library/Application Support/iPhone Simulator/com.apple.iphonesimulator/extended_display.plist";
    "SIMULATOR_HOST_HOME" = "/Users/ayushgoel";
    "SIMULATOR_LEGACY_ASSET_SUFFIX" = iphone;
    "SIMULATOR_LOG_ROOT" = "/Users/ayushgoel/Library/Logs/CoreSimulator/CA519275-0F70-4826-9750-A4276C5F24E3";
    "SIMULATOR_MAINSCREEN_HEIGHT" = 1334;
    "SIMULATOR_MAINSCREEN_PITCH" = "326.000000";
    "SIMULATOR_MAINSCREEN_SCALE" = "2.000000";
    "SIMULATOR_MAINSCREEN_WIDTH" = 750;
    "SIMULATOR_MEMORY_WARNINGS" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/var/run/memory_warning_simulation";
    "SIMULATOR_MODEL_IDENTIFIER" = "iPhone7,2";
    "SIMULATOR_PLATFORM_RUNTIME_OVERLAY_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/RuntimeOverlay";
    "SIMULATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "SIMULATOR_RUNTIME_BUILD_VERSION" = 13E230;
    "SIMULATOR_RUNTIME_VERSION" = "9.3";
    "SIMULATOR_SHARED_RESOURCES_DIRECTORY" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data";
    "SIMULATOR_UDID" = "CA519275-0F70-4826-9750-A4276C5F24E3";
    "SIMULATOR_VERSION_INFO" = "CoreSimulator 209.19 - Device: iPhone 6 - Runtime: iOS 9.3 (13E230) - DeviceType: iPhone 6";
    "TESTMANAGERD_SIM_SOCK" = "/private/tmp/com.apple.launchd.a64l3xUmHQ/com.apple.testmanagerd.unix-domain.socket";
    TMPDIR = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Containers/Data/Application/4C0377F3-26E1-41CF-A24B-484C079C75E5/tmp";
    "XPC_FLAGS" = 0x0;
    "XPC_SERVICE_NAME" = "UIKitApplication:to.talk.goto[0xca16]";
    "XPC_SIMULATOR_LAUNCHD_NAME" = "com.apple.CoreSimulator.SimDevice.CA519275-0F70-4826-9750-A4276C5F24E3.launchd_sim";
    "__XCODE_BUILT_PRODUCTS_DIR_PATHS" = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator";
    "__XPC_DYLD_FRAMEWORK_PATH" = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator";
    "__XPC_DYLD_LIBRARY_PATH" = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator";
}

Environment when running tests in simulator:

{
    "CFFIXED_USER_HOME" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Containers/Data/Application/C65A41BC-6ED5-45AA-8768-CCA9119B5D97";
    "CFLOG_FORCE_STDERR" = YES;
    CLASSIC = 0;
    "CUPS_SERVER" = "/private/tmp/com.apple.launchd.VJvD7ajXCU/Listeners";
    "DTX_CONNECTION_SERVICES_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Developer/Library/PrivateFrameworks/DTXConnectionServices.framework";
    "DYLD_FALLBACK_FRAMEWORK_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks";
    "DYLD_FALLBACK_LIBRARY_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib";
    "DYLD_FRAMEWORK_PATH" = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks";
    "DYLD_INSERT_LIBRARIES" = "";
    "DYLD_LIBRARY_PATH" = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks";
    "DYLD_ROOT_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "DYLD_SHARED_REGION" = avoid;
    FBSClientLogging = 0;
    HOME = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Containers/Data/Application/C65A41BC-6ED5-45AA-8768-CCA9119B5D97";
    "IOS_SIMULATOR_SYSLOG_SOCKET" = "/private/tmp/com.apple.CoreSimulator.SimDevice.CA519275-0F70-4826-9750-A4276C5F24E3.launchd_sim/syslogsock";
    "IPHONE_SHARED_RESOURCES_DIRECTORY" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data";
    "IPHONE_SIMULATOR_CLASS" = N61;
    "IPHONE_SIMULATOR_DEVICE" = iPhone;
    "IPHONE_SIMULATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "IPHONE_TVOUT_EXTENDED_PROPERTIES" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Library/Application Support/iPhone Simulator/com.apple.iphonesimulator/extended_display.plist";
    NSUnbufferedIO = YES;
    "OBJC_DISABLE_GC" = YES;
    PATH = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/local/bin";
    "SIMULATOR_CAPABILITIES" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/DeviceTypes/iPhone 6.simdevicetype/Contents/Resources/capabilities.plist";
    "SIMULATOR_DEVICE_NAME" = "iPhone 6";
    "SIMULATOR_EXTENDED_DISPLAY_PROPERTIES" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Library/Application Support/iPhone Simulator/com.apple.iphonesimulator/extended_display.plist";
    "SIMULATOR_HOST_HOME" = "/Users/ayushgoel";
    "SIMULATOR_LEGACY_ASSET_SUFFIX" = iphone;
    "SIMULATOR_LOG_ROOT" = "/Users/ayushgoel/Library/Logs/CoreSimulator/CA519275-0F70-4826-9750-A4276C5F24E3";
    "SIMULATOR_MAINSCREEN_HEIGHT" = 1334;
    "SIMULATOR_MAINSCREEN_PITCH" = "326.000000";
    "SIMULATOR_MAINSCREEN_SCALE" = "2.000000";
    "SIMULATOR_MAINSCREEN_WIDTH" = 750;
    "SIMULATOR_MEMORY_WARNINGS" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/var/run/memory_warning_simulation";
    "SIMULATOR_MODEL_IDENTIFIER" = "iPhone7,2";
    "SIMULATOR_PLATFORM_RUNTIME_OVERLAY_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/RuntimeOverlay";
    "SIMULATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "SIMULATOR_RUNTIME_BUILD_VERSION" = 13E230;
    "SIMULATOR_RUNTIME_VERSION" = "9.3";
    "SIMULATOR_SHARED_RESOURCES_DIRECTORY" = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data";
    "SIMULATOR_UDID" = "CA519275-0F70-4826-9750-A4276C5F24E3";
    "SIMULATOR_VERSION_INFO" = "CoreSimulator 209.19 - Device: iPhone 6 - Runtime: iOS 9.3 (13E230) - DeviceType: iPhone 6";
    "TESTMANAGERD_SIM_SOCK" = "/private/tmp/com.apple.launchd.a64l3xUmHQ/com.apple.testmanagerd.unix-domain.socket";
    TMPDIR = "/Users/ayushgoel/Library/Developer/CoreSimulator/Devices/CA519275-0F70-4826-9750-A4276C5F24E3/data/Containers/Data/Application/C65A41BC-6ED5-45AA-8768-CCA9119B5D97/tmp";
    XCInjectBundleInto = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator/Talkto.app/Talkto";
    "XCODE_DBG_XPC_EXCLUSIONS" = "com.apple.dt.xctestSymbolicator";
    XCTestConfigurationFilePath = "/Users/ayushgoel/Library/Developer/Xcode/DerivedData/Talkto-afskolutxdawwqceptjhxngwhbbd/Build/Products/Debug-iphonesimulator/Talkto.app/PlugIns/Tests.xctest/Tests-51D94C48-92BF-47F8-B424-9B873CC174D7.xctestconfiguration";
    "XPC_FLAGS" = 0x0;
    "XPC_SERVICE_NAME" = "UIKitApplication:to.talk.goto[0x6565]";
    "XPC_SIMULATOR_LAUNCHD_NAME" = "com.apple.CoreSimulator.SimDevice.CA519275-0F70-4826-9750-A4276C5F24E3.launchd_sim";
}
ayushgoel commented 8 years ago

@mx4492 @yatinsns please review?

mx4492 commented 8 years ago

Your change will not work when running under older Xcoden, so we need to keep both the new and the old checks in place.

Also, I came across BOOL inTests = (NSClassFromString(@"XCTest") != nil);, but I'm not sure if that works across Xcodes. You can use that as an alternative to the test that you're adding, or as an extra third check.

ayushgoel commented 8 years ago

Updated.

ayushgoel commented 8 years ago

Manually merged changes to master.