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
31203a90
Commit
31203a90
authored
Dec 03, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #697 from abarth/prebuilt_test
Support `flutter test` with prebuilt binaries
parents
85a60a16
fb98a387
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
57 deletions
+33
-57
build_configuration.dart
packages/flutter_tools/lib/src/build_configuration.dart
+3
-2
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+20
-9
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+8
-0
download_tester.py
travis/download_tester.py
+0
-43
setup.sh
travis/setup.sh
+1
-2
test.sh
travis/test.sh
+1
-1
No files found.
packages/flutter_tools/lib/src/build_configuration.dart
View file @
31203a90
...
...
@@ -49,8 +49,9 @@ class BuildConfiguration {
BuildConfiguration
.
prebuilt
({
this
.
hostPlatform
,
this
.
targetPlatform
,
this
.
deviceId
})
:
type
=
BuildType
.
prebuilt
,
buildDir
=
null
,
testable
=
false
;
this
.
deviceId
,
this
.
testable
:
false
})
:
type
=
BuildType
.
prebuilt
,
buildDir
=
null
;
BuildConfiguration
.
local
({
this
.
type
,
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
31203a90
...
...
@@ -26,14 +26,20 @@ class TestCommand extends FlutterCommand {
'any test paths. Otherwise, run this command from the root of your project.'
;
}
String
getShellPath
(
TargetPlatform
platform
,
String
buildPath
)
{
switch
(
platform
)
{
case
TargetPlatform
.
linux
:
return
path
.
join
(
buildPath
,
'sky_shell'
);
case
TargetPlatform
.
mac
:
return
path
.
join
(
buildPath
,
'SkyShell.app'
,
'Contents'
,
'MacOS'
,
'SkyShell'
);
default
:
throw
new
Exception
(
'Unsupported platform.'
);
Future
<
String
>
_getShellPath
(
BuildConfiguration
config
)
async
{
if
(
config
.
type
==
BuildType
.
prebuilt
)
{
Artifact
artifact
=
ArtifactStore
.
getArtifact
(
type:
ArtifactType
.
shell
,
targetPlatform:
config
.
targetPlatform
);
return
await
ArtifactStore
.
getPath
(
artifact
);
}
else
{
switch
(
config
.
targetPlatform
)
{
case
TargetPlatform
.
linux
:
return
path
.
join
(
config
.
buildDir
,
'sky_shell'
);
case
TargetPlatform
.
mac
:
return
path
.
join
(
config
.
buildDir
,
'SkyShell.app'
,
'Contents'
,
'MacOS'
,
'SkyShell'
);
default
:
throw
new
Exception
(
'Unsupported platform.'
);
}
}
}
...
...
@@ -69,6 +75,11 @@ class TestCommand extends FlutterCommand {
if
(!
runFlutterTests
&&
!
validateProjectRoot
())
return
1
;
// If we're running the flutter tests, we want to use the packages directory
// from the unit package in order to find the proper shell binary.
if
(
runFlutterTests
&&
ArtifactStore
.
packageRoot
==
'packages'
)
ArtifactStore
.
packageRoot
=
path
.
join
(
ArtifactStore
.
flutterRoot
,
'packages'
,
'unit'
,
'packages'
);
Directory
testDir
=
runFlutterTests
?
_flutterUnitTestDir
:
Directory
.
current
;
if
(
testArgs
.
isEmpty
)
...
...
@@ -84,7 +95,7 @@ class TestCommand extends FlutterCommand {
if
(!
config
.
testable
)
continue
;
foundOne
=
true
;
loader
.
shellPath
=
path
.
join
(
Directory
.
current
.
path
,
getShellPath
(
config
.
targetPlatform
,
config
.
buildDir
));
loader
.
shellPath
=
path
.
absolute
(
await
_getShellPath
(
config
));
if
(!
FileSystemEntity
.
isFileSync
(
loader
.
shellPath
))
{
logging
.
severe
(
'Cannot find Flutter shell at
${loader.shellPath}
'
);
return
1
;
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
31203a90
...
...
@@ -218,6 +218,14 @@ class FlutterCommandRunner extends CommandRunner {
targetPlatform:
TargetPlatform
.
android
,
deviceId:
globalResults
[
'android-device-id'
]
));
if
(
hostPlatform
==
HostPlatform
.
linux
)
{
configs
.
add
(
new
BuildConfiguration
.
prebuilt
(
hostPlatform:
HostPlatform
.
linux
,
targetPlatform:
TargetPlatform
.
linux
,
testable:
true
));
}
}
else
{
if
(!
FileSystemEntity
.
isDirectorySync
(
enginePath
))
logging
.
warning
(
'
$enginePath
is not a valid directory'
);
...
...
travis/download_tester.py
deleted
100755 → 0
View file @
85a60a16
#!/usr/bin/env python
# Copyright 2015 The Chromium 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
argparse
import
os
import
subprocess
import
sys
import
zipfile
def
download
(
base_url
,
out_dir
,
name
):
url
=
'
%
s/
%
s'
%
(
base_url
,
name
)
dst
=
os
.
path
.
join
(
out_dir
,
name
)
print
'Downloading'
,
url
subprocess
.
call
([
'curl'
,
'-o'
,
dst
,
url
])
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Downloads test artifacts from Google storage'
)
parser
.
add_argument
(
'revision_file'
)
parser
.
add_argument
(
'out_dir'
)
args
=
parser
.
parse_args
()
out_dir
=
args
.
out_dir
if
not
os
.
path
.
exists
(
out_dir
):
os
.
makedirs
(
out_dir
)
revision
=
None
with
open
(
args
.
revision_file
,
'r'
)
as
f
:
revision
=
f
.
read
()
base_url
=
'https://storage.googleapis.com/mojo/flutter/
%
s/linux-x64'
%
revision
download
(
base_url
,
out_dir
,
'artifacts.zip'
)
artifacts_zip
=
zipfile
.
ZipFile
(
os
.
path
.
join
(
out_dir
,
'artifacts.zip'
))
artifacts_zip
.
extractall
(
out_dir
)
artifacts_zip
.
close
()
subprocess
.
call
([
'chmod'
,
'a+x'
,
os
.
path
.
join
(
out_dir
,
'sky_shell'
)])
subprocess
.
call
([
'chmod'
,
'a+x'
,
os
.
path
.
join
(
out_dir
,
'sky_snapshot'
)])
if
__name__
==
'__main__'
:
sys
.
exit
(
main
())
travis/setup.sh
View file @
31203a90
...
...
@@ -2,5 +2,4 @@
set
-ex
dart dev/update_packages.dart
./travis/download_tester.py packages/unit/packages/sky_engine/REVISION bin/cache/travis/out/Debug
(
cd
packages/unit
;
../../bin/flutter cache populate
)
travis/test.sh
View file @
31203a90
...
...
@@ -5,7 +5,7 @@ set -ex
./bin/flutter analyze
--flutter-repo
--no-current-directory
--no-current-package
--congratulate
# flutter package tests
./bin/flutter
test
--flutter-repo
--engine-src-path
bin/cache/travis
./bin/flutter
test
--flutter-repo
(
cd
packages/cassowary
;
pub run
test
-j1
)
# (cd packages/flutter_sprites; ) # No tests to run.
...
...
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