Commit Graph

6 Commits

Author SHA1 Message Date
Joyee Cheung
4da7bc915c
build: replace js2c.py with js2c.cc
PR-URL: https://github.com/nodejs/node/pull/46997
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-05-24 13:33:01 +02:00
Richard Lau
05db68245b
tools: fix check-imports.py to match on word boundaries
`check-imports.py` was missing some unused `using` statements as it
was not matching on word boundaries (e.g. `MaybeLocal` was considered
a use of `Local`). Fix that and add some unit tests (which required
the script to be renamed to drop the `-` so it could be imported into
the test script).

PR-URL: https://github.com/nodejs/node/pull/33268
Refs: https://github.com/nodejs/node/issues/29226
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
2020-05-28 10:02:46 -04:00
cclauss
e6a58a89cb test: fix Python unittests in ./test and ./tools
Co-authored-by: @patrickhousley

Fixes to Python tests to ensure that the following all pass:
1. __python2 -m pytest ./test ./tools__  # 30 tests pass
2. __python3 -m pytest ./test ./tools__  # 30 tests pass
3. __python2 -m unittest discover -s ./test/tools__  # 1 test passes
4. __python3 -m unittest discover -s ./test/tools__  # 1 test passes
5. __PYTHON=python2 make tooltest__   # 1 test passes
6. __PYTHON=python3 make tooltest__   # 1 test passes

This is a subset of #30033

PR-URL: https://github.com/nodejs/node/pull/30340
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
2019-11-11 10:44:54 +01:00
Anna Henningsen
3698031753
Revert "test: test configure ninja"
This reverts commit 85dd9e8333.

`make test` should never change the current set of `configure`
flags.

Refs: https://github.com/nodejs/node/pull/30033

PR-URL: https://github.com/nodejs/node/pull/30295
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2019-11-06 12:45:56 +01:00
Patrick Housley
85dd9e8333 test: test configure ninja
- Updated the tooltest target to run unittest module
- Renamed test/tools/test-js2c.py to be discoverable by unittest module
- Added test class for `configure` shell script
- Added a test to ensure `configure` script exits with status code zero
when passed the `--ninja` flag

Closes: https://github.com/nodejs/node/issues/29415

PR-URL: https://github.com/nodejs/node/pull/30033
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
2019-11-05 19:36:28 -08:00
Daniel Bevenius
b4f0a18b5a tools: allow single JS file for --link-module
The description for the --link-module configuration option is as
follows:
$ ./configure --help | grep -A 5 'link-module'
  --link-module=LINKED_MODULE
                      Path to a JS file to be bundled in the binary as a
                      builtin. This module will be referenced by path
                      without extension; e.g. /root/x/y.js will be
                      referenced via require('root/x/y'). Can be used
                      multiple times

This lead me to think that it was possible to specify a file like this:
$ ./configure --link-module=something.js
$ NODE_DEBUG=mkcodecache make -j8

This will lead to a compilation error as an entry in the source_ map in
node_javascript.cc will end up having an empty string as its key:
source_.emplace("", UnionBytes{_raw, 105});

This will then be used by CodeCacheBuilder when it iterates over the
module ids, which will lead to the following compilation errors:

/node/out/Release/obj/gen/node_code_cache.cc:12:23: warning:
ISO C++17 does not allow a decomposition group to be
empty [-Wempty-decomposition]
static const uint8_t [] = {
                      ^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: warning:
decomposition declarations are a C++17 extension [-Wc++17-extensions]
static const uint8_t [] = {
                     ^~
/node/out/Release/obj/gen/node_code_cache.cc:12:1: error:
decomposition declaration cannot be declared 'static'
static const uint8_t [] = {
^~~~~~
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
decomposition declaration cannot be declared with type 'const uint8_t'
(aka 'const unsigned char'); declared type must be 'auto' or
reference to 'auto'
static const uint8_t [] = {
                     ^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
excess elements in scalar initializer
static const uint8_t [] = {
                     ^
/node/out/Release/obj/gen/node_code_cache.cc:660:7: error:
expected expression
      ,
      ^
/node/out/Release/obj/gen/node_code_cache.cc:661:24: error:
no matching function for call to 'arraysize'
      static_cast<int>(arraysize()), policy
                       ^~~~~~~~~
../src/util.h:667:18: note: candidate function template not viable:
requires 1 argument, but 0 were provided
constexpr size_t arraysize(const T (&)[N]) {
                 ^
2 warnings and 5 errors generated.

This commit suggests that passing a single file be allowed by modifying
tools/js2c.py.

PR-URL: https://github.com/nodejs/node/pull/28443
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-08-12 12:56:43 +02:00