Reland "[vm] Fix some Fuchsia tests"

This reverts commit 17faf89d02.

The fix is in eventhandler_fuchsia.cc. Rather than changing the
condition on line 401, I've just weakened the assert.

Change-Id: Ia6b1f35e479e4b2fdf1adc77e9513551221a7696
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157564
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
This commit is contained in:
Liam Appelbe 2020-08-06 21:29:29 +00:00 committed by commit-bot@chromium.org
parent 5093ffbd41
commit 6bd220f556
7 changed files with 48 additions and 31 deletions

View file

@ -163,22 +163,30 @@ if (is_fuchsia) {
manifest = "build/fuchsia/dart.cmx"
resource_files = [
".packages",
".dart_tool/package_config.json",
"pkg/testing/test/hello_test.dart",
"tools/addlatexhash.dart",
]
resource_dirs = [
"tests/standalone",
"tests/language_2",
"tests/standalone_2",
"pkg/async_helper",
"pkg/expect",
"pkg/meta",
"pkg/native_stack_traces",
"pkg/smith",
"third_party/pkg/args",
"third_party/pkg/async",
"third_party/pkg/charcode",
"third_party/pkg/collection",
"third_party/pkg/convert",
"third_party/pkg/crypto",
"third_party/pkg/http",
"third_party/pkg/http_parser",
"third_party/pkg/path",
"third_party/pkg/pool",
"third_party/pkg/stack_trace",
"third_party/pkg/string_scanner",
"third_party/pkg/typed_data",
]
resources = []

View file

@ -8,7 +8,8 @@
"deprecated-ambient-replace-as-executable",
"root-ssl-certificates",
"isolated-cache-storage",
"isolated-persistent-storage"
"isolated-persistent-storage",
"isolated-temp"
],
"services": [
"fuchsia.deprecatedtimezone.Timezone",

View file

@ -28,11 +28,10 @@ class FuchsiaEmulator {
Process _server;
String _deviceName;
static Future<void> publishPackage(
int emuCpus, String buildDir, String mode) async {
static Future<void> publishPackage(String buildDir, String mode) async {
if (_inst == null) {
_inst = FuchsiaEmulator();
await _inst._start(emuCpus);
await _inst._start();
}
await _inst._publishPackage(buildDir, mode);
}
@ -48,18 +47,11 @@ class FuchsiaEmulator {
arg.replaceAll(Repository.uri.toFilePath(), '/pkg/data/')));
}
Future<void> _start(int emuCpus) async {
Future<void> _start() async {
// Start the emulator.
DebugLogger.info('Starting Fuchsia emulator with $emuCpus CPUs');
_emu = await Process.start('xvfb-run', [
femuTool,
'--image',
'qemu-x64',
'-N',
'--headless',
'-s',
'$emuCpus'
]);
DebugLogger.info('Starting Fuchsia emulator');
_emu = await Process.start(
'xvfb-run', [femuTool, '--image', 'qemu-x64', '-N', '--headless']);
// Wait until the emulator is ready and has a valid device name.
var deviceNameFuture = Completer<String>();
@ -159,7 +151,7 @@ class FuchsiaEmulator {
var result = await Process.run(fpubTool, [packageFile]);
if (result.exitCode != 0) {
_stop();
_throwResult('Publishing package', result);
throw _formatFailedResult('Publishing package', result);
}
// Verify that the publication was successful by running hello_test.dart.
@ -172,7 +164,7 @@ class FuchsiaEmulator {
_getSshArgs(mode, ['/pkg/data/pkg/testing/test/hello_test.dart']));
if (result.exitCode != 0 || result.stdout != 'Hello, World!\n') {
_stop();
_throwResult('Verifying publication', result);
throw _formatFailedResult('Verifying publication', result);
}
DebugLogger.info('Publication successful');
}
@ -190,10 +182,12 @@ class FuchsiaEmulator {
emulatorPidPattern.firstMatch(result.stdout as String)?.group(1) ??
"");
if (result.exitCode != 0 || emuPid == null) {
_throwResult('Searching for emulator process', result);
DebugLogger.info(
_formatFailedResult('Searching for emulator process', result));
} else {
Process.killPid(emuPid);
DebugLogger.info('Fuchsia emulator stopped');
}
Process.killPid(emuPid);
DebugLogger.info('Fuchsia emulator stopped');
}
if (_server != null) {
@ -205,9 +199,11 @@ class FuchsiaEmulator {
// to manually kill this process, using fserve.sh again.
var result = Process.runSync(fserveTool, ['--kill']);
if (result.exitCode != 0) {
_throwResult('Killing package manager', result);
DebugLogger.info(
_formatFailedResult('Killing package manager', result));
} else {
DebugLogger.info('Fuchsia package server stopped');
}
DebugLogger.info('Fuchsia package server stopped');
}
}
@ -218,8 +214,8 @@ class FuchsiaEmulator {
return output;
}
void _throwResult(String name, ProcessResult result) {
throw '$name failed with exit code: ${result.exitCode}\n\n' +
String _formatFailedResult(String name, ProcessResult result) {
return '$name failed with exit code: ${result.exitCode}\n\n' +
_formatOutputs(result.stdout as String, result.stderr as String);
}
}

View file

@ -155,7 +155,7 @@ Future testConfigurations(List<TestConfiguration> configurations) async {
}
if (configuration.system == System.fuchsia) {
await FuchsiaEmulator.publishPackage(configuration.taskCount,
await FuchsiaEmulator.publishPackage(
configuration.buildDirectory, configuration.mode.name);
}
}

View file

@ -399,7 +399,7 @@ void EventHandlerImplementation::UpdatePort(intptr_t old_mask,
} else if ((old_mask == 0) && (new_mask != 0)) {
AddToPort(port_handle_, di);
} else if ((old_mask != 0) && (new_mask != 0)) {
ASSERT(!di->IsListeningSocket());
ASSERT((old_mask == new_mask) || !di->IsListeningSocket());
RemoveFromPort(port_handle_, di);
AddToPort(port_handle_, di);
}

View file

@ -9,6 +9,7 @@
#include <errno.h> // NOLINT
#include <fcntl.h> // NOLINT
#include <lib/fdio/fdio.h> // NOLINT
#include <lib/fdio/namespace.h> // NOLINT
#include <libgen.h> // NOLINT
#include <sys/mman.h> // NOLINT
@ -51,8 +52,10 @@ File::~File() {
void File::Close() {
ASSERT(handle_->fd() >= 0);
if (handle_->fd() == STDOUT_FILENO) {
// If stdout, redirect fd to /dev/null.
int null_fd = NO_RETRY_EXPECTED(open("/dev/null", O_WRONLY));
// If stdout, redirect fd to Fuchsia's equivalent of /dev/null.
auto* null_fdio = fdio_null_create();
ASSERT(null_fdio != nullptr);
int null_fd = NO_RETRY_EXPECTED(fdio_bind_to_fd(null_fdio, -1, 0));
ASSERT(null_fd >= 0);
VOID_NO_RETRY_EXPECTED(dup2(null_fd, handle_->fd()));
VOID_NO_RETRY_EXPECTED(close(null_fd));

View file

@ -60,6 +60,15 @@ io/wait_for_event_zone_test: SkipByDesign # Uses mirrors.
io/wait_for_test: SkipByDesign # Uses mirrors.
verbose_gc_to_bmu_test: Skip # Attempts to spawn dart using Platform.executable
[ $system == fuchsia ] # Fuchsia test runner doesn't support multi-tests yet.
deny_listed_test: Skip
io/dart_std_io_pipe_test: Skip
io/platform_resolved_executable_test: Skip
io/signals_exception_test: Skip
io/socket_ipv6_test: Skip
package/invalid_uri_test: Skip
regress_29350_test: Skip
[ $builder_tag == swarming && $system == macos ]
io/*: Skip # Issue 30618