test: enable trace_events tests with perfetto - #66068
legendecas wants to merge 2 commits into
Conversation
|
Review requested:
|
1f5ce76 to
9ace27c
Compare
I think this (the download bit) will cause issues for downstream rebuilders cc @nodejs/distros. |
9ace27c to
db7f4b5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66068 +/- ##
==========================================
+ Coverage 90.27% 90.29% +0.01%
==========================================
Files 790 790
Lines 272810 272834 +24
Branches 52098 52095 -3
==========================================
+ Hits 246280 246353 +73
+ Misses 16995 16938 -57
- Partials 9535 9543 +8 🚀 New features to boost your workflow:
|
db7f4b5 to
126bad1
Compare
126bad1 to
29b5521
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
To address #66068 (comment), we should allow to override the default destination of Detailsdiff --git a/.github/workflows/build-shared.yml b/.github/workflows/build-shared.yml
index 8d2afdbf38f..7d77c13e568 100644
--- a/.github/workflows/build-shared.yml
+++ b/.github/workflows/build-shared.yml
@@ -27,11 +27,6 @@ on:
required: false
type: boolean
default: false
- perfetto:
- description: Whether the build links perfetto, which the trace event tests need trace_processor_shell for.
- required: false
- type: boolean
- default: false
secrets:
CACHIX_AUTH_TOKEN:
description: Cachix auth token for nodejs.cachix.org.
@@ -83,11 +78,6 @@ jobs:
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('NIX_SCCACHE', '(import <nixpkgs> {}).sccache');
- - name: Get trace_processor
- if: inputs.perfetto
- shell: bash
- run: make -C "$TAR_DIR" trace-processor
-
- name: Build Node.js and run tests
shell: bash
run: |
diff --git a/.github/workflows/test-linux-perfetto.yml b/.github/workflows/test-linux-perfetto.yml
index 8629058ea95..f11970e8f6f 100644
--- a/.github/workflows/test-linux-perfetto.yml
+++ b/.github/workflows/test-linux-perfetto.yml
@@ -64,7 +64,7 @@ jobs:
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 trace-processor
+ 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"
diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml
index e69059f6b06..9f4d2e031f5 100644
--- a/.github/workflows/test-shared.yml
+++ b/.github/workflows/test-shared.yml
@@ -165,7 +165,6 @@ jobs:
with:
runner: ${{ matrix.runner }}
with-sccache: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
- perfetto: ${{ matrix.perfetto || false }}
extra-nix-flags: |
--arg useSeparateDerivationForV8 true \
${{ matrix.perfetto && '--arg withPerfetto true \' || '\' }}
diff --git a/Makefile b/Makefile
index 86d2569ff2b..2c5b722de24 100644
--- a/Makefile
+++ b/Makefile
@@ -339,9 +339,10 @@ coverage-run-js: ## Run JavaScript tests with coverage.
TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) jstest
$(MAKE) coverage-report-js
-.PHONY: trace-processor
-trace-processor: ## Download perfetto's trace_processor_shell.
- @tools/perfetto/get_trace_processor
+TRACE_PROCESSOR ?= tools/perfetto/trace_processor_shell
+
+$(TRACE_PROCESSOR):
+ @tools/perfetto/get_trace_processor $@
.PHONY: test
# This does not run tests of third-party libraries inside deps.
@@ -1313,7 +1314,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
$(RM) -r $(TARNAME)/deps/ngtcp2
find $(TARNAME)/deps/openssl -maxdepth 1 -type f ! -name 'nodejs-openssl.cnf' -exec $(RM) {} +
find $(TARNAME)/deps/openssl -mindepth 1 -maxdepth 1 -type d -exec $(RM) -r {} +
- find $(TARNAME)/deps/perfetto -mindepth 1 -maxdepth 1 ! -name 'VERSION' -exec $(RM) -r {} +
+ $(RM) -r $(TARNAME)/deps/perfetto
$(RM) -r $(TARNAME)/deps/simdjson
$(RM) -r $(TARNAME)/deps/sqlite
$(RM) -r $(TARNAME)/deps/uv
diff --git a/shell.nix b/shell.nix
index 60bfb1114b4..afcea6b5663 100644
--- a/shell.nix
+++ b/shell.nix
@@ -172,6 +172,9 @@ pkgs.mkShell {
// pkgs.lib.optionalAttrs (!withSQLite) {
NOSQLITE = "1";
}
+ // pkgs.lib.optionalAttrs (withPerfetto) {
+ TRACE_PROCESSOR = "${pkgs.perfetto.tools}/bin/trace_processor_shell";
+ }
// pkgs.lib.optionalAttrs (pkcs11 != false && pkcs11 != null) (
let
pkcs11' =
diff --git a/test/common/trace_events.js b/test/common/trace_events.js
index 19b714b136e..6b615fd4607 100644
--- a/test/common/trace_events.js
+++ b/test/common/trace_events.js
@@ -12,7 +12,7 @@ const path = require('path');
const common = require('./');
const traceProcessor = path.resolve(
- __dirname, '..', '..', 'tools', 'perfetto', 'trace_processor_shell');
+ __dirname, '..', '..', process.env.TRACE_PROCESSOR || 'tools/perfetto/trace_processor_shell');
// The JSON form of a trace runs about three times the size of the trace it was
// converted from, and the traces these tests produce are a few hundred KiB at
@@ -27,7 +27,7 @@ const defaultTraceFileName = `node_trace.1.${traceFileExt}`;
function checkTraceProcessor() {
if (common.hasPerfetto && !fs.existsSync(traceProcessor)) {
assert.fail('trace_processor_shell is missing, ' +
- 'run `make trace-processor` to download it');
+ 'run `make tools/perfetto/trace_processor_shell` to download it');
}
}
diff --git a/tools/perfetto/get_trace_processor b/tools/perfetto/get_trace_processor
index 55939418c6b..733fcad4967 100755
--- a/tools/perfetto/get_trace_processor
+++ b/tools/perfetto/get_trace_processor
@@ -6,7 +6,7 @@ set -e
tools_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
version=$(cat "$tools_dir/../../deps/perfetto/VERSION")
-trace_processor="$tools_dir/trace_processor_shell"
+trace_processor="$1"
stamp="$tools_dir/.version"
if [ -x "$trace_processor" ] && [ "$(cat "$stamp" 2>/dev/null)" = "$version" ]; then |
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
29b5521 to
3fa572d
Compare
|
@aduh95 thank you very much for the detailed suggestion, applied the change! |
Changelog@@ -890,0 +891,4 @@
+/nix/store/hnbkyzzcgpg06cnz8wcfifsri7f7qy0a-linenoise-2.0 (aarch64-darwin)
+/nix/store/gs3qxbp6nglhda2jdl30b7dxlqhiis5a-linenoise-2.0 (aarch64-linux)
+/nix/store/4vzb7krribpk3s9m8bsh5dpn85s2cg1h-linenoise-2.0 (x86_64-darwin)
+/nix/store/ikmhwraxz4s83n3ripza6nqa4bnpkx8i-linenoise-2.0 (x86_64-linux)
@@ -1314,0 +1319,8 @@
+/nix/store/5mvgmnikp9bidj1k9z4l2ifdpp2wdv2y-perfetto-58.3 (aarch64-darwin)
+/nix/store/206ig4fy5nlgycxqy1dmp14nhsc5ixw7-perfetto-58.3 (aarch64-linux)
+/nix/store/3yfvs7dh1rmsd761xg6isdb7l1bqbhjn-perfetto-58.3 (x86_64-darwin)
+/nix/store/5zs5rbrkvw1zqykk3s985xbifs1mysgg-perfetto-58.3 (x86_64-linux)
+/nix/store/v6f637336bch54n6hplhxhc6nsx460vr-perfetto-58.3-tools (aarch64-darwin)
+/nix/store/j7bbglq8jk6ryy383ka0ych6l8nbxvpg-perfetto-58.3-tools (aarch64-linux)
+/nix/store/vv7yrdgp3kifn6ivla42j679m1616zhq-perfetto-58.3-tools (x86_64-darwin)
+/nix/store/jmqffymijv9qrhrn3i4xxlnzlhfk7mis-perfetto-58.3-tools (x86_64-linux) |
| tools_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) | ||
| version=$(cat "$tools_dir/../../deps/perfetto/VERSION") | ||
| trace_processor="$1" | ||
| stamp="$tools_dir/.version" |
There was a problem hiding this comment.
Do we still need that stamp or could we simply rely on Make?
There was a problem hiding this comment.
make determines the stamp by the file modified date. The binary unzipped carries the last modified date from when it was built, so it is always older than the deps/perfetto/VERSION file.
We could touch the bin to make it up to date. And this does not change the checksum of the executable so it's probably fine.
Thanks for the suggestion, updated!
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
Changelog@@ -890,0 +891,4 @@
+/nix/store/hnbkyzzcgpg06cnz8wcfifsri7f7qy0a-linenoise-2.0 (aarch64-darwin)
+/nix/store/gs3qxbp6nglhda2jdl30b7dxlqhiis5a-linenoise-2.0 (aarch64-linux)
+/nix/store/4vzb7krribpk3s9m8bsh5dpn85s2cg1h-linenoise-2.0 (x86_64-darwin)
+/nix/store/ikmhwraxz4s83n3ripza6nqa4bnpkx8i-linenoise-2.0 (x86_64-linux)
@@ -1314,0 +1319,8 @@
+/nix/store/5mvgmnikp9bidj1k9z4l2ifdpp2wdv2y-perfetto-58.3 (aarch64-darwin)
+/nix/store/206ig4fy5nlgycxqy1dmp14nhsc5ixw7-perfetto-58.3 (aarch64-linux)
+/nix/store/3yfvs7dh1rmsd761xg6isdb7l1bqbhjn-perfetto-58.3 (x86_64-darwin)
+/nix/store/5zs5rbrkvw1zqykk3s985xbifs1mysgg-perfetto-58.3 (x86_64-linux)
+/nix/store/v6f637336bch54n6hplhxhc6nsx460vr-perfetto-58.3-tools (aarch64-darwin)
+/nix/store/j7bbglq8jk6ryy383ka0ych6l8nbxvpg-perfetto-58.3-tools (aarch64-linux)
+/nix/store/vv7yrdgp3kifn6ivla42j679m1616zhq-perfetto-58.3-tools (x86_64-darwin)
+/nix/store/jmqffymijv9qrhrn3i4xxlnzlhfk7mis-perfetto-58.3-tools (x86_64-linux) |
Use https://perfetto.dev/docs/reference/trace-processor-cli to
convert the perfetto binary trace files to JSON files in tests
to verify that the traces are correctly exported with perfetto.
This moves the
trace_eventstest suite to a dedicated testfolder
test/trace_eventsas they depend on an external tooltrace_processor_shell. Added amake trace_processortodownload the expected version of
trace_processor_shellfrom perfetto releases.
This also unified the test assertions so that a test can
verify both legacy traces and perfetto traces.
Refs: #65794 (comment)