mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Revert "[vm] Fix uri/path discrepancy preventing running snapshots via spawnUri"
This reverts commit c4b829ba2c
.
Reason for revert: failures on several bots:
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8906839588400817728/+/steps/test_results/0/logs/unapproved_failing_tests__logs_/0
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8906839597885007504/+/steps/test_results/0/logs/unapproved_failing_tests__logs_/0
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8906839588760701184/+/steps/test_results/0/logs/unapproved_failing_tests__logs_/0
Original change's description:
> [vm] Fix uri/path discrepancy preventing running snapshots via spawnUri
>
> Change-Id: I718d7012d074b73eacfb0d4922fc744b6d2bd77b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110547
> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
TBR=rmacnak@google.com,asiva@google.com,mfairhurst@google.com
Change-Id: Id43441d2259a17dff538c95d455a3839b284cad3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110800
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
0a73628a20
commit
575f5c8b90
|
@ -27,7 +27,6 @@ extern const char* kIsolateSnapshotInstructionsSymbolName;
|
|||
|
||||
static const int64_t kAppSnapshotHeaderSize = 5 * kInt64Size;
|
||||
static const int64_t kAppSnapshotPageSize = 4 * KB;
|
||||
static const char* kFileUriPrefix = "file://";
|
||||
|
||||
class MappedAppSnapshot : public AppSnapshot {
|
||||
public:
|
||||
|
@ -229,24 +228,14 @@ static AppSnapshot* TryReadAppSnapshotDynamicLibrary(const char* script_name) {
|
|||
}
|
||||
#endif // defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
AppSnapshot* Snapshot::TryReadAppSnapshot(const char* script_uri) {
|
||||
UriDecoder decoder(script_uri);
|
||||
script_uri = decoder.decoded();
|
||||
|
||||
std::unique_ptr<char> script_name;
|
||||
if (strncmp(script_uri, kFileUriPrefix, strlen(kFileUriPrefix)) == 0) {
|
||||
script_name.reset(strdup(script_uri + 7));
|
||||
} else {
|
||||
script_name.reset(strdup(script_uri));
|
||||
}
|
||||
|
||||
if (File::GetType(NULL, script_name.get(), true) != File::kIsFile) {
|
||||
AppSnapshot* Snapshot::TryReadAppSnapshot(const char* script_name) {
|
||||
if (File::GetType(NULL, script_name, true) != File::kIsFile) {
|
||||
// If 'script_name' refers to a pipe, don't read to check for an app
|
||||
// snapshot since we cannot rewind if it isn't (and couldn't mmap it in
|
||||
// anyway if it was).
|
||||
return NULL;
|
||||
}
|
||||
AppSnapshot* snapshot = TryReadAppSnapshotBlobs(script_name.get());
|
||||
AppSnapshot* snapshot = TryReadAppSnapshotBlobs(script_name);
|
||||
if (snapshot != NULL) {
|
||||
return snapshot;
|
||||
}
|
||||
|
@ -258,11 +247,11 @@ AppSnapshot* Snapshot::TryReadAppSnapshot(const char* script_uri) {
|
|||
// On Linux and OSX, resolve the script path before passing into dlopen()
|
||||
// since dlopen will not search the filesystem for paths like 'libtest.so'.
|
||||
std::unique_ptr<char, decltype(std::free)*> absolute_path{
|
||||
realpath(script_name.get(), nullptr), std::free};
|
||||
script_name.reset(strdup(absolute_path.get()));
|
||||
realpath(script_name, nullptr), std::free};
|
||||
script_name = absolute_path.get();
|
||||
#endif
|
||||
|
||||
snapshot = TryReadAppSnapshotDynamicLibrary(script_name.get());
|
||||
snapshot = TryReadAppSnapshotDynamicLibrary(script_name);
|
||||
|
||||
if (snapshot != NULL) {
|
||||
return snapshot;
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (c) 2019, 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.
|
||||
|
||||
import "dart:async";
|
||||
import "dart:io";
|
||||
import "dart:isolate";
|
||||
|
||||
import "package:path/path.dart" as p;
|
||||
|
||||
import "snapshot_test_helper.dart";
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
if (args.contains('--child')) {
|
||||
print('done');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Platform.script.toString().endsWith(".dart")) {
|
||||
print("This test must run from source");
|
||||
return;
|
||||
}
|
||||
|
||||
await withTempDir((String tmp) async {
|
||||
// We don't support snapshot with code on IA32.
|
||||
final String appSnapshotKind =
|
||||
Platform.version.contains("ia32") ? "app" : "app-jit";
|
||||
|
||||
await Process.run(Platform.executable, [
|
||||
'--snapshot=$tmp/fib.dart.snapshot',
|
||||
'--snapshot-kind=$appSnapshotKind',
|
||||
Platform.script.toFilePath(),
|
||||
'--child'
|
||||
]);
|
||||
|
||||
final onExit = RawReceivePort();
|
||||
final onError = RawReceivePort();
|
||||
|
||||
onError.handler = (e) {
|
||||
onError.close();
|
||||
onExit.close();
|
||||
throw e;
|
||||
};
|
||||
|
||||
onExit.handler = (_) {
|
||||
onError.close();
|
||||
onExit.close();
|
||||
};
|
||||
|
||||
await Isolate.spawnUri(
|
||||
Uri.file('$tmp/fib.dart.snapshot'), ['--child'], null,
|
||||
onExit: onExit.sendPort, onError: onError.sendPort);
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue