[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:
asiva 2021-04-12 04:51:05 +00:00 committed by commit-bot@chromium.org
parent 9b1583101e
commit f642761c54
2 changed files with 32 additions and 8 deletions

View file

@ -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);
});
});
}

View file

@ -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);
});
});
}