Skip to content

Commit

Permalink
Update source and test driver for running test262 on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Seonghyun Kim <[email protected]>
  • Loading branch information
ksh8281 committed Jul 1, 2023
1 parent 6216708 commit 078d1b4
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 112 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/es-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,40 +43,52 @@ jobs:
ninja -Cout/mac/x64
./tools/run-tests.py --engine="./out/mac/x64/escargot" new-es
build-on-windows:
test-on-windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: szenius/[email protected]
with:
timezoneWindows: "Pacific Standard Time"
- uses: lukka/get-cmake@latest
- uses: GuillaumeFalourd/[email protected]
with:
sdk-version: 20348
- uses: ilammy/[email protected]
- name: Copy octane
run: |
copy test\octane\*.js
dir
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
arch: x86
sdk: "10.0.20348.0"
python-version: '3.11'
- name: Install msvc redist package
run: |
(new-object System.Net.WebClient).DownloadFile('https://github.com/abbodi1406/vcredist/releases/download/v0.73.0/VisualCppRedist_AIO_x86_x64.exe','VisualCppRedist_AIO_x86_x64.exe')
.\VisualCppRedist_AIO_x86_x64.exe /y
- name: Copy octane
run: |
copy test\octane\*.js
dir
- uses: ilammy/[email protected]
with:
arch: x86
sdk: "10.0.20348.0"
- name: Build Win32 Release
run: |
CMake -G "Visual Studio 16 2019" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=release -Bout/win32_release_ninja/ -DESCARGOT_HOST=windows -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_TEST=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
CMake -G "Visual Studio 16 2019" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=release -Bout/win32_release_ninja/ -DESCARGOT_HOST=windows -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
CMake --build out/win32_release_ninja/ --config Release
.\out\win32_release_ninja\escargot.exe run.js
- name: Run test262 on win32
run: |
set GC_FREE_SPACE_DIVISOR=1
set PYTHONUTF8=1
python tools\run-tests.py --engine=%cd%\out\win32_release_ninja\escargot.exe test262-without-intl402
shell: cmd
- uses: ilammy/[email protected]
with:
arch: x64
sdk: "10.0.20348.0"
- name: Build Win64 Release
run: |
CMake -G "Visual Studio 16 2019" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=x64 -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release -Bout/win64_release_ninja/ -DESCARGOT_HOST=windows -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_TEST=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
CMake -G "Visual Studio 16 2019" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=x64 -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release -Bout/win64_release_ninja/ -DESCARGOT_HOST=windows -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
CMake --build out/win64_release_ninja/ --config Release
.\out\win64_release_ninja\escargot.exe run.js
- if: ${{ failure() }}
Expand Down
4 changes: 4 additions & 0 deletions src/util/SpinLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class SpinLock {

public:
SpinLock()
#if defined(COMPILER_MSVC)
: m_locked()
#else
: m_locked(ATOMIC_FLAG_INIT)
#endif
{
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/GCutil
58 changes: 31 additions & 27 deletions tools/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ def run_internal_test(engine, arch):
run(['python', 'driver.py', engine, 'internal-test-cases.txt'],
cwd=INTERNAL_DIR)


@runner('test262', default=True)
def run_test262(engine, arch):
def copy_test262_files():
TEST262_OVERRIDE_DIR = join(PROJECT_SOURCE_DIR, 'tools', 'test', 'test262')
TEST262_DIR = join(PROJECT_SOURCE_DIR, 'test', 'test262')

Expand All @@ -182,7 +180,11 @@ def run_test262(engine, arch):
copy(join(TEST262_OVERRIDE_DIR, 'parseTestRecord.py'), join(TEST262_DIR, 'tools', 'packaging', 'parseTestRecord.py'))
copy(join(TEST262_OVERRIDE_DIR, 'test262.py'), join(TEST262_DIR, 'tools', 'packaging', 'test262.py')) # for parallel running (we should re-implement this for es6 suite)

stdout = run(['pypy', join('tools', 'packaging', 'test262.py'),
@runner('test262', default=True)
def run_test262(engine, arch):
copy_test262_files()
TEST262_DIR = join(PROJECT_SOURCE_DIR, 'test', 'test262')
stdout = run(['python', join('tools', 'packaging', 'test262.py'),
'--command', engine,
'--summary'],
cwd=TEST262_DIR,
Expand All @@ -193,18 +195,31 @@ def run_test262(engine, arch):
if summary.find('- All tests succeeded') < 0:
raise Exception('test262 failed')
print('test262: All tests passed')

@runner('test262-strict', default=True)
def run_test262_strict(engine, arch):
TEST262_OVERRIDE_DIR = join(PROJECT_SOURCE_DIR, 'tools', 'test', 'test262')
@runner('test262-without-intl402', default=False)
def run_test262_without_intl402(engine, arch):
copy_test262_files()
TEST262_DIR = join(PROJECT_SOURCE_DIR, 'test', 'test262')
stdout = run(['python', join('tools', 'packaging', 'test262.py'),
'--skip', 'Temporal', '--skip', 'intl402',
'--command', engine,
'--summary'],
cwd=TEST262_DIR,
env={'TZ': 'US/Pacific'},
stdout=PIPE)

copy(join(TEST262_OVERRIDE_DIR, 'excludelist.orig.xml'), join(TEST262_DIR, 'excludelist.xml'))
copy(join(TEST262_OVERRIDE_DIR, 'test262.py'), join(TEST262_DIR, 'tools', 'packaging', 'test262.py')) # for parallel running (we should re-implement this for es6 suite)
summary = stdout.decode("utf-8").split('=== Test262 Summary ===')[1]
if summary.find('- All tests succeeded') < 0:
raise Exception('test262 failed')
print('test262: All tests passed')

@runner('test262-strict', default=False)
def run_test262_strict(engine, arch):
copy_test262_files()
TEST262_DIR = join(PROJECT_SOURCE_DIR, 'test', 'test262')
out = open('test262-strict_out', 'w')

run(['pypy', join('tools', 'packaging', 'test262.py'),
run(['python', join('tools', 'packaging', 'test262.py'),
'--command', engine,
'--full-summary',
'--strict_only'],
Expand All @@ -225,17 +240,13 @@ def run_test262_strict(engine, arch):
print('test262-strict: All tests passed')


@runner('test262-nonstrict', default=True)
@runner('test262-nonstrict', default=False)
def run_test262_nonstrict(engine, arch):
TEST262_OVERRIDE_DIR = join(PROJECT_SOURCE_DIR, 'tools', 'test', 'test262')
copy_test262_files()
TEST262_DIR = join(PROJECT_SOURCE_DIR, 'test', 'test262')

copy(join(TEST262_OVERRIDE_DIR, 'excludelist.orig.xml'), join(TEST262_DIR, 'excludelist.xml'))
copy(join(TEST262_OVERRIDE_DIR, 'test262.py'), join(TEST262_DIR, 'tools', 'packaging', 'test262.py')) # for parallel running (we should re-implement this for es6 suite)

out = open('test262-nonstrict_out', 'w')

run(['pypy', join('tools', 'packaging', 'test262.py'),
run(['python', join('tools', 'packaging', 'test262.py'),
'--command', engine,
'--full-summary',
'--non_strict_only'],
Expand All @@ -262,17 +273,10 @@ def compile_test_data_runner():

@runner('test262-dump', default=False)
def run_test262_dump(engine, arch):
TEST262_OVERRIDE_DIR = join(PROJECT_SOURCE_DIR, 'tools', 'test', 'test262')
copy_test262_files()
TEST262_DIR = join(PROJECT_SOURCE_DIR, 'test', 'test262')

copy(join(TEST262_OVERRIDE_DIR, 'excludelist.orig.xml'), join(TEST262_DIR, 'excludelist.xml'))
copy(join(TEST262_OVERRIDE_DIR, 'cth.js'), join(TEST262_DIR, 'harness', 'cth.js'))
copy(join(TEST262_OVERRIDE_DIR, 'testIntl.js'), join(TEST262_DIR, 'harness', 'testIntl.js'))

copy(join(TEST262_OVERRIDE_DIR, 'parseTestRecord.py'), join(TEST262_DIR, 'tools', 'packaging', 'parseTestRecord.py'))
copy(join(TEST262_OVERRIDE_DIR, 'test262.py'), join(TEST262_DIR, 'tools', 'packaging', 'test262.py')) # for parallel running (we should re-implement this for es6 suite)

stdout = run(['pypy', join('tools', 'packaging', 'test262.py'),
stdout = run(['python', join('tools', 'packaging', 'test262.py'),
'--command', engine,
'--summary'],
cwd=TEST262_DIR,
Expand Down
2 changes: 1 addition & 1 deletion tools/test/test262/make_excludelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function


import os
import re
Expand Down
29 changes: 18 additions & 11 deletions tools/test/test262/monkeyYaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
mYamlMultilineList = re.compile(r"^ *- (.*)$")

def load(str):
return myReadDict(str.splitlines())[1]

def myReadDict(lines, indent=""):
dict = None
key = None
emptyLines = 0

lines = str.splitlines()
while lines:
if not lines[0].startswith(indent):
break

line = lines.pop(0)
if myIsAllSpaces(line):
emptyLines += 1
Expand All @@ -31,7 +35,7 @@ def load(str):
dict = {}
key = result.group(1).strip()
value = result.group(2).strip()
(lines, value) = myReadValue(lines, value)
(lines, value) = myReadValue(lines, value, indent)
dict[key] = value
else:
if dict and key and key in dict:
Expand All @@ -40,17 +44,20 @@ def load(str):
else:
raise Exception("monkeyYaml is confused at " + line)
emptyLines = 0
return dict
return lines, dict

def myReadValue(lines, value):
if value == ">":
def myReadValue(lines, value, indent):
if value == ">" or value == "|":
(lines, value) = myMultiline(lines, value)
value = value + "\n"
return (lines, value)
if lines and not value and myMaybeList(lines[0]):
return myMultilineList(lines, value)
else:
return lines, myReadOneLine(value)
if lines and not value:
if myMaybeList(lines[0]):
return myMultilineList(lines, value)
indentMatch = re.match("(" + indent + r"\s+)", lines[0])
if indentMatch:
return myReadDict(lines, indentMatch.group(1))
return lines, myReadOneLine(value)

def myMaybeList(value):
return mYamlMultilineList.match(value)
Expand All @@ -64,7 +71,7 @@ def myMultilineList(lines, value):
leading = myLeadingSpaces(line)
if myIsAllSpaces(line):
pass
elif leading < indent:
elif indent is not None and leading < indent:
lines.insert(0, line)
break;
else:
Expand Down
6 changes: 3 additions & 3 deletions tools/test/test262/parseTestRecord.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2011 by Google, Inc. All rights reserved.
# This code is governed by the BSD license found in the LICENSE file.
Expand Down Expand Up @@ -81,7 +81,7 @@ def yamlAttrParser(testRecord, attrs, name):
parsed = yamlLoad(body)

if (parsed is None):
print "Failed to parse yaml in name %s"%(name)
print("Failed to parse yaml in name %s"%(name))
return

for key in parsed:
Expand All @@ -101,7 +101,7 @@ def parseTestRecord(src, name):
# we need to skip hashbang before copyright comment
if len(src) > 1 and (src[0] == '#' or src[0] == '\\'):
src = src[src.find("// Copyright"):]
elif src[:25].rfind("#!") is not -1:
elif src[:25].rfind("#!") != -1:
src = src[src.find("// Copyright"):]

match = matchParts(src, name)
Expand Down
Loading

0 comments on commit 078d1b4

Please sign in to comment.