Skip to content

Commit

Permalink
Ensure Win JSC can run complex.yaml tests
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=255078

Reviewed by Yusuke Suzuki.

Making this test suite work on Windows boils down to fixing two problems:

1. The tests which don't set env vars are passing an empty string, but in Ruby, this is appended to a list ($envVars),
   meaning that we end up trying to set a env var with key "". Use nil instead.

2. On Windows, TZ isn't a magic env var, so:
   a. Have jsc.cpp call setTimeZoneOverride instead.
   b. Skip temporal-now-timezone-with-broken-tz.js.
      (Obviously we could call setTimeZoneOverride with "UTC" if (a) fails,
      but it would serve no purpose, as this behavior has nothing to do with Temporal.)

* JSTests/complex.yaml:
* Source/JavaScriptCore/jsc.cpp:

Canonical link: https://commits.webkit.org/262659@main
  • Loading branch information
rkirsling committed Apr 6, 2023
1 parent d28d0a9 commit d31d849
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 9 additions & 4 deletions JSTests/complex.yaml
Expand Up @@ -24,10 +24,10 @@
# This is for writing a bit complex tests to drive in JSC shell (e.g. including multiple files with some special options).

- path: complex/generator-regeneration.js
cmd: runComplexTest [], ["generator-regeneration-after.js"], "", "--useDollarVM=1"
cmd: runComplexTest [], ["generator-regeneration-after.js"], nil, "--useDollarVM=1"

- path: complex/tagged-template-regeneration.js
cmd: runComplexTest [], ["tagged-template-regeneration-after.js"], "", "--useDollarVM=1"
cmd: runComplexTest [], ["tagged-template-regeneration-after.js"], nil, "--useDollarVM=1"

- path: complex/timezone-format-de.js
cmd: runComplexTest [], [], "TZ=Europe/Berlin", "--useDollarVM=1"
Expand Down Expand Up @@ -57,10 +57,15 @@
cmd: runComplexTest [], [], "TZ=America/Los_Angeles", "--useDollarVM=1", "--useTemporal=1"

- path: complex/temporal-now-timezone-with-broken-tz.js
cmd: runComplexTest [], [], "TZ=UNDEFINED", "--useDollarVM=1", "--useTemporal=1"
cmd: |
if ($hostOS == "windows")
skip
else
runComplexTest [], [], "TZ=UNDEFINED", "--useDollarVM=1", "--useTemporal=1"
end
- path: complex/for-in-clobberize.js
cmd: runComplexTest [], [], "", "--destroy-vm"
cmd: runComplexTest [], [], nil, "--destroy-vm"

- path: complex/intl-date-time-format-date-parse.js
cmd: runComplexTest [], [], "TZ=America/New_York"
Expand Down
7 changes: 6 additions & 1 deletion Source/JavaScriptCore/jsc.cpp
Expand Up @@ -3961,8 +3961,13 @@ int jscmain(int argc, char** argv)
// comes first.
mainCommandLine.construct(argc, argv);

#if OS(UNIX)
#if OS(WINDOWS)
// Needed for complex.yaml tests.
if (char* tz = getenv("TZ"))
setTimeZoneOverride(StringView::fromLatin1(tz));
#endif

#if OS(UNIX)
if (getenv("JS_SHELL_WAIT_FOR_SIGUSR2_TO_EXIT")) {
initializeSignalHandling();
addSignalHandler(Signal::Usr, SignalHandler([&] (Signal, SigInfo&, PlatformRegisters&) {
Expand Down

0 comments on commit d31d849

Please sign in to comment.