Update customer test logging (#154577)
Reverts flutter/flutter#154356, and updates logging so that the test suite's name and runtime is always logged, not just on failure. The issue is resolved in https://github.com/flutter/tests/pull/406 Related to https://github.com/flutter/flutter/issues/154251
This commit is contained in:
parent
132dc8f82d
commit
72ebfc7dc0
@ -54,18 +54,11 @@ Future<bool> runTests({
|
|||||||
print('');
|
print('');
|
||||||
|
|
||||||
for (final File file in shardedFiles) {
|
for (final File file in shardedFiles) {
|
||||||
if (verbose) {
|
// Always print name of running task for debugging individual customer test
|
||||||
|
// suites.
|
||||||
print('Processing ${file.path}...');
|
print('Processing ${file.path}...');
|
||||||
}
|
|
||||||
|
|
||||||
void printHeader() {
|
|
||||||
if (!verbose) {
|
|
||||||
print('Processing ${file.path}...');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void failure(String message) {
|
void failure(String message) {
|
||||||
printHeader();
|
|
||||||
print('ERROR: $message');
|
print('ERROR: $message');
|
||||||
failures += 1;
|
failures += 1;
|
||||||
}
|
}
|
||||||
@ -92,7 +85,7 @@ Future<bool> runTests({
|
|||||||
try {
|
try {
|
||||||
assert(instructions.fetch.isNotEmpty);
|
assert(instructions.fetch.isNotEmpty);
|
||||||
for (final String fetchCommand in instructions.fetch) {
|
for (final String fetchCommand in instructions.fetch) {
|
||||||
success = await shell(fetchCommand, checkout, verbose: verbose, silentFailure: skipOnFetchFailure, failedCallback: printHeader);
|
success = await shell(fetchCommand, checkout, verbose: verbose, silentFailure: skipOnFetchFailure);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
if (skipOnFetchFailure) {
|
if (skipOnFetchFailure) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
@ -116,7 +109,6 @@ Future<bool> runTests({
|
|||||||
setupCommand,
|
setupCommand,
|
||||||
customerRepo,
|
customerRepo,
|
||||||
verbose: verbose,
|
verbose: verbose,
|
||||||
failedCallback: printHeader,
|
|
||||||
);
|
);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
failure('Setup command failed: $setupCommand');
|
failure('Setup command failed: $setupCommand');
|
||||||
@ -133,12 +125,12 @@ Future<bool> runTests({
|
|||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
success = await shell('flutter packages get', resolvedUpdateDirectory, verbose: verbose, failedCallback: printHeader);
|
success = await shell('flutter packages get', resolvedUpdateDirectory, verbose: verbose);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
failure('Could not run "flutter pub get" in ${updateDirectory.path}, which was specified as an update directory.');
|
failure('Could not run "flutter pub get" in ${updateDirectory.path}, which was specified as an update directory.');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
success = await shell('dart fix --apply', resolvedUpdateDirectory, verbose: verbose, failedCallback: printHeader);
|
success = await shell('dart fix --apply', resolvedUpdateDirectory, verbose: verbose);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
failure('Could not run "dart fix" in ${updateDirectory.path}, which was specified as an update directory.');
|
failure('Could not run "dart fix" in ${updateDirectory.path}, which was specified as an update directory.');
|
||||||
break;
|
break;
|
||||||
@ -162,7 +154,7 @@ Future<bool> runTests({
|
|||||||
}
|
}
|
||||||
for (final String testCommand in instructions.tests) {
|
for (final String testCommand in instructions.tests) {
|
||||||
testCount += 1;
|
testCount += 1;
|
||||||
success = await shell(testCommand, customerRepo, verbose: verbose, failedCallback: printHeader);
|
success = await shell(testCommand, customerRepo, verbose: verbose);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
failure('One or more tests from ${path.basenameWithoutExtension(file.path)} failed.');
|
failure('One or more tests from ${path.basenameWithoutExtension(file.path)} failed.');
|
||||||
break;
|
break;
|
||||||
@ -170,11 +162,10 @@ Future<bool> runTests({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stopwatch.stop();
|
stopwatch.stop();
|
||||||
if (verbose && success) {
|
// Always print test runtime for debugging.
|
||||||
print('Tests finished in ${(stopwatch.elapsed.inSeconds / repeat).toStringAsFixed(2)} seconds per iteration.');
|
print('Tests finished in ${(stopwatch.elapsed.inSeconds / repeat).toStringAsFixed(2)} seconds per iteration.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
print('Deleting temporary directory...');
|
print('Deleting temporary directory...');
|
||||||
|
@ -129,9 +129,7 @@ Future<bool> run(List<String> arguments) async {
|
|||||||
return runTests(
|
return runTests(
|
||||||
repeat: repeat,
|
repeat: repeat,
|
||||||
skipOnFetchFailure: skipOnFetchFailure,
|
skipOnFetchFailure: skipOnFetchFailure,
|
||||||
// TODO(Piinks): Restore after resolving https://github.com/flutter/flutter/issues/154251
|
verbose: verbose,
|
||||||
// Needed to see time stamps of individual test runs and identify long running test.
|
|
||||||
verbose: true,
|
|
||||||
numberShards: numberShards,
|
numberShards: numberShards,
|
||||||
shardIndex: shardIndex,
|
shardIndex: shardIndex,
|
||||||
files: files,
|
files: files,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user