Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: tests/compiler/dart2js/cps_ir/up_to_date_test.dart

Issue 2246623002: Delete CPS IR (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/cps_ir/supercall_3_test.dart ('k') | tests/compiler/dart2js/cps_ir/update_all.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/cps_ir/up_to_date_test.dart
diff --git a/tests/compiler/dart2js/cps_ir/up_to_date_test.dart b/tests/compiler/dart2js/cps_ir/up_to_date_test.dart
deleted file mode 100644
index a9508a4b6fdb13390e43b58bcff6c7649ce34cc4..0000000000000000000000000000000000000000
--- a/tests/compiler/dart2js/cps_ir/up_to_date_test.dart
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Test that cps_ir/update_all.dart and every cps_ir/*_test.dart file are up to
-/// date. There should be a line in update_all and a file in the cps_ir folder
-/// for each test file in the `input/` folder.
-library tests.compiler.dart2js.cps_ir.up_to_date_test;
-
-import 'dart:io';
-
-main(args) {
- bool update = args.length > 0 && args[0] == 'update';
- var inputDir = new Directory.fromUri(Platform.script.resolve('input'));
-
- bool errorsFound = false;
-
- // Note: we create a test file per input file because invoking dart2js many
- // times on a single test often makes test.py timeout.
- //
- // We tried using multi-tests for this, but it is unfortunately brittle. For
- // example, multi-tests can't import code from one folder above the current
- // directory, which prevents us from putting generated tests under a different
- // folder than the rest of the helpers (like memory_compiler.dart)
- var files = inputDir.listSync().map((f) => f.uri.pathSegments.last).toList();
- files.sort();
- for (var file in files) {
- var testFilename = file.replaceAll('.dart', '_test.dart');
- var contents = generateTestFile(file);
- if (checkAndMaybeUpdate(testFilename, contents, update)) errorsFound = true;
- }
-
- var updateAllContents = generateUpdateAllFile(files);
- if (checkAndMaybeUpdate('update_all.dart', updateAllContents, update)) {
- errorsFound = true;
- }
-
- if (errorsFound) {
- print(regenerateMessage);
- exit(1);
- }
-}
-
-/// Checks and if [update] is true, updates an autogenerated test file.
-///
-/// This doesn't update an actual test expectation, that's done by executing the
-/// files that we generate here.
-bool checkAndMaybeUpdate(String filename, String contents,
- bool update) {
- var testFile = new File.fromUri(Platform.script.resolve(filename));
- bool exists = testFile.existsSync();
- var isUpToDate = exists && testFile.readAsStringSync() == contents;
- if (isUpToDate) {
- print('PASS: ${filename} is up to date.');
- } else if (update) {
- testFile.writeAsStringSync(contents);
- print('INFO: ${filename} was updated.');
- } else {
- print("FAILED: ${filename} is ${exists ? 'out of date' : 'missing'}");
- return true;
- }
- return false;
-}
-
-String generateUpdateAllFile(List<String> files) {
- var lines = files.map((f) => "runTest('$f', update: true);");
- return '''
-// ---- AUTO-GENERATED -------------------
-// This file was autogenerated by running:
-//
-// dart path/to/${Platform.script.pathSegments.last} update
-//
-// Do not edit this file by hand.
-// ---------------------------------------
-
-library tests.compiler.dart2js.cps_ir.update_all;
-
-import 'runner.dart';
-
-main(args) {
- ${lines.join('\n ')}
-}
-''';
-}
-
-String generateTestFile(String file) => '''
-// ---- AUTO-GENERATED -------------------
-// This file was autogenerated by running:
-//
-// dart path/to/${Platform.script.pathSegments.last} update
-//
-// Do not edit this file by hand.
-// ---------------------------------------
-
-library tests.compiler.dart2js.cps_ir.$file;
-
-import 'runner.dart';
-
-main(args) {
- runTest("$file", update: args.length > 0 && args[0] == "update");
-}
-''';
-
-
-String get regenerateMessage {
- var flags = Platform.packageRoot == null
- ? '' : '--package-root=${Platform.packageRoot} ';
- return '''
-
-To regenerate the test files, please run:
- dart $flags${Platform.script} update''';
-}
« no previous file with comments | « tests/compiler/dart2js/cps_ir/supercall_3_test.dart ('k') | tests/compiler/dart2js/cps_ir/update_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698