summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml6
-rw-r--r--BUILD.gn4
-rw-r--r--libdeno/test.cc12
3 files changed, 13 insertions, 9 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 8fb6971d0..b31b9d2ae 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -381,11 +381,7 @@ after_test:
Select-String $trap -Path $files -SimpleMatch | where {
# V8 took the liberty to produce an absolute path in their ninja
# output. We can't do much about that, so we just ignore it.
- $_.Line -notmatch "v8/builtins-generated/bytecodes-builtins-list.h" -and
- # The absolute path to snapshot_libdeno_test.bin is passed to test_cc
- # via pre-processor variable. It's absolute because we want to be able
- # to execute test_cc from both the project root and the build root.
- $_.Line -notmatch "snapshot_libdeno_test.bin"
+ $_.Line -notmatch "v8/builtins-generated/bytecodes-builtins-list.h"
} | tee -Variable line_matches
if ($line_matches) {
$ctx = $line_matches.Line |
diff --git a/BUILD.gn b/BUILD.gn
index cc9850778..039909893 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -197,8 +197,8 @@ v8_executable("test_cc") {
data = [
"$target_gen_dir/snapshot_libdeno_test.bin",
]
- snapshot_abs_path = rebase_path(data[0])
- defines = [ "SNAPSHOT_PATH=\"$snapshot_abs_path\"" ]
+ snapshot_path = rebase_path(data[0], root_build_dir)
+ defines = [ "SNAPSHOT_PATH=\"$snapshot_path\"" ]
configs = [ ":deno_config" ]
}
diff --git a/libdeno/test.cc b/libdeno/test.cc
index c178d109a..f48e916b9 100644
--- a/libdeno/test.cc
+++ b/libdeno/test.cc
@@ -5,10 +5,18 @@
deno_buf snapshot = {nullptr, 0, nullptr, 0};
int main(int argc, char** argv) {
+ // Locate the snapshot.
+ std::string exe_path;
+ if (!deno::ExePath(&exe_path)) {
+ std::cerr << "deno::ExePath() failed" << std::endl;
+ return 1;
+ }
+ std::string snapshot_path = deno::Dirname(exe_path) + SNAPSHOT_PATH;
+
// Load the snapshot.
std::string contents;
- if (!deno::ReadFileToString(SNAPSHOT_PATH, &contents)) {
- printf("Failed to read file %s\n", SNAPSHOT_PATH);
+ if (!deno::ReadFileToString(snapshot_path.c_str(), &contents)) {
+ std::cerr << "Failed to read snapshot from " << snapshot_path << std::endl;
return 1;
}
snapshot.data_ptr =