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
a48a57d3
Unverified
Commit
a48a57d3
authored
Dec 11, 2020
by
Jenn Magder
Committed by
GitHub
Dec 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macos_content_validation_test integration test (#72114)
parent
49e50762
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
154 additions
and
4 deletions
+154
-4
Runner.xcscheme
...s/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+2
-4
macos_content_validation_test.dart
...test/integration.shard/macos_content_validation_test.dart
+152
-0
No files found.
dev/integration_tests/flutter_gallery/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
View file @
a48a57d3
...
...
@@ -36,8 +36,8 @@
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</MacroExpansion>
<
AdditionalOption
s>
</
AdditionalOption
s>
<
Testable
s>
</
Testable
s>
</TestAction>
<LaunchAction
buildConfiguration =
"Debug"
...
...
@@ -59,8 +59,6 @@
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration =
"Profile"
...
...
packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart
0 → 100644
View file @
a48a57d3
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'../src/common.dart'
;
import
'test_utils.dart'
;
void
main
(
)
{
for
(
final
String
buildMode
in
<
String
>[
'Debug'
,
'Release'
])
{
final
String
buildModeLower
=
buildMode
.
toLowerCase
();
test
(
'flutter build macos --
$buildModeLower
builds a valid app'
,
()
async
{
final
String
workingDirectory
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'dev'
,
'integration_tests'
,
'flutter_gallery'
,
);
final
String
flutterBin
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
,
);
await
processManager
.
run
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'clean'
,
],
workingDirectory:
workingDirectory
);
final
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'build'
,
'macos'
,
'--
$buildModeLower
'
,
],
workingDirectory:
workingDirectory
);
print
(
result
.
stdout
);
print
(
result
.
stderr
);
expect
(
result
.
exitCode
,
0
);
final
Directory
outputApp
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
workingDirectory
,
'build'
,
'macos'
,
'Build'
,
'Products'
,
buildMode
,
'flutter_gallery.app'
,
));
final
Directory
outputAppFramework
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
outputApp
.
path
,
'Contents'
,
'Frameworks'
,
'App.framework'
,
));
expect
(
outputAppFramework
.
childFile
(
'App'
),
exists
);
expect
(
outputAppFramework
.
childLink
(
'Resources'
),
exists
);
final
File
vmSnapshot
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
outputApp
.
path
,
'Contents'
,
'Frameworks'
,
'App.framework'
,
'Resources'
,
'flutter_assets'
,
'vm_snapshot_data'
,
));
expect
(
vmSnapshot
.
existsSync
(),
buildMode
==
'Debug'
);
final
File
outputFlutterFrameworkBinary
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
outputApp
.
path
,
'Contents'
,
'Frameworks'
,
'FlutterMacOS.framework'
,
'FlutterMacOS'
,
));
expect
(
outputFlutterFrameworkBinary
,
exists
);
// Archiving should contain a bitcode blob, but not building.
// This mimics Xcode behavior and present a developer from having to install a
// 300+MB app.
expect
(
await
containsBitcode
(
outputFlutterFrameworkBinary
.
path
),
isFalse
,
);
await
processManager
.
run
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'clean'
,
],
workingDirectory:
workingDirectory
);
},
skip:
!
platform
.
isMacOS
,
timeout:
const
Timeout
(
Duration
(
minutes:
5
)),
);
}
}
Future
<
bool
>
containsBitcode
(
String
pathToBinary
)
async
{
// See: https://stackoverflow.com/questions/32755775/how-to-check-a-static-library-is-built-contain-bitcode
final
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
'otool'
,
'-l'
,
'-arch'
,
'arm64'
,
pathToBinary
,
]);
final
String
loadCommands
=
result
.
stdout
as
String
;
if
(!
loadCommands
.
contains
(
'__LLVM'
))
{
return
false
;
}
// Presence of the section may mean a bitcode marker was embedded (size=1), but there is no content.
if
(!
loadCommands
.
contains
(
'size 0x0000000000000001'
))
{
return
true
;
}
// Check the false positives: size=1 wasn't referencing the __LLVM section.
bool
emptyBitcodeMarkerFound
=
false
;
// Section
// sectname __bundle
// segname __LLVM
// addr 0x003c4000
// size 0x0042b633
// offset 3932160
// ...
final
List
<
String
>
lines
=
LineSplitter
.
split
(
loadCommands
).
toList
();
lines
.
asMap
().
forEach
((
int
index
,
String
line
)
{
if
(
line
.
contains
(
'segname __LLVM'
)
&&
lines
.
length
-
index
-
1
>
3
)
{
final
String
emptyBitcodeMarker
=
lines
.
skip
(
index
-
1
).
take
(
3
).
firstWhere
(
(
String
line
)
=>
line
.
contains
(
' size 0x0000000000000001'
),
orElse:
()
=>
null
,
);
if
(
emptyBitcodeMarker
!=
null
)
{
emptyBitcodeMarkerFound
=
true
;
return
;
}
}
});
return
!
emptyBitcodeMarkerFound
;
}
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