Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically extend the Dartium expiration date for test/coverage tasks #266

Merged
merged 1 commit into from
Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/src/task_process.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ class TaskProcess {
StreamController<String> _stderr = new StreamController();

TaskProcess(String executable, List<String> arguments,
{String workingDirectory}) {
{String workingDirectory, Map<String, String> environment}) {
Process
.start(executable, arguments, workingDirectory: workingDirectory)
.start(executable, arguments,
workingDirectory: workingDirectory, environment: environment)
.then((process) {
_process = process;
process.stdout
Expand Down
6 changes: 4 additions & 2 deletions lib/src/tasks/coverage/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'dart:async';
import 'dart:io';

import 'package:dart2_constant/convert.dart' as convert;
import 'package:dart_dev/src/util.dart';
import 'package:dart_dev/util.dart' show TaskProcess, getOpenPort;
import 'package:path/path.dart' as path;

Expand Down Expand Up @@ -552,8 +553,9 @@ class CoverageTask extends Task {
_coverageOutput.add('');
_coverageOutput.add('Running test suite ${testPath}');
_coverageOutput.add('$executable ${args.join(' ')}\n');
TaskProcess process =
_lastTestProcess = new TaskProcess('content_shell', args);
TaskProcess process = _lastTestProcess = new TaskProcess(
'content_shell', args,
environment: dartiumExpirationOverrideEnv);

// Content-shell dumps render tree to stderr, which is where the test
// results will be. The observatory port should be output to stderr as
Expand Down
4 changes: 3 additions & 1 deletion lib/src/tasks/test/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:dart_dev/util.dart' show TaskProcess;

import 'package:dart_dev/src/tasks/task.dart';
import 'package:dart_dev/src/tools/selenium.dart' show SeleniumHelper;
import 'package:dart_dev/src/util.dart';

TestTask test(
{int concurrency,
Expand All @@ -38,7 +39,8 @@ TestTask test(
args.addAll(additionalArgs);
args.addAll(tests);

TaskProcess process = new TaskProcess(executable, args);
TaskProcess process = new TaskProcess(executable, args,
environment: dartiumExpirationOverrideEnv);
Completer outputProcessed = new Completer();
TestTask task = new TestTask('$executable ${args.join(' ')}',
Future.wait([process.done, outputProcessed.future]));
Expand Down
10 changes: 10 additions & 0 deletions lib/src/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,13 @@ Future runAll(List tasks) async {
}
}
}

final _newExpirationDate = new DateTime.now().add(const Duration(days: 1000));

/// A map of environment variables that will set the Dartium expiration
/// to 1000 days after the current date.
final Map<String, String> dartiumExpirationOverrideEnv = new Map.unmodifiable({
// This is given in seconds since epoch
'DARTIUM_EXPIRATION_TIME':
(_newExpirationDate.millisecondsSinceEpoch / 1000).toStringAsFixed(0),
});