Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
93a6057c
Unverified
Commit
93a6057c
authored
Mar 16, 2020
by
Jenn Magder
Committed by
GitHub
Mar 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add SDK location unit tests (#52691)
parent
b55f969b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
xcode.dart
packages/flutter_tools/lib/src/macos/xcode.dart
+1
-2
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+26
-0
No files found.
packages/flutter_tools/lib/src/macos/xcode.dart
View file @
93a6057c
...
...
@@ -169,10 +169,9 @@ class Xcode {
assert
(
sdk
!=
null
);
final
RunResult
runResult
=
await
_processUtils
.
run
(
<
String
>[
'xcrun'
,
'--sdk'
,
getNameForSdk
(
sdk
),
'--show-sdk-path'
],
throwOnError:
true
,
);
if
(
runResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Could not find
iPhone
SDK location:
${runResult.stderr}
'
);
throwToolExit
(
'Could not find SDK location:
${runResult.stderr}
'
);
}
return
runResult
.
stdout
.
trim
();
}
...
...
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
93a6057c
...
...
@@ -178,6 +178,32 @@ void main() {
expect
(
getNameForSdk
(
SdkType
.
iPhoneSimulator
),
'iphonesimulator'
);
expect
(
getNameForSdk
(
SdkType
.
macOS
),
'macosx'
);
});
group
(
'SDK location'
,
()
{
const
String
sdkroot
=
'Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk'
;
testWithoutContext
(
'--show-sdk-path iphoneos'
,
()
async
{
when
(
processManager
.
run
(<
String
>[
'xcrun'
,
'--sdk'
,
'iphoneos'
,
'--show-sdk-path'
])).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
0
,
sdkroot
,
''
)));
expect
(
await
xcode
.
sdkLocation
(
SdkType
.
iPhone
),
sdkroot
);
});
testWithoutContext
(
'--show-sdk-path macosx'
,
()
async
{
when
(
processManager
.
run
(<
String
>[
'xcrun'
,
'--sdk'
,
'macosx'
,
'--show-sdk-path'
])).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
0
,
sdkroot
,
''
)));
expect
(
await
xcode
.
sdkLocation
(
SdkType
.
macOS
),
sdkroot
);
});
testWithoutContext
(
'--show-sdk-path fails'
,
()
async
{
when
(
processManager
.
run
(<
String
>[
'xcrun'
,
'--sdk'
,
'iphoneos'
,
'--show-sdk-path'
])).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
1
,
''
,
'xcrun: error:'
)));
expect
(()
async
=>
await
xcode
.
sdkLocation
(
SdkType
.
iPhone
),
throwsToolExit
(
message:
'Could not find SDK location'
));
});
});
});
group
(
'xcdevice'
,
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment