[mjsunit][tools] Sync module files for tests

- Update file list in andrdoid-sync.sh
- Update testcase.py module resources regexp to handle more import cases

Bug: v8:10668
Change-Id: I801464336b9a149ca1393d120c3332e5dc1f6345
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2442612
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Auto-Submit: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70380}
This commit is contained in:
Camillo Bruni 2020-10-07 11:46:43 +02:00 committed by Commit Bot
parent 4e077ff044
commit f3c7792985
2 changed files with 18 additions and 19 deletions

View File

@ -92,15 +92,16 @@ sync_file "$OUTDIR/$ARCH_MODE/snapshot_blob.bin"
sync_file "$OUTDIR/$ARCH_MODE/unittests"
echo ""
echo -n "sync to $ANDROID_V8/tools"
sync_file tools/consarray.js
sync_file tools/codemap.js
sync_file tools/csvparser.js
sync_file tools/profile.js
sync_file tools/splaytree.js
sync_file tools/profile_view.js
sync_file tools/logreader.js
sync_file tools/arguments.js
sync_file tools/tickprocessor.js
sync_file tools/arguments.mjs
sync_file tools/codemap.mjs
sync_file tools/consarray.mjs
sync_file tools/csvparser.mjs
sync_file tools/dumpcpp.mjs
sync_file tools/logreader.mjs
sync_file tools/profile.mjs
sync_file tools/profile_view.mjs
sync_file tools/splaytree.mjs
sync_file tools/tickprocessor.mjs
echo ""
sync_dir test/intl
sync_dir test/message

View File

@ -50,12 +50,12 @@ LOAD_PATTERN = re.compile(
r"(?:load|readbuffer|read)\((?:'|\")([^'\"]+)(?:'|\")\)")
# Pattern to auto-detect files to push on Android for statements like:
# import "path/to/file.js"
MODULE_RESOURCES_PATTERN_1 = re.compile(
r"(?:import|export)(?:\(| )(?:'|\")([^'\"]+)(?:'|\")")
# Pattern to auto-detect files to push on Android for statements like:
# import foobar from "path/to/file.js"
MODULE_RESOURCES_PATTERN_2 = re.compile(
r"(?:import|export).*from (?:'|\")([^'\"]+)(?:'|\")")
# import {foo, bar} from "path/to/file.js"
# import("module.mjs").catch()...
MODULE_RESOURCES_PATTERN = re.compile(
r"(?:import|export)(?:[^'\"]*?from)?\s*\(?['\"]([^'\"]+)['\"]",
re.MULTILINE | re.DOTALL)
TIMEOUT_LONG = "long"
@ -409,12 +409,10 @@ class D8TestCase(TestCase):
for match in LOAD_PATTERN.finditer(source):
# Files in load statements are relative to base dir.
add_path(match.group(1))
for match in MODULE_RESOURCES_PATTERN_1.finditer(source):
for match in MODULE_RESOURCES_PATTERN.finditer(source):
# Imported files are relative to the file importing them.
add_path(os.path.join(os.path.dirname(file), match.group(1)))
for match in MODULE_RESOURCES_PATTERN_2.finditer(source):
# Imported files are relative to the file importing them.
add_path(os.path.join(os.path.dirname(file), match.group(1)))
add_path(os.path.normpath(
os.path.join(os.path.dirname(file), match.group(1))))
return result
def _get_resources(self):