mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
[Runtime/Tests] - Do not output large amount of test data to stdout
- typed_data_isolate_test was printing received data to stdout which causes trucation issues when running in the test script, changed test to verify the received data and not print to stdout. TEST=modifying a test. Change-Id: I99357960e80fcdd2d65676c6bef326799f1d4d98 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194884 Commit-Queue: Siva Annamalai <asiva@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
parent
9b1583101e
commit
f642761c54
2 changed files with 32 additions and 8 deletions
|
@ -13,24 +13,36 @@ library TypedDataIsolateTest;
|
|||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
second(message) {
|
||||
var data = message[0];
|
||||
var replyTo = message[1];
|
||||
print('got data');
|
||||
print(data);
|
||||
print('printed data');
|
||||
replyTo.send('OK');
|
||||
try {
|
||||
print('got data');
|
||||
var rdata = new File(Platform.script.toFilePath()).readAsBytesSync();
|
||||
Expect.equals(data.length, rdata.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
Expect.equals(data[i], rdata[i]);
|
||||
}
|
||||
print('validated received data');
|
||||
replyTo.send('OK');
|
||||
} catch (e) {
|
||||
replyTo.send('Not OK');
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
var result = true;
|
||||
asyncStart();
|
||||
new File(Platform.script.toFilePath()).readAsBytes().then((List<int> data) {
|
||||
var response = new ReceivePort();
|
||||
var remote = Isolate.spawn(second, [data, response.sendPort]);
|
||||
response.first.then((reply) {
|
||||
print('got reply');
|
||||
result = (reply == 'OK');
|
||||
asyncEnd();
|
||||
Expect.isTrue(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,24 +13,36 @@ library TypedDataIsolateTest;
|
|||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
second(message) {
|
||||
var data = message[0];
|
||||
var replyTo = message[1];
|
||||
print('got data');
|
||||
print(data);
|
||||
print('printed data');
|
||||
replyTo.send('OK');
|
||||
try {
|
||||
print('got data');
|
||||
var rdata = new File(Platform.script.toFilePath()).readAsBytesSync();
|
||||
Expect.equals(data.length, rdata.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
Expect.equals(data[i], rdata[i]);
|
||||
}
|
||||
print('validated received data');
|
||||
replyTo.send('OK');
|
||||
} catch (e) {
|
||||
replyTo.send('Not OK');
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
var result = true;
|
||||
asyncStart();
|
||||
new File(Platform.script.toFilePath()).readAsBytes().then((List<int> data) {
|
||||
var response = new ReceivePort();
|
||||
var remote = Isolate.spawn(second, [data, response.sendPort]);
|
||||
response.first.then((reply) {
|
||||
print('got reply');
|
||||
result = (reply == 'OK');
|
||||
asyncEnd();
|
||||
Expect.isTrue(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue