-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add a test to ensure the correctness of timezone upgrades #45299
Changes from 5 commits
3f2e5e3
f004140
8780765
693f9bc
69ec584
c3ee434
dfa9a34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2022e |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
'use strict'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const common = require('../common'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!common.hasIntl) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
common.skip('missing Intl'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Refs: https://github.com/nodejs/node/blob/1af63a90ca3a59ca05b3a12ad7dbea04008db7d9/configure.py#L1694-L1711 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (process.config.variables.icu_path !== 'deps/icu-small') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
common.skip('not using the icu data file present in deps/icu-small/source/data/in/icudt##l.dat.bz2'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const fixtures = require('../common/fixtures'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// This test ensures the correctness of the automated timezone upgrade PRs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const { strictEqual } = require('assert'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const { readFileSync } = require('fs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const expectedVersion = readFileSync(fixtures.path('tz-version.txt'), 'utf8').trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
strictEqual(process.versions.tz, expectedVersion); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We support lots of different ways of building Node.js and ICU, including pointing to external ICU source/data files, so this test is going to need guards to work properly if its going to be part of the regular test suite. Lines 549 to 590 in 1af63a9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added a guard, hope that's enough? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this would work only if
node
is built with--with-intl=small-icu
? Shouldn't we also check that if the value isundefined
, we want to also run the test?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like that's not true:
node/configure.py
Lines 1703 to 1711 in 7124476
i.e., it should work if
--with-intl
is set tofull-icu
(default case).I don't think that's necessary because
icu_path
can never beundefined
for the cases we are interested in (the objective is to run the test iff the current build is usingdeps/icu-small/source/data/in/icudt##l.dat.bz2
):icu_path
is set here andicu_full_path
is never undefined -node/configure.py
Line 1761 in 7124476
return
statement betweennode/configure.py
Line 1584 in 7124476
node/configure.py
Line 1641 in 7124476
--with-icu-path
, I'm avoiding this to exclude the case where the pointed gyp file attempts to build icu with a different icudt file, which would result in a differentprocess.versions.tz
valuenode/configure.py
Line 1646 in 7124476
--with-intl=none
or--without-intl
, which is not being considered becauseprocess.versions.tz
would beundefined
in this casenode/configure.py
Line 1682 in 7124476
--with-intl=system-icu
which we are avoiding because the system icu is not in our control, so it might produce a different version forprocess.versions.tz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On macOS,
node
installed throughbrew
:I tested this with Node.js v14.x, v16.x, and v18.x. Maybe it's using system-icu though, I don't know if there's another way to check. In any case, this should probably be explained in a comment why checking for
'deps/icu-small'
covers more than small ICU builds.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct.
There is :)
It relies on the gyp file for the systemwide icu instead of
tools/icu/icu-generic.gyp
which is for the builtin icu.Alternatively,
otool -L /usr/local/opt/node/bin/node
would print a set of shared objects the binary dynamically links against and you'll see the icu dylibs in that list:Explained, PTAL.