[gn] Port test262 archiving to gn

This calls the action that archives test262 in gn. In gn
we can't specify an action output outside the product
directory. This works around it with an extra action
stamp file in the product directory, while the archive
remains in the test directory.

We don't want to generate the archive in the product
directory, as some legacy archiving scripts might include
it and it's too large. It should only be included in the
swarming tasks that are going to use it for testing.

BUG=chromium:474921

Review-Url: https://codereview.chromium.org/2034713005
Cr-Commit-Position: refs/heads/master@{#36731}
This commit is contained in:
machenbach 2016-06-06 01:55:13 -07:00 committed by Commit bot
parent 8ee22392f8
commit 0d65554c05
4 changed files with 49 additions and 9 deletions

1
.gn
View File

@ -38,4 +38,5 @@ exec_script_whitelist = [
"//build/toolchain/gcc_toolchain.gni",
"//build/toolchain/mac/BUILD.gn",
"//build/toolchain/win/BUILD.gn",
"//test/test262/BUILD.gn",
]

View File

@ -26,7 +26,7 @@ group("gn_all") {
":default_run",
":mozilla_run",
":simdjs_run",
":test262_run",
"test262:test262_run",
]
}
}
@ -185,14 +185,6 @@ v8_isolate_run("simdjs") {
isolate = "simdjs/simdjs.isolate"
}
v8_isolate_run("test262") {
deps = [
"..:d8_run",
]
isolate = "test262/test262.isolate"
}
v8_isolate_run("unittests") {
deps = [
"unittests:unittests",

34
test/test262/BUILD.gn Normal file
View File

@ -0,0 +1,34 @@
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../../gni/isolate.gni")
if (v8_test_isolation_mode != "noop") {
action("archive_test262") {
visibility = [ ":*" ]
script = "archive.py"
inputs = [
"list.py",
]
sources = exec_script("list.py", [], "list lines")
outputs = [
"$target_gen_dir/test262_archiving.stamp",
]
args = rebase_path(outputs, root_build_dir)
}
}
v8_isolate_run("test262") {
deps = [
":archive_test262",
"../..:d8_run",
]
isolate = "test262.isolate"
}

View File

@ -4,7 +4,13 @@
# found in the LICENSE file.
import os
import sys
import tarfile
import time
# In GN we expect the path to a stamp file as an argument.
if len(sys.argv) == 2:
STAMP_FILE = os.path.abspath(sys.argv[1])
os.chdir(os.path.dirname(os.path.abspath(__file__)))
@ -21,3 +27,10 @@ def filter_git(tar_info):
with tarfile.open('data.tar', 'w') as tar:
tar.add('data', filter=filter_git)
# Workaround for GN. We can't specify the tarfile as output because it's
# not in the product directory. Therefore we track running of this script
# with an extra stamp file in the product directory.
if len(sys.argv) == 2:
with open(STAMP_FILE, 'w') as f:
f.write(str(time.time()))