1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import compile_xcassets
class TestFilterCompilerOutput(unittest.TestCase):
relative_paths = {
'/Users/janedoe/chromium/src/Chromium.xcassets':
'../../Chromium.xcassets',
'/Users/janedoe/chromium/src/out/Default/Chromium.app/Assets.car':
'Chromium.app/Assets.car',
}
def testNoError(self):
self.assertEquals(
'',
compile_xcassets.FilterCompilerOutput(
'/* com.apple.actool.compilation-results */\n'
'/Users/janedoe/chromium/src/out/Default/Chromium.app/Assets.car\n',
self.relative_paths))
def testNoErrorRandomMessages(self):
self.assertEquals(
'',
compile_xcassets.FilterCompilerOutput(
'2017-07-04 04:59:19.460 ibtoold[23487:41214] CoreSimulator is att'
'empting to unload a stale CoreSimulatorService job. Existing'
' job (com.apple.CoreSimulator.CoreSimulatorService.179.1.E8tt'
'yeDeVgWK) is from an older version and is being removed to pr'
'event problems.\n'
'/* com.apple.actool.compilation-results */\n'
'/Users/janedoe/chromium/src/out/Default/Chromium.app/Assets.car\n',
self.relative_paths))
def testWarning(self):
self.assertEquals(
'/* com.apple.actool.document.warnings */\n'
'../../Chromium.xcassets:./image1.imageset/[universal][][][1x][][][]['
'][][]: warning: The file "image1.png" for the image set "image1"'
' does not exist.\n',
compile_xcassets.FilterCompilerOutput(
'/* com.apple.actool.document.warnings */\n'
'/Users/janedoe/chromium/src/Chromium.xcassets:./image1.imageset/['
'universal][][][1x][][][][][][]: warning: The file "image1.png'
'" for the image set "image1" does not exist.\n'
'/* com.apple.actool.compilation-results */\n'
'/Users/janedoe/chromium/src/out/Default/Chromium.app/Assets.car\n',
self.relative_paths))
def testError(self):
self.assertEquals(
'/* com.apple.actool.errors */\n'
'../../Chromium.xcassets: error: The output directory "/Users/janedoe/'
'chromium/src/out/Default/Chromium.app" does not exist.\n',
compile_xcassets.FilterCompilerOutput(
'/* com.apple.actool.errors */\n'
'/Users/janedoe/chromium/src/Chromium.xcassets: error: The output '
'directory "/Users/janedoe/chromium/src/out/Default/Chromium.a'
'pp" does not exist.\n'
'/* com.apple.actool.compilation-results */\n',
self.relative_paths))
def testSpurious(self):
self.assertEquals(
'/* com.apple.actool.document.warnings */\n'
'../../Chromium.xcassets:./AppIcon.appiconset: warning: A 1024x1024 ap'
'p store icon is required for iOS apps\n',
compile_xcassets.FilterCompilerOutput(
'/* com.apple.actool.document.warnings */\n'
'/Users/janedoe/chromium/src/Chromium.xcassets:./AppIcon.appiconse'
't: warning: A 1024x1024 app store icon is required for iOS ap'
'ps\n'
'/* com.apple.actool.document.notices */\n'
'/Users/janedoe/chromium/src/Chromium.xcassets:./AppIcon.appiconse'
't/[][ipad][76x76][][][1x][][]: notice: (null)\n',
self.relative_paths))
def testComplexError(self):
self.assertEquals(
'/* com.apple.actool.errors */\n'
': error: Failed to find a suitable device for the type SimDeviceType '
': com.apple.dt.Xcode.IBSimDeviceType.iPad-2x with runtime SimRunt'
'ime : 10.3.1 (14E8301) - com.apple.CoreSimulator.SimRuntime.iOS-1'
'0-3\n'
' Failure Reason: Failed to create SimDeviceSet at path /Users/jane'
'doe/Library/Developer/Xcode/UserData/IB Support/Simulator Devices'
'. You\'ll want to check the logs in ~/Library/Logs/CoreSimulator '
'to see why creating the SimDeviceSet failed.\n'
' Underlying Errors:\n'
' Description: Failed to initialize simulator device set.\n'
' Failure Reason: Failed to subscribe to notifications from Cor'
'eSimulatorService.\n'
' Underlying Errors:\n'
' Description: Error returned in reply to notification requ'
'est: Connection invalid\n'
' Failure Reason: Software caused connection abort\n',
compile_xcassets.FilterCompilerOutput(
'2017-07-07 10:37:27.367 ibtoold[88538:12553239] CoreSimulator det'
'ected Xcode.app relocation or CoreSimulatorService version ch'
'ange. Framework path (/Applications/Xcode.app/Contents/Devel'
'oper/Library/PrivateFrameworks/CoreSimulator.framework) and v'
'ersion (375.21) does not match existing job path (/Library/De'
'veloper/PrivateFrameworks/CoreSimulator.framework/Versions/A/'
'XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc)'
' and version (459.13). Attempting to remove the stale servic'
'e in order to add the expected version.\n'
'2017-07-07 10:37:27.625 ibtoold[88538:12553256] CoreSimulatorServ'
'ice connection interrupted. Resubscribing to notifications.\n'
'2017-07-07 10:37:27.632 ibtoold[88538:12553264] CoreSimulatorServ'
'ice connection became invalid. Simulator services will no lo'
'nger be available.\n'
'2017-07-07 10:37:27.642 ibtoold[88538:12553274] CoreSimulatorServ'
'ice connection became invalid. Simulator services will no lo'
'nger be available.\n'
'/* com.apple.actool.errors */\n'
': error: Failed to find a suitable device for the type SimDeviceT'
'ype : com.apple.dt.Xcode.IBSimDeviceType.iPad-2x with runtime'
' SimRuntime : 10.3.1 (14E8301) - com.apple.CoreSimulator.SimR'
'untime.iOS-10-3\n'
' Failure Reason: Failed to create SimDeviceSet at path /Users/'
'janedoe/Library/Developer/Xcode/UserData/IB Support/Simulator'
' Devices. You\'ll want to check the logs in ~/Library/Logs/Co'
'reSimulator to see why creating the SimDeviceSet failed.\n'
' Underlying Errors:\n'
' Description: Failed to initialize simulator device set.\n'
' Failure Reason: Failed to subscribe to notifications from'
' CoreSimulatorService.\n'
' Underlying Errors:\n'
' Description: Error returned in reply to notification '
'request: Connection invalid\n'
' Failure Reason: Software caused connection abort\n'
'/* com.apple.actool.compilation-results */\n',
self.relative_paths))
if __name__ == '__main__':
unittest.main()
|