[CFE] Only include git staged files in explicit creation test
Change-Id: Ic1d006e6ce1596d5e4cb0f4e2222912d383c80ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163063
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
diff --git a/pkg/front_end/test/explicit_creation_test.dart b/pkg/front_end/test/explicit_creation_test.dart
index 9416765..215f824 100644
--- a/pkg/front_end/test/explicit_creation_test.dart
+++ b/pkg/front_end/test/explicit_creation_test.dart
@@ -39,6 +39,8 @@
import 'package:kernel/target/targets.dart';
import "package:vm/target/vm.dart" show VmTarget;
+import 'testing_utils.dart' show getGitFiles;
+
final Uri repoDir = _computeRepoDir();
Uri _computeRepoDir() {
@@ -77,10 +79,13 @@
}
}
for (Uri uri in libUris) {
+ Set<Uri> gitFiles = await getGitFiles(uri);
List<FileSystemEntity> entities =
new Directory.fromUri(uri).listSync(recursive: true);
for (FileSystemEntity entity in entities) {
- if (entity is File && entity.path.endsWith(".dart")) {
+ if (entity is File &&
+ entity.path.endsWith(".dart") &&
+ gitFiles.contains(entity.uri)) {
options.inputs.add(entity.uri);
}
}
diff --git a/pkg/front_end/test/lint_suite.dart b/pkg/front_end/test/lint_suite.dart
index 23b1f6b..2831434 100644
--- a/pkg/front_end/test/lint_suite.dart
+++ b/pkg/front_end/test/lint_suite.dart
@@ -93,7 +93,7 @@
Stream<LintTestDescription> list(Chain suite) async* {
Set<Uri> gitFiles;
if (onlyInGit) {
- gitFiles = await getGitFiles(suite);
+ gitFiles = await getGitFiles(suite.uri);
}
Directory testRoot = new Directory.fromUri(suite.uri);
diff --git a/pkg/front_end/test/testing_utils.dart b/pkg/front_end/test/testing_utils.dart
index 0ab71ff..b966e74 100644
--- a/pkg/front_end/test/testing_utils.dart
+++ b/pkg/front_end/test/testing_utils.dart
@@ -10,7 +10,7 @@
Chain suite, bool onlyInGit, Stream<TestDescription> base) async* {
Set<Uri> gitFiles;
if (onlyInGit) {
- gitFiles = await getGitFiles(suite);
+ gitFiles = await getGitFiles(suite.uri);
}
await for (TestDescription description in base) {
if (onlyInGit && !gitFiles.contains(description.uri)) {
@@ -20,14 +20,14 @@
}
}
-Future<Set<Uri>> getGitFiles(Chain suite) async {
+Future<Set<Uri>> getGitFiles(Uri uri) async {
ProcessResult result = await Process.run("git", ["ls-files", "."],
- workingDirectory: new Directory.fromUri(suite.uri).absolute.path,
+ workingDirectory: new Directory.fromUri(uri).absolute.path,
runInShell: true);
String stdout = result.stdout;
return stdout
.split(new RegExp('^', multiLine: true))
- .map((line) => suite.uri.resolve(line.trimRight()))
+ .map((line) => uri.resolve(line.trimRight()))
.toSet();
}