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

Unified Diff: samples/tests/samples/standalone/sample_extension_test.dart

Issue 23717003: Reorganize tests for samples so the test is discoverable from the sample (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
Index: samples/tests/samples/standalone/sample_extension_test.dart
diff --git a/samples/tests/samples/standalone/sample_extension_test.dart b/samples/tests/samples/standalone/sample_extension_test.dart
deleted file mode 100644
index 8b98e40db4444a85462a6d3e0265ddc082550a44..0000000000000000000000000000000000000000
--- a/samples/tests/samples/standalone/sample_extension_test.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2013, 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.
-//
-// Dart test program for testing native extensions.
-
-import 'dart:async';
-import 'dart:io';
-import 'dart:isolate';
-
-import "package:expect/expect.dart";
-import "package:path/path.dart";
-
-Future copyFileToDirectory(String file, String directory) {
- String src = file;
- String dst = directory;
- switch (Platform.operatingSystem) {
- case 'linux':
- case 'macos':
- return Process.run('cp', [src, dst]);
- case 'windows':
- return Process.run('cmd.exe', ['/C', 'copy $src $dst']);
- default:
- Expect.fail('Unknown operating system ${Platform.operatingSystem}');
- }
-}
-
-String getNativeLibraryPath(String buildDirectory) {
- switch (Platform.operatingSystem) {
- case 'linux':
- return join(buildDirectory, 'lib.target', 'libsample_extension.so');
- case 'macos':
- return join(buildDirectory, 'libsample_extension.dylib');
- case 'windows':
- return join(buildDirectory, 'sample_extension.dll');
- default:
- Expect.fail('Unknown operating system ${Platform.operatingSystem}');
- }
-}
-
-void main() {
- String scriptDirectory = dirname(Platform.script);
- String buildDirectory = dirname(Platform.executable);
- Directory tempDirectory = new Directory('').createTempSync();
- String testDirectory = tempDirectory.path;
- String sourceDirectory =
- join(scriptDirectory, '..', '..', '..', 'sample_extension');
-
- // Copy sample_extension shared library, sample_extension dart files and
- // sample_extension tests to the temporary test directory.
- copyFileToDirectory(getNativeLibraryPath(buildDirectory), testDirectory)
- .then((_) => Future.forEach(['sample_synchronous_extension.dart',
- 'sample_asynchronous_extension.dart',
- 'test_sample_synchronous_extension.dart',
- 'test_sample_asynchronous_extension.dart'],
- (file) => copyFileToDirectory(join(sourceDirectory, file), testDirectory)
- ))
-
- .then((_) => Future.forEach(['test_sample_synchronous_extension.dart',
- 'test_sample_asynchronous_extension.dart'],
- (test) => Process.run(Platform.executable, [join(testDirectory, test)])
- .then((ProcessResult result) {
- if (result.exitCode != 0) {
- print('Failing test: ${join(sourceDirectory, test)}');
- print('Failing process stdout: ${result.stdout}');
- print('Failing process stderr: ${result.stderr}');
- print('End failing process stderr');
- Expect.fail('Test failed with exit code ${result.exitCode}');
- }
- })
- ))
- .whenComplete(() => tempDirectory.deleteSync(recursive: true));
-}

Powered by Google App Engine
This is Rietveld 408576698