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
355fd23a
Unverified
Commit
355fd23a
authored
Apr 11, 2022
by
Christopher Fujino
Committed by
GitHub
Apr 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] add test for dart binary arch (#101604)
parent
34371372
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
bash_entrypoint_test.dart
...er_tools/test/integration.shard/bash_entrypoint_test.dart
+47
-0
No files found.
packages/flutter_tools/test/integration.shard/bash_entrypoint_test.dart
View file @
355fd23a
...
...
@@ -7,6 +7,8 @@ import 'dart:convert';
import
'package:file/file.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/os.dart'
;
import
'../src/common.dart'
;
import
'test_utils.dart'
;
...
...
@@ -48,6 +50,40 @@ Future<void> main() async {
expect
(
stdout
,
contains
(
'Successfully received SIGTERM!'
));
},
skip:
platform
.
isWindows
);
// [intended] Windows does not use the bash entrypoint
test
(
'verify the dart binary arch matches the host arch'
,
()
async
{
final
HostPlatform
dartArch
=
_identifyBinaryArch
(
dartBinary
.
path
);
final
OperatingSystemUtils
os
=
OperatingSystemUtils
(
processManager:
processManager
,
fileSystem:
fileSystem
,
platform:
platform
,
logger:
BufferLogger
.
test
(),
);
expect
(
dartArch
,
os
.
hostPlatform
);
},
skip:
!
platform
.
isMacOS
);
// [intended] Calls macOS-specific commands
}
// Call `file` on the path and parse the output.
// This is macOS-specific.
HostPlatform
_identifyBinaryArch
(
String
path
)
{
// Expect STDOUT like:
// bin/cache/dart-sdk/bin/dart: Mach-O 64-bit executable x86_64
final
RegExp
pattern
=
RegExp
(
r'Mach-O 64-bit executable (\w+)'
);
final
ProcessResult
result
=
processManager
.
runSync
(
<
String
>[
'file'
,
dartBinary
.
path
],
);
final
RegExpMatch
?
match
=
pattern
.
firstMatch
(
result
.
stdout
as
String
);
if
(
match
==
null
)
{
fail
(
'Unrecognized STDOUT from `file`: "
${result.stdout}
"'
);
}
switch
(
match
.
group
(
1
))
{
case
'x86_64'
:
return
HostPlatform
.
darwin_x64
;
case
'arm64'
:
return
HostPlatform
.
darwin_arm
;
default
:
fail
(
'Unexpected architecture
${match.group(1)}
'
);
}
}
// A test Dart app that will run until it receives SIGTERM
...
...
@@ -69,3 +105,14 @@ File get dartBash {
.
childFile
(
'dart'
)
.
absolute
;
}
// The executable bash entrypoint for the Dart binary.
File
get
dartBinary
{
return
flutterRoot
.
childDirectory
(
'bin'
)
.
childDirectory
(
'cache'
)
.
childDirectory
(
'dart-sdk'
)
.
childDirectory
(
'bin'
)
.
childFile
(
'dart'
)
.
absolute
;
}
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