diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 92bab7856bb..3e4a765b696 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -71,14 +71,13 @@ jobs: include: - runner: ubuntu-24.04 system: x86_64-linux - perfetto: true - runner: ubuntu-24.04-arm system: aarch64-linux - runner: macos-15-intel system: x86_64-darwin - runner: macos-latest system: aarch64-darwin - name: '${{ matrix.system }}: with shared libraries${{ matrix.perfetto && '' and perfetto'' || '''' }}' + name: '${{ matrix.system }}: with shared libraries' runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -122,7 +121,6 @@ jobs: --keep SCCACHE_GHA_ENABLED --keep SCCACHE_GHA_RW_MODE \ --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \ --arg useSeparateDerivationForV8 true \ - --arg withPerfetto ${{ matrix.perfetto || false }} \ --arg loadJSBuiltinsDynamically false \ --arg ccache '(import {}).sccache' \ --arg devTools '[]' \ @@ -142,7 +140,6 @@ jobs: -I nixpkgs=./tools/nix/pkgs.nix \ --pure --keep SCCACHE_LOCAL_RW_MODE \ --arg useSeparateDerivationForV8 true \ - --arg withPerfetto ${{ matrix.perfetto || false }} \ --arg loadJSBuiltinsDynamically false \ --arg ccache '(import {}).sccache' \ --arg devTools '[]' \ diff --git a/.github/workflows/test-linux-perfetto.yml b/.github/workflows/test-linux-perfetto.yml deleted file mode 100644 index f11970e8f6f..00000000000 --- a/.github/workflows/test-linux-perfetto.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Test Linux (with Perfetto) - -on: - workflow_dispatch: - pull_request: - # Only targeting paths specific to the vendored version of Perfetto, `test-shared` - # is taking care of rest of the coverage. - paths: - - .github/workflows/test-linux-perfetto.yml - - common.gypi - - configure.py - - deps/perfetto/** - - node.gyp - - node.gypi - - tools/v8_gypfiles/v8.gyp - types: [opened, synchronize, reopened, ready_for_review] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - PYTHON_VERSION: '3.14' - FLAKY_TESTS: keep_retrying - CLANG_VERSION: '19' - CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19 - CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19 - SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} - SCCACHE_IDLE_TIMEOUT: '0' - RUSTC_VERSION: '1.88' - -permissions: - contents: read - -jobs: - test-perfetto: - if: github.event.pull_request.draft == false - runs-on: ubuntu-24.04-arm - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - path: node - - name: Install Clang ${{ env.CLANG_VERSION }} - uses: $/.github/actions/install-clang - with: - clang-version: ${{ env.CLANG_VERSION }} - - name: Install Rust ${{ env.RUSTC_VERSION }} - run: | - rustup override set "$RUSTC_VERSION" - rustup --version - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - allow-prereleases: true - - name: Set up sccache - if: github.base_ref == 'main' || github.ref_name == 'main' - uses: Mozilla-Actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11 - with: - version: v0.17.0 - - name: Build - working-directory: node - run: make build-ci -j4 V=1 CONFIG_FLAGS="--error-on-warn --v8-enable-temporal-support --with-perfetto" - - name: Get trace_processor - working-directory: node - run: make tools/perfetto/trace_processor_shell - - name: Test - working-directory: node - run: make test-ci -j1 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9" - - name: Ensure running tests did not cause any change in the tree - working-directory: node - run: git add -A && git diff --name-only --exit-code --staged diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml index 9f4d2e031f5..548e67d04c6 100644 --- a/.github/workflows/test-shared.yml +++ b/.github/workflows/test-shared.yml @@ -151,8 +151,6 @@ jobs: include: - runner: ubuntu-24.04 system: x86_64-linux - # Exercise the trace-event code against a perfetto-enabled V8. - perfetto: true # built separately in build-aarch64-linux-v8 # - runner: ubuntu-24.04-arm # system: aarch64-linux @@ -160,15 +158,23 @@ jobs: system: x86_64-darwin - runner: macos-latest system: aarch64-darwin - name: '${{ matrix.system }}: with shared libraries${{ matrix.perfetto && '' and perfetto'' || '''' }}' - uses: $/.github/workflows/build-shared.yml + name: '${{ matrix.system }}: with shared libraries' + uses: ./.github/workflows/build-shared.yml with: runner: ${{ matrix.runner }} with-sccache: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} extra-nix-flags: | --arg useSeparateDerivationForV8 true \ - ${{ matrix.perfetto && '--arg withPerfetto true \' || '\' }} - ${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg withFFI false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }} + ${{ endsWith(matrix.system, '-darwin') && '\ + --arg withAmaro false \ + --arg withFFI false \ + --arg withLief false \ + --arg withPerfetto false \ + --arg withSQLite false \ + --arg extraConfigFlags ''[ + "--without-inspector" + "--without-node-options" + ]'' \' || '\' }} secrets: CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} diff --git a/Makefile b/Makefile index 956d9e79a30..c9d8cc31fa4 100644 --- a/Makefile +++ b/Makefile @@ -321,7 +321,9 @@ v8: ## Build deps/v8. tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) .PHONY: jstest -jstest: build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests ## Run addon tests and JS tests. +## Run addon tests and JS tests. +jstest: build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests $(TRACE_PROCESSOR_SHELL_PATH)) + @out/$(BUILDTYPE)/cctest --gtest_list_tests $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ $(TEST_CI_ARGS) \ --skip-tests=$(CI_SKIP_TESTS) \ @@ -348,6 +350,7 @@ ifeq ($(TRACE_PROCESSOR_SHELL_PATH),tools/perfetto/trace_processor_shell) TRACE_PROCESSOR_SHELL_DEPS = deps/perfetto/VERSION endif +# Set TRACE_PROCESSOR_SHELL_PATH=/dev/null to disable the download $(TRACE_PROCESSOR_SHELL_PATH): $(TRACE_PROCESSOR_SHELL_DEPS) @tools/perfetto/get_trace_processor $@ @@ -655,7 +658,7 @@ test-ci-js: | clear-stalled ## Build and test JavaScript with building anything .PHONY: test-ci # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned test-ci: LOGLEVEL := info ## Build and test everything (CI). -test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests doc-only +test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests doc-only $(TRACE_PROCESSOR_SHELL_PATH) out/Release/cctest --gtest_output=xml:out/junit/cctest.xml $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ diff --git a/configure.py b/configure.py index 4bf8e2e39ee..34f03774f9d 100755 --- a/configure.py +++ b/configure.py @@ -1170,11 +1170,11 @@ default=None, help='disable the V8 inspector protocol') -parser.add_argument('--with-perfetto', +parser.add_argument('--without-perfetto', action='store_true', - dest='with_perfetto', + dest='without_perfetto', default=None, - help='enable perfetto support') + help='disable perfetto support') parser.add_argument('--shared', action='store_true', @@ -2263,7 +2263,7 @@ def configure_v8(o, configs): options.v8_disable_temporal_support = True o['variables']['v8_enable_temporal_support'] = 0 if options.v8_disable_temporal_support else 1 o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 - o['variables']['v8_use_perfetto'] = 1 if options.with_perfetto else 0 + o['variables']['v8_use_perfetto'] = 0 if options.without_perfetto or not perfetto_supported() else 1 o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) o['variables']['force_dynamic_crt'] = 1 if options.shared else 0 @@ -2386,12 +2386,20 @@ def configure_lief(o): configure_library('lief', o, pkgname='LIEF') +def perfetto_supported(): + return flavor not in ('aix', 'cloudabi', 'openbsd', 'os400', 'solaris') + def configure_perfetto(o): - if not options.with_perfetto: + if options.without_perfetto: if options.shared_perfetto: - error('--shared-perfetto requires --with-perfetto') + error('--without-perfetto is incompatible with --shared-perfetto') o['variables']['node_shared_perfetto'] = b(False) return + if options.without_perfetto is None and not perfetto_supported(): + warn(f'Perfetto is disabled for {flavor}: the bundled perfetto integration ' + 'is not available on this platform. Pass --without-perfetto to ' + 'silence this warning.') + return configure_library('perfetto', o) diff --git a/deps/perfetto/perfetto.gyp b/deps/perfetto/perfetto.gyp index 083d0b386dd..697256401a3 100644 --- a/deps/perfetto/perfetto.gyp +++ b/deps/perfetto/perfetto.gyp @@ -18,6 +18,14 @@ 'sources': [ '<@(perfetto_sdk_sources)', ], + 'conditions': [ + ['OS=="win"', { + 'defines': [ + 'WIN32_LEAN_AND_MEAN', + 'NOMINMAX', + ], + }], + ], }, ] } diff --git a/node.gypi b/node.gypi index b382784e610..7610ec71513 100644 --- a/node.gypi +++ b/node.gypi @@ -93,6 +93,11 @@ [ 'OS=="linux" and target_arch=="s390x"', { 'cflags': [ '-march=z14' ], }], + [ 'v8_use_perfetto==1 and node_shared_perfetto=="false"', { + 'dependencies': [ + 'deps/perfetto/perfetto.gyp:perfetto_sdk', + ], + }], [ 'node_enable_d8=="true"', { 'dependencies': [ 'tools/v8_gypfiles/d8.gyp:d8' ], }], diff --git a/shell.nix b/shell.nix index 7cfa46e88bb..714a998d523 100644 --- a/shell.nix +++ b/shell.nix @@ -19,7 +19,7 @@ withFFI ? true, withSSL ? true, withTemporal ? false, - withPerfetto ? false, + withPerfetto ? true, sharedLibDeps ? ( import ./tools/nix/sharedLibDeps.nix { inherit @@ -87,7 +87,7 @@ let "--v8-${if withTemporal then "enable" else "disable"}-temporal-support" ] ++ builtins.map (depName: "--shared-${depName}") sharedV8Deps - ++ pkgs.lib.optional withPerfetto "--with-perfetto"; + ++ pkgs.lib.optional (!withPerfetto) "--without-perfetto"; in pkgs.mkShell { inherit nativeBuildInputs; @@ -144,6 +144,8 @@ pkgs.mkShell { ) ) ); + TRACE_PROCESSOR_SHELL_PATH = + if withPerfetto then "${pkgs.perfetto.tools}/bin/trace_processor_shell" else "/dev/null"; } // ( let @@ -172,9 +174,6 @@ pkgs.mkShell { // pkgs.lib.optionalAttrs (!withSQLite) { NOSQLITE = "1"; } - // pkgs.lib.optionalAttrs (withPerfetto) { - TRACE_PROCESSOR_SHELL_PATH = "${pkgs.perfetto.tools}/bin/trace_processor_shell"; - } // pkgs.lib.optionalAttrs (pkcs11 != false && pkcs11 != null) ( let pkcs11' = diff --git a/tools/nix/sharedLibDeps.nix b/tools/nix/sharedLibDeps.nix index d57ceb4918b..d60c4fefe1f 100644 --- a/tools/nix/sharedLibDeps.nix +++ b/tools/nix/sharedLibDeps.nix @@ -5,7 +5,7 @@ withSQLite ? true, withSSL ? true, withFFI ? true, - withPerfetto ? false, + withPerfetto ? true, withTemporal ? false, }: { diff --git a/tools/nix/v8.nix b/tools/nix/v8.nix index 81617fff809..388f6e60296 100644 --- a/tools/nix/v8.nix +++ b/tools/nix/v8.nix @@ -50,7 +50,7 @@ let ++ lib.optional (!useSharedHighway) ../../tools/v8_gypfiles/highway.gyp ++ lib.optional (!useSharedSimdutf) ../../tools/v8_gypfiles/simdutf.gyp ++ lib.optional ( - builtins.elem "--with-perfetto" configureFlags + !(builtins.elem "--without-perfetto" configureFlags) && !(builtins.elem "--shared-perfetto" configureFlags) ) ../../deps/perfetto ++ lib.optionals (icu != null) [ diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 093be6e5395..168a57fe296 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -1766,7 +1766,11 @@ }], ['v8_use_perfetto==1', { 'sources!': [ - '