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
82f887de
Commit
82f887de
authored
Feb 06, 2017
by
Michael Goderbauer
Committed by
GitHub
Feb 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Flutter Tools Tests to run on Windows (#7878)
parent
079db95b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
39 deletions
+60
-39
format.dart
packages/flutter_tools/lib/src/commands/format.dart
+3
-2
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+4
-1
analysis.dart
packages/flutter_tools/lib/src/dart/analysis.dart
+3
-1
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+2
-2
dart_dependencies_test.dart
packages/flutter_tools/test/dart_dependencies_test.dart
+3
-1
dependency_checker_test.dart
packages/flutter_tools/test/dependency_checker_test.dart
+4
-2
devfs_test.dart
packages/flutter_tools/test/devfs_test.dart
+23
-19
drive_test.dart
packages/flutter_tools/test/drive_test.dart
+3
-1
forbid_dart_io_test.dart
packages/flutter_tools/test/forbid_dart_io_test.dart
+6
-4
context.dart
packages/flutter_tools/test/src/context.dart
+4
-3
test_test.dart
packages/flutter_tools/test/test_test.dart
+2
-1
toolchain_test.dart
packages/flutter_tools/test/toolchain_test.dart
+3
-2
No files found.
packages/flutter_tools/lib/src/commands/format.dart
View file @
82f887de
...
...
@@ -7,6 +7,7 @@ import 'dart:async';
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/os.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../runner/flutter_command.dart'
;
...
...
@@ -37,8 +38,8 @@ class FormatCommand extends FlutterCommand {
);
}
String
dartfmt
=
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
,
'bin'
,
'dartfmt'
);
String
executable
=
os
.
getExecutableName
(
'dartfmt'
,
winExtension:
'bat'
);
String
dartfmt
=
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
,
'bin'
,
executable
);
List
<
String
>
cmd
=
<
String
>[
dartfmt
,
'-w'
]..
addAll
(
argResults
.
rest
);
int
result
=
await
runCommandAndStreamOutput
(
cmd
);
if
(
result
!=
0
)
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
82f887de
...
...
@@ -4,6 +4,8 @@
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/os.dart'
;
import
'../base/process.dart'
;
...
...
@@ -56,9 +58,10 @@ class UpgradeCommand extends FlutterCommand {
// if necessary.
printStatus
(
''
);
printStatus
(
'Upgrading engine...'
);
String
flutter
=
os
.
getExecutableName
(
'flutter'
,
winExtension:
'bat'
);
code
=
await
runCommandAndStreamOutput
(
<
String
>[
'bin/flutter'
,
'--no-color'
,
'precache'
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
flutter
)
,
'--no-color'
,
'precache'
],
workingDirectory:
Cache
.
flutterRoot
,
allowReentrantFlutter:
true
...
...
packages/flutter_tools/lib/src/dart/analysis.dart
View file @
82f887de
...
...
@@ -46,7 +46,9 @@ class AnalysisDriver {
DriverOptions
options
;
String
get
sdkDir
=>
options
.
dartSdkPath
??
cli_util
.
getSdkDir
().
path
;
String
get
sdkDir
{
return
options
.
dartSdkPath
??
path
.
absolute
(
cli_util
.
getSdkDir
().
path
);
}
List
<
AnalysisErrorDescription
>
analyze
(
Iterable
<
File
>
files
)
{
List
<
AnalysisErrorInfo
>
infos
=
_analyze
(
files
);
...
...
packages/flutter_tools/lib/src/devfs.dart
View file @
82f887de
...
...
@@ -544,13 +544,13 @@ class DevFS {
// This project's own package.
final
bool
isProjectPackage
=
uri
.
toString
()
==
'lib/'
;
final
String
directoryName
=
isProjectPackage
?
'lib'
:
'packages/
$packageName
'
;
isProjectPackage
?
'lib'
:
path
.
join
(
'packages'
,
packageName
)
;
// If this is the project's package, we need to pass both
// package:<package_name> and lib/ as paths to be checked against
// the filter because we must support both package: imports and relative
// path imports within the project's own code.
final
String
packagesDirectoryName
=
isProjectPackage
?
'packages/
$packageName
'
:
null
;
isProjectPackage
?
path
.
join
(
'packages'
,
packageName
)
:
null
;
Directory
directory
=
fs
.
directory
(
uri
);
bool
packageExists
=
await
_scanDirectory
(
directory
,
...
...
packages/flutter_tools/test/dart_dependencies_test.dart
View file @
82f887de
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
as
io
;
import
'package:flutter_tools/src/dart/dependencies.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:path/path.dart'
as
path
;
...
...
@@ -36,5 +38,5 @@ void main() {
expect
(
e
.
contains
(
'unexpected token
\'
bad
\'
'
),
isTrue
);
}
});
}
);
}
,
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): enable when sky_snapshot is available
}
packages/flutter_tools/test/dependency_checker_test.dart
View file @
82f887de
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
as
io
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
...
...
@@ -16,7 +18,7 @@ import 'src/context.dart';
void
main
(
)
{
group
(
'DependencyChecker'
,
()
{
final
String
basePath
=
path
.
dirname
(
p
latform
.
script
.
path
);
final
String
basePath
=
path
.
dirname
(
p
ath
.
fromUri
(
platform
.
script
)
);
final
String
dataPath
=
path
.
join
(
basePath
,
'data'
,
'dart_dependencies_test'
);
MemoryFileSystem
testFileSystem
;
...
...
@@ -97,5 +99,5 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
testFileSystem
,
});
}
);
}
,
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): Migrate test away from 'touch' bash command.
}
packages/flutter_tools/test/devfs_test.dart
View file @
82f887de
...
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:io'
as
io
;
import
'package:flutter_tools/src/asset.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
...
...
@@ -19,8 +20,8 @@ import 'src/context.dart';
import
'src/mocks.dart'
;
void
main
(
)
{
final
String
filePath
=
'bar/foo.txt'
;
final
String
filePath2
=
'foo/bar.txt'
;
final
String
filePath
=
path
.
join
(
'bar'
,
'foo.txt'
)
;
final
String
filePath2
=
path
.
join
(
'foo'
,
'bar.txt'
)
;
Directory
tempDir
;
String
basePath
;
DevFS
devFS
;
...
...
@@ -82,8 +83,8 @@ void main() {
int
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test .packages'
,
'writeFile test
bar/foo.txt
'
,
'writeFile test
packages/somepkg/somefile.txt
'
,
'writeFile test
${path.join('bar', 'foo.txt')}
'
,
'writeFile test
${path.join('packages', 'somepkg', 'somefile.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
31
);
...
...
@@ -94,7 +95,7 @@ void main() {
file
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
,
4
,
5
,
6
,
7
]);
int
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test
foo/bar.txt
'
,
'writeFile test
${path.join('foo', 'bar.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
7
);
...
...
@@ -111,17 +112,17 @@ void main() {
await
file
.
writeAsBytes
(<
int
>[
1
,
2
,
3
,
4
,
5
,
6
]);
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test
bar/foo.txt
'
,
'writeFile test
${path.join('bar', 'foo.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
6
);
}
);
}
,
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): enable when updateFileModificationTime is ported to Windows
testUsingContext
(
'delete a file from the local file system'
,
()
async
{
File
file
=
fs
.
file
(
path
.
join
(
basePath
,
filePath
));
await
file
.
delete
();
int
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
'deleteFile test
bar/foo.txt
'
,
'deleteFile test
${path.join('bar', 'foo.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
0
);
...
...
@@ -131,7 +132,7 @@ void main() {
int
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test .packages'
,
'writeFile test
packages/newpkg/anotherfile.txt
'
,
'writeFile test
${path.join('packages', 'newpkg', 'anotherfile.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
51
);
...
...
@@ -140,7 +141,7 @@ void main() {
assetBundle
.
entries
[
'a.txt'
]
=
new
DevFSStringContent
(
'abc'
);
int
bytes
=
await
devFS
.
update
(
bundle:
assetBundle
,
bundleDirty:
true
);
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test
${
getAssetBuildDirectory()}
/a.txt
'
,
'writeFile test
${
_inAssetBuildDirectory('a.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
unorderedMatches
(<
String
>[
'a.txt'
]));
devFS
.
assetPathsToEvict
.
clear
();
...
...
@@ -151,8 +152,8 @@ void main() {
int
bytes
=
await
devFS
.
update
(
bundle:
assetBundle
,
bundleDirty:
true
);
// Expect entire asset bundle written because bundleDirty is true
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test
${
getAssetBuildDirectory()}
/a.txt
'
,
'writeFile test
${
getAssetBuildDirectory()}
/b.txt
'
,
'writeFile test
${
_inAssetBuildDirectory('a.txt')}
'
,
'writeFile test
${
_inAssetBuildDirectory('b.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
unorderedMatches
(<
String
>[
'a.txt'
,
'b.txt'
]));
...
...
@@ -163,7 +164,7 @@ void main() {
assetBundle
.
entries
[
'c.txt'
]
=
new
DevFSStringContent
(
'12'
);
int
bytes
=
await
devFS
.
update
(
bundle:
assetBundle
);
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test
${
getAssetBuildDirectory()}
/c.txt
'
,
'writeFile test
${
_inAssetBuildDirectory('c.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
unorderedMatches
(<
String
>[
'c.txt'
]));
...
...
@@ -174,7 +175,7 @@ void main() {
assetBundle
.
entries
.
remove
(
'c.txt'
);
int
bytes
=
await
devFS
.
update
(
bundle:
assetBundle
);
devFSOperations
.
expectMessages
(<
String
>[
'deleteFile test
${
getAssetBuildDirectory()}
/c.txt
'
,
'deleteFile test
${
_inAssetBuildDirectory('c.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
unorderedMatches
(<
String
>[
'c.txt'
]));
devFS
.
assetPathsToEvict
.
clear
();
...
...
@@ -184,8 +185,8 @@ void main() {
assetBundle
.
entries
.
clear
();
int
bytes
=
await
devFS
.
update
(
bundle:
assetBundle
,
bundleDirty:
true
);
devFSOperations
.
expectMessages
(<
String
>[
'deleteFile test
${
getAssetBuildDirectory()}
/a.txt
'
,
'deleteFile test
${
getAssetBuildDirectory()}
/b.txt
'
,
'deleteFile test
${
_inAssetBuildDirectory('a.txt')}
'
,
'deleteFile test
${
_inAssetBuildDirectory('b.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
unorderedMatches
(<
String
>[
'a.txt'
,
'b.txt'
...
...
@@ -231,8 +232,8 @@ void main() {
int
bytes
=
await
devFS
.
update
();
vmService
.
expectMessages
(<
String
>[
'writeFile test .packages'
,
'writeFile test
bar/foo.txt
'
,
'writeFile test
packages/somepkg/somefile.txt
'
,
'writeFile test
${path.join('bar', 'foo.txt')}
'
,
'writeFile test
${path.join('packages', 'somepkg', 'somefile.txt')}
'
,
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
31
);
...
...
@@ -334,7 +335,10 @@ Future<Null> _createPackage(String pkgName, String pkgFileName) async {
_packages
[
pkgName
]
=
pkgTempDir
;
StringBuffer
sb
=
new
StringBuffer
();
_packages
.
forEach
((
String
pkgName
,
Directory
pkgTempDir
)
{
sb
.
writeln
(
'
$pkgName
:
${pkgTempDir.path}
/
$pkgName
/lib'
);
Uri
pkgPath
=
path
.
toUri
(
path
.
join
(
pkgTempDir
.
path
,
pkgName
,
'lib'
));
sb
.
writeln
(
'
$pkgName
:
$pkgPath
'
);
});
fs
.
file
(
path
.
join
(
_tempDirs
[
0
].
path
,
'.packages'
)).
writeAsStringSync
(
sb
.
toString
());
}
String
_inAssetBuildDirectory
(
String
filename
)
=>
path
.
join
(
getAssetBuildDirectory
(),
filename
);
\ No newline at end of file
packages/flutter_tools/test/drive_test.dart
View file @
82f887de
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
as
io
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/android/android_device.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
...
...
@@ -298,7 +300,7 @@ void main() {
FileSystem:
()
=>
memoryFileSystem
,
});
});
}
);
}
,
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): enable when drive command is working
}
class
MockDevice
extends
Mock
implements
Device
{
...
...
packages/flutter_tools/test/forbid_dart_io_test.dart
View file @
82f887de
...
...
@@ -4,16 +4,18 @@
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
void
main
(
)
{
setUp
(()
{
String
flutterRoot
=
platform
.
environment
[
'FLUTTER_ROOT'
];
assert
(
fs
.
currentDirectory
.
path
==
'
$flutterRoot
/packages/flutter_tools'
);
String
flutterTools
=
path
.
join
(
platform
.
environment
[
'FLUTTER_ROOT'
],
'packages'
,
'flutter_tools'
);
assert
(
path
.
equals
(
fs
.
currentDirectory
.
path
,
flutterTools
));
});
test
(
'no unauthorized imports of dart:io'
,
()
{
for
(
String
path
in
<
String
>[
'lib'
,
'bin'
,
'test'
])
{
for
(
String
path
in
<
String
>[
'lib'
,
'bin'
])
{
fs
.
directory
(
path
)
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
...
...
@@ -36,6 +38,6 @@ bool _isDartFile(FileSystemEntity entity) =>
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
);
bool
_isNotWhitelisted
(
FileSystemEntity
entity
)
=>
entity
.
path
!=
'lib/src/base/io.dart'
;
entity
.
path
!=
path
.
join
(
'lib'
,
'src'
,
'base'
,
'io.dart'
)
;
File
_asFile
(
FileSystemEntity
entity
)
=>
entity
;
packages/flutter_tools/test/src/context.dart
View file @
82f887de
...
...
@@ -35,7 +35,8 @@ typedef dynamic Generator();
void
testUsingContext
(
String
description
,
dynamic
testMethod
(),
{
Timeout
timeout
,
Map
<
Type
,
Generator
>
overrides:
const
<
Type
,
Generator
>{}
Map
<
Type
,
Generator
>
overrides:
const
<
Type
,
Generator
>{},
bool
skip:
false
,
})
{
test
(
description
,
()
async
{
AppContext
testContext
=
new
AppContext
();
...
...
@@ -69,7 +70,7 @@ void testUsingContext(String description, dynamic testMethod(), {
testContext
.
putIfAbsent
(
SimControl
,
()
=>
new
MockSimControl
());
testContext
.
putIfAbsent
(
Usage
,
()
=>
new
MockUsage
());
final
String
basePath
=
path
.
dirname
(
p
latform
.
script
.
path
);
final
String
basePath
=
path
.
dirname
(
p
ath
.
fromUri
(
platform
.
script
)
);
final
String
flutterRoot
=
path
.
normalize
(
path
.
join
(
basePath
,
'..'
,
'..'
,
'..'
));
try
{
...
...
@@ -96,7 +97,7 @@ void testUsingContext(String description, dynamic testMethod(), {
rethrow
;
}
},
timeout:
timeout
);
},
timeout:
timeout
,
skip:
skip
);
}
class
MockDeviceManager
implements
DeviceManager
{
...
...
packages/flutter_tools/test/test_test.dart
View file @
82f887de
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
as
io
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
...
...
@@ -33,7 +34,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
return
_testFile
(
'trivial'
,
1
,
missingDependencyTests
,
missingDependencyTests
);
});
}
);
}
,
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): enable when sky_shell is available
}
Future
<
Null
>
_testFile
(
String
testName
,
int
wantedExitCode
,
String
workingDirectory
,
String
testDirectory
)
async
{
...
...
packages/flutter_tools/test/toolchain_test.dart
View file @
82f887de
...
...
@@ -6,6 +6,7 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/toolchain.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
...
...
@@ -20,11 +21,11 @@ void main() {
expect
(
toolConfig
.
getEngineArtifactsDirectory
(
TargetPlatform
.
android_arm
,
BuildMode
.
debug
).
path
,
endsWith
(
'cache/artifacts/engine/android-arm'
)
endsWith
(
path
.
join
(
'cache'
,
'artifacts'
,
'engine'
,
'android-arm'
)
)
);
expect
(
toolConfig
.
getEngineArtifactsDirectory
(
TargetPlatform
.
android_arm
,
BuildMode
.
release
).
path
,
endsWith
(
'cache/artifacts/engine/android-arm-release'
)
endsWith
(
path
.
join
(
'cache'
,
'artifacts'
,
'engine'
,
'android-arm-release'
)
)
);
expect
(
tempDir
,
isNotNull
);
tempDir
.
deleteSync
(
recursive:
true
);
...
...
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