From 9eda464c3fb7dcac7e1936df60dc1cd5617c8001 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Fri, 11 Sep 2026 20:44:51 +0200 Subject: [PATCH 1/2] tests: series: new script running 'b4 diff' That's a useful info for reviewers to see the diff. Run 'b4 diff', and present what is available. No errors emited, it just a "nice to have" tool. Signed-off-by: Matthieu Baerts --- core/test.py | 7 +++++++ docker/build/Dockerfile | 2 +- tests/series/diff/diff.sh | 20 ++++++++++++++++++++ tests/series/diff/info.json | 3 +++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 tests/series/diff/diff.sh create mode 100644 tests/series/diff/info.json diff --git a/core/test.py b/core/test.py index f56582e9..3785a511 100644 --- a/core/test.py +++ b/core/test.py @@ -130,6 +130,13 @@ def _exec_run(self, tree, thing, result_dir): if hasattr(thing, 'first_in_series'): env["FIRST_IN_SERIES"] = str(int(thing.first_in_series)) + if hasattr(thing, 'pw_series'): + pw_series = thing.pw_series + if pw_series['cover_letter']: + env["MSGID"] = str(pw_series['cover_letter']['msgid']) + elif pw_series['patches']: + env["MSGID"] = str(pw_series['patches'][0]['msgid']) + out, err = CMD.cmd_run(self.info["run"], include_stderr=True, cwd=tree.path, pass_fds=[wfd], add_env=env) except core.cmd.CmdError as e: diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile index 20a0a58b..684182e2 100644 --- a/docker/build/Dockerfile +++ b/docker/build/Dockerfile @@ -7,7 +7,7 @@ LABEL name=nipa-build RUN sudo dnf install -y \ clang llvm lld \ - ruff pylint yamllint jsonschema shellcheck \ + b4 ruff pylint yamllint jsonschema shellcheck \ dwarves libasan libasan-static glibc-devel.i686 \ rustc \ perl-Git lei \ diff --git a/tests/series/diff/diff.sh b/tests/series/diff/diff.sh new file mode 100755 index 00000000..11dab9a0 --- /dev/null +++ b/tests/series/diff/diff.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2026 Matthieu Baerts + +if [ -z "${MSGID}" ]; then + echo "MSGID not set" >&"${DESC_FD}" + exit 0 +fi + +OUT="${RESULTS_DIR}/b4-diff.txt" + +# ignore errors, we just want to see the diff if available +b4 diff --output-diff "${OUT}" "${MSGID}" || true + +if [ -s "${OUT}" ]; then + echo "Diff with the previous version in $(basename "${OUT}")" >&"${DESC_FD}" +else + echo "No diff available" >&"${DESC_FD}" +fi diff --git a/tests/series/diff/info.json b/tests/series/diff/info.json new file mode 100644 index 00000000..20870b77 --- /dev/null +++ b/tests/series/diff/info.json @@ -0,0 +1,3 @@ +{ + "run": ["diff.sh"] +} From cdee9471677ea9fd0b4db7a15ee57c3cc409ced7 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Fri, 11 Sep 2026 20:48:39 +0200 Subject: [PATCH 2/2] ui: add colourized ANSI log viewer This is a self-contained viewer page similar to logview.html: it fetches a log, escapes it and colourize lines with ANSI tags: style and colours. Browsers can be pointed at it directly, or nginx can redirect /logs/.../*.ansi requests with Accept: text/html to it. Force b4 to keep the colours in the output file. Assisted by LLM to generate the ANSI mapping. Signed-off-by: Matthieu Baerts --- tests/series/diff/diff.sh | 4 +- ui/ansiview.html | 438 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 440 insertions(+), 2 deletions(-) create mode 100644 ui/ansiview.html diff --git a/tests/series/diff/diff.sh b/tests/series/diff/diff.sh index 11dab9a0..33901f04 100755 --- a/tests/series/diff/diff.sh +++ b/tests/series/diff/diff.sh @@ -8,10 +8,10 @@ if [ -z "${MSGID}" ]; then exit 0 fi -OUT="${RESULTS_DIR}/b4-diff.txt" +OUT="${RESULTS_DIR}/b4-diff.ansi" # ignore errors, we just want to see the diff if available -b4 diff --output-diff "${OUT}" "${MSGID}" || true +b4 diff --color --output-diff "${OUT}" "${MSGID}" || true if [ -s "${OUT}" ]; then echo "Diff with the previous version in $(basename "${OUT}")" >&"${DESC_FD}" diff --git a/ui/ansiview.html b/ui/ansiview.html new file mode 100644 index 00000000..0a72f27d --- /dev/null +++ b/ui/ansiview.html @@ -0,0 +1,438 @@ + + + + + +NIPA log viewer + + + + +
+ loading… + | + raw +
+

+
+
+