From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
"Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Ryszard Knop" <ryszard.knop@intel.com>,
"Krzysztof Karas" <krzysztof.karas@intel.com>
Subject: [PATCH i-g-t v3 3/5] scripts/hooks: Example guc log copy script and allowlist
Date: Mon, 13 Apr 2026 22:17:26 +0200 [thread overview]
Message-ID: <20260413201722.808673-10-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20260413201722.808673-7-zbigniew.kempczynski@intel.com>
We need to explicitly extract guc logs for failed tests so add hook
script which does it after subtest/dynsubtest execution. As copying to
attachments takes a lot of time do it only for failing subtests.
Adding this hook script to CI will extend execution time much and
using allowlist is necessary. Instead of allowlist argument in the
runner (previous attempt) now script filters such list on its own and
decides when to move forward and do some post-test actions. Such
approach is more flexible but moves decision to script what causes
it is more prone buggy.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Ryszard Knop <ryszard.knop@intel.com>
Cc: Krzysztof Karas <krzysztof.karas@intel.com>
---
v2: install hook to datadir/hooks
v3: migrate allowlist from runner to script
---
scripts/hooks/guc_copy.allowlist | 2 ++
scripts/hooks/guc_copy_on_fail.sh | 47 +++++++++++++++++++++++++++++++
scripts/meson.build | 3 ++
3 files changed, 52 insertions(+)
create mode 100644 scripts/hooks/guc_copy.allowlist
create mode 100755 scripts/hooks/guc_copy_on_fail.sh
diff --git a/scripts/hooks/guc_copy.allowlist b/scripts/hooks/guc_copy.allowlist
new file mode 100644
index 0000000000..04cb3f8298
--- /dev/null
+++ b/scripts/hooks/guc_copy.allowlist
@@ -0,0 +1,2 @@
+igt@xe_compute@compute-square
+igt@xe_exec_basic@once-basic@ccs0
diff --git a/scripts/hooks/guc_copy_on_fail.sh b/scripts/hooks/guc_copy_on_fail.sh
new file mode 100755
index 0000000000..595cf5205e
--- /dev/null
+++ b/scripts/hooks/guc_copy_on_fail.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# Hook script for copying guc.log.
+# Suggested usage with:
+# --hook 'post-subtest:scripts/hooks/guc_copy_on_fail.sh' --hook 'post-dyn-subtest:scripts/hooks/guc_copy_on_fail.sh'
+
+# Copy only for failed subtests as this is time-consuming
+if [ "${IGT_HOOK_RESULT}" != "FAIL" ]; then
+ exit 0
+fi
+
+# Process and copy guc logs only for those specified in allowlist
+ALLOWLIST="guc_copy.allowlist"
+scriptdir=$(dirname $(realpath $0))
+
+if [ -z "$IGT_RUNNER_ATTACHMENTS_DIR" ]; then
+ echo "Missing IGT_RUNNER_ATTACHMENTS_DIR env"
+ exit 0
+fi
+
+cd "$IGT_RUNNER_ATTACHMENTS_DIR"
+
+# Look for allowlist in following places:
+# 1. Try in IGT_HOOK_ALLOWLIST_DIR if this environment exists
+# 2. Try in <scriptdir>
+
+if [ ! -z "$IGT_HOOK_ALLOWLIST_DIR" ]; then
+ ALLOWLIST_PATH="${IGT_HOOK_ALLOWLIST_DIR}/${ALLOWLIST}"
+else
+ ALLOWLIST_PATH="${scriptdir}/${ALLOWLIST}"
+fi
+
+if [ ! -e "${ALLOWLIST_PATH}" ]; then
+ exit 0
+fi
+
+STNAME="${IGT_HOOK_TEST_FULLNAME}"
+echo "${STNAME}" | grep -q -f "${ALLOWLIST_PATH}"
+if [ $? -ne 0 ]; then
+ exit 0
+fi
+
+for log in $(find /sys/kernel/debug/dri -iname 'guc_log'); do
+ attout=$(echo ${log:23} | sed -e 's/\//_/g')
+ mkdir -p "${STNAME}"
+ cp "$log" "${STNAME}/${attout}"
+done
diff --git a/scripts/meson.build b/scripts/meson.build
index 6e64065c5e..2ce961898d 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -15,3 +15,6 @@ endif
igt_doc_script = find_program('igt_doc.py', required : build_testplan)
gen_rst_index = find_program('gen_rst_index', required : build_sphinx)
generate_iga64_codes = find_program('generate_iga64_codes')
+
+install_data('hooks/guc_copy_on_fail.sh', install_dir : datadir / 'hooks')
+install_data('hooks/guc_copy.allowlist', install_dir : datadir / 'hooks')
--
2.43.0
next prev parent reply other threads:[~2026-04-13 20:18 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 20:17 [PATCH i-g-t v3 0/5] RFC: Add attachments support Zbigniew Kempczyński
2026-04-13 20:17 ` [PATCH i-g-t v3 1/5] runner: Rename dirfd to avoid clash with dirfd() Zbigniew Kempczyński
2026-04-14 7:40 ` Krzysztof Karas
2026-04-13 20:17 ` [PATCH i-g-t v3 2/5] runner: Create attachments directory to use by hooks Zbigniew Kempczyński
2026-04-14 7:34 ` Krzysztof Karas
2026-04-14 19:13 ` Zbigniew Kempczyński
2026-04-14 19:27 ` Gustavo Sousa
2026-04-15 5:34 ` Zbigniew Kempczyński
2026-04-15 13:48 ` Gustavo Sousa
2026-04-15 16:37 ` Zbigniew Kempczyński
2026-04-13 20:17 ` Zbigniew Kempczyński [this message]
2026-04-14 8:06 ` [PATCH i-g-t v3 3/5] scripts/hooks: Example guc log copy script and allowlist Krzysztof Karas
2026-04-14 19:34 ` Zbigniew Kempczyński
2026-04-14 20:33 ` Gustavo Sousa
2026-04-15 8:23 ` Zbigniew Kempczyński
2026-04-15 12:51 ` Gustavo Sousa
2026-04-16 18:44 ` Zbigniew Kempczyński
2026-04-16 19:59 ` Gustavo Sousa
2026-04-13 20:17 ` [PATCH i-g-t v3 4/5] runner/resultgen: Add json array create/get helper Zbigniew Kempczyński
2026-04-14 8:31 ` Krzysztof Karas
2026-04-13 20:17 ` [PATCH i-g-t v3 5/5] runner/resultgen: Insert attachments list into results.json Zbigniew Kempczyński
2026-04-14 9:35 ` Krzysztof Karas
2026-04-14 19:39 ` Zbigniew Kempczyński
2026-04-14 21:39 ` Gustavo Sousa
2026-04-15 6:31 ` Zbigniew Kempczyński
2026-04-15 12:16 ` Gustavo Sousa
2026-04-15 16:09 ` Zbigniew Kempczyński
2026-04-15 16:20 ` Gustavo Sousa
2026-04-15 19:56 ` Zbigniew Kempczyński
2026-04-15 20:31 ` Gustavo Sousa
2026-04-14 1:57 ` ✓ i915.CI.BAT: success for RFC: Add attachments support (rev3) Patchwork
2026-04-14 2:03 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-14 5:30 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-14 7:59 ` ✓ i915.CI.Full: success " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260413201722.808673-10-zbigniew.kempczynski@intel.com \
--to=zbigniew.kempczynski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=krzysztof.karas@intel.com \
--cc=ryszard.knop@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox