Skip to content

eBPF-based security platform

testing: group OTEL export tests

John Fastabend9f6afc699844
diff --git a/testing/integration-lib.sh b/testing/integration-lib.sh
index f8a56668..98ffe695 100644
--- a/testing/integration-lib.sh
+++ b/testing/integration-lib.sh
@@ -14,12 +14,15 @@
#
# Sourced after a leading `cd "$(dirname "$0")"` in each test.
-. ./test-lib.sh
+INTEGRATION_TESTING_DIR=.
+[ -f "$INTEGRATION_TESTING_DIR/test-lib.sh" ] ||
+ INTEGRATION_TESTING_DIR=..
+. "$INTEGRATION_TESTING_DIR/test-lib.sh"
# Binary under test (the one that init'd the host) and the operator-side
# builder. Overridable for out-of-tree layouts.
: "${SHIRUDO_BIN:=/usr/local/bin/shirudo}"
-: "${SHIRUDO_BUILD_BIN:=../tools/shirudo-build/shirudo-build}"
+: "${SHIRUDO_BUILD_BIN:=$INTEGRATION_TESTING_DIR/../tools/shirudo-build/shirudo-build}"
# Skip the whole script unless every precondition holds.
target_guard() {
diff --git a/testing/t0014-otel-map.sh b/testing/otel/t0014-otel-map.sh
similarity index 92%
rename from testing/t0014-otel-map.sh
rename to testing/otel/t0014-otel-map.sh
index 9be43415..472be01f 100644
--- a/testing/t0014-otel-map.sh
+++ b/testing/otel/t0014-otel-map.sh
@@ -3,10 +3,10 @@
# Copyright (c) 2026 Authors of shirudo
cd "$(dirname "$0")"
-. ./test-lib.sh
+. ../test-lib.sh
-H=helper/test-otel-map
-S=../shirudo
+H=../helper/test-otel-map
+S=../../shirudo
test_expect_success 'OTLP CLI options reject invalid combinations early' '
! "$S" upatch map --otel-retries=11 >/dev/null 2>&1 &&
@@ -113,7 +113,7 @@ assert p["startTimeUnixNano"] == "1544712660300000000"
test_expect_success 'OTLP base URL always appends the selected signal path' '
rm -f otel.port otel.body otel.meta;
- python3 helper/otel-mock.py success otel.port otel.body otel.meta &
+ python3 ../helper/otel-mock.py success otel.port otel.body otel.meta &
server=$!;
i=0; while test ! -s otel.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat otel.port) &&
@@ -121,7 +121,7 @@ test_expect_success 'OTLP base URL always appends the selected signal path' '
wait $server &&
grep -q "\"path\": \"/base/v1/logs\"" otel.meta &&
rm -f otel.port otel.body otel.meta;
- python3 helper/otel-mock.py success otel.port otel.body otel.meta &
+ python3 ../helper/otel-mock.py success otel.port otel.body otel.meta &
server=$!;
i=0; while test ! -s otel.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat otel.port) &&
@@ -134,7 +134,7 @@ d=json.load(open("otel.body"))
assert d["resourceMetrics"][0]["scopeMetrics"][0]["metrics"][0]["sum"]["dataPoints"][0]["asInt"] == "12"
'\'' &&
rm -f otel.port otel.body otel.meta;
- python3 helper/otel-mock.py success otel.port otel.body otel.meta &
+ python3 ../helper/otel-mock.py success otel.port otel.body otel.meta &
server=$!;
i=0; while test ! -s otel.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat otel.port) &&
@@ -162,7 +162,7 @@ test_expect_success 'tenant IDs are validated after OTEL header decoding' '
test_expect_success 'OTLP HTTP sends JSON, auth headers, gzip, and retries' '
rm -f otel.port otel.body otel.meta;
- python3 helper/otel-mock.py retry otel.port otel.body otel.meta &
+ python3 ../helper/otel-mock.py retry otel.port otel.body otel.meta &
server=$!;
i=0; while test ! -s otel.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat otel.port) &&
@@ -180,7 +180,7 @@ assert m == {"attempts":3,"path":"/v1/logs","authorization":"Bearer secret","con
test_expect_success 'OTLP partial success is a non-retryable failure' '
rm -f otel.port otel.body otel.meta;
- python3 helper/otel-mock.py partial otel.port otel.body otel.meta &
+ python3 ../helper/otel-mock.py partial otel.port otel.body otel.meta &
server=$!;
i=0; while test ! -s otel.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat otel.port) &&
@@ -202,7 +202,7 @@ test_expect_success 'HTTPS verifies by default and --otel-insecure disables veri
openssl req -x509 -newkey rsa:2048 -nodes -days 1 \
-subj /CN=localhost -addext subjectAltName=DNS:localhost \
-keyout otel.key -out otel.crt >/dev/null 2>&1;
- python3 helper/otel-mock.py success otel.port otel.body otel.meta otel.crt otel.key &
+ python3 ../helper/otel-mock.py success otel.port otel.body otel.meta otel.crt otel.key &
server=$!;
i=0; while test ! -s otel.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat otel.port) &&
@@ -210,7 +210,7 @@ test_expect_success 'HTTPS verifies by default and --otel-insecure disables veri
"$H" send-log "https://localhost:$port" 0 &&
wait $server &&
rm -f otel.port otel.body otel.meta;
- python3 helper/otel-mock.py success otel.port otel.body otel.meta otel.crt otel.key &
+ python3 ../helper/otel-mock.py success otel.port otel.body otel.meta otel.crt otel.key &
server=$!;
i=0; while test ! -s otel.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat otel.port) &&
@@ -222,7 +222,7 @@ test_expect_success 'HTTPS verifies by default and --otel-insecure disables veri
test_expect_success '--otel=s3 uploads gzip JSON then emits a small reference event' '
rm -f s3.port s3.snapshot s3.log s3.meta;
- python3 helper/otel-s3-mock.py success s3.port s3.snapshot s3.log s3.meta &
+ python3 ../helper/otel-s3-mock.py success s3.port s3.snapshot s3.log s3.meta &
server=$!;
i=0; while test ! -s s3.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat s3.port) &&
@@ -267,7 +267,7 @@ assert len(open("s3.log","rb").read()) < 16384
test_expect_success '--otel=s3 streams snapshots larger than the configured OTLP limit' '
rm -f s3.port s3.snapshot s3.log s3.meta;
- python3 helper/otel-s3-mock.py success s3.port s3.snapshot s3.log s3.meta &
+ python3 ../helper/otel-s3-mock.py success s3.port s3.snapshot s3.log s3.meta &
server=$!;
i=0; while test ! -s s3.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat s3.port) &&
@@ -291,7 +291,7 @@ assert len(open("s3.log","rb").read()) < 16384
test_expect_success '--otel=s3 retries PUT and accepts a content-addressed duplicate' '
rm -f s3.port s3.snapshot s3.log s3.meta;
- python3 helper/otel-s3-mock.py s3-retry s3.port s3.snapshot s3.log s3.meta &
+ python3 ../helper/otel-s3-mock.py s3-retry s3.port s3.snapshot s3.log s3.meta &
server=$!;
i=0; while test ! -s s3.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat s3.port) &&
@@ -306,7 +306,7 @@ puts=[r for r in m["requests"] if r["method"] == "PUT"]
assert m["put_attempts"] == 2 and puts[0]["path"] == puts[1]["path"]
'\'' &&
rm -f s3.port s3.snapshot s3.log s3.meta;
- python3 helper/otel-s3-mock.py exists s3.port s3.snapshot s3.log s3.meta &
+ python3 ../helper/otel-s3-mock.py exists s3.port s3.snapshot s3.log s3.meta &
server=$!;
i=0; while test ! -s s3.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat s3.port) &&
@@ -318,7 +318,7 @@ assert m["put_attempts"] == 2 and puts[0]["path"] == puts[1]["path"]
test_expect_success '--otel=s3 preserves upload-before-reference failure ordering' '
rm -f s3.port s3.snapshot s3.log s3.meta;
- python3 helper/otel-s3-mock.py s3-fail s3.port s3.snapshot s3.log s3.meta &
+ python3 ../helper/otel-s3-mock.py s3-fail s3.port s3.snapshot s3.log s3.meta &
server=$!;
i=0; while test ! -s s3.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat s3.port) &&
@@ -327,7 +327,7 @@ test_expect_success '--otel=s3 preserves upload-before-reference failure orderin
"$H" send-s3 "http://127.0.0.1:$port" 0 2>s3-fail.err &&
wait $server && test ! -e s3.log && ! grep -q secret s3-fail.err &&
rm -f s3.port s3.snapshot s3.log s3.meta;
- python3 helper/otel-s3-mock.py otel-fail s3.port s3.snapshot s3.log s3.meta &
+ python3 ../helper/otel-s3-mock.py otel-fail s3.port s3.snapshot s3.log s3.meta &
server=$!;
i=0; while test ! -s s3.port && test $i -lt 50; do i=$((i+1)); sleep .02; done &&
port=$(cat s3.port) &&
diff --git a/testing/t0016-map-export-config.sh b/testing/otel/t0016-map-export-config.sh
similarity index 83%
rename from testing/t0016-map-export-config.sh
rename to testing/otel/t0016-map-export-config.sh
index 28560031..1792b7c5 100755
--- a/testing/t0016-map-export-config.sh
+++ b/testing/otel/t0016-map-export-config.sh
@@ -3,10 +3,10 @@
# Copyright (c) 2026 Authors of shirudo
cd "$(dirname "$0")"
-. ./test-lib.sh
+. ../test-lib.sh
test_expect_success 'map export configuration validates defaults and values' '
- ./helper/test-config
+ ../helper/test-config
'
test_done
diff --git a/testing/otel/t0017-systemd-map-export.sh b/testing/otel/t0017-systemd-map-export.sh
new file mode 100755
index 00000000..c71faa80
--- /dev/null
+++ b/testing/otel/t0017-systemd-map-export.sh
@@ -0,0 +1,106 @@
+#!/bin/sh
+# SPDX-License-Identifier: BSD-2-Clause
+# Copyright (c) 2026 Authors of shirudo
+
+cd "$(dirname "$0")"
+. ../test-lib.sh
+
+WORK=$(mktemp -d)
+GENERATED=$WORK/shirudo-map-export.service
+GENERATED_KEEPALIVE=$WORK/shirudo-keepalive.service
+trap 'rm -rf "$WORK"' EXIT
+
+test_expect_success 'map export service runs the configured batch exporter' '
+ grep -q "^After=shirudo.service$" \
+ ../../systemd/shirudo-map-export.service.in &&
+ grep -q "^ConditionPathExists=/run/shirudo/bpffs/lsm_link$" \
+ ../../systemd/shirudo-map-export.service.in &&
+ grep -q "^EnvironmentFile=-/etc/shirudo/map-export.env$" \
+ ../../systemd/shirudo-map-export.service.in &&
+ grep -q "^ExecStart=@bindir@/shirudo upatch map --all$" \
+ ../../systemd/shirudo-map-export.service.in
+'
+
+test_expect_success 'map export timer waits five seconds between runs' '
+ grep -q "^OnBootSec=5s$" ../../systemd/shirudo-map-export.timer &&
+ grep -q "^OnUnitInactiveSec=5s$" \
+ ../../systemd/shirudo-map-export.timer &&
+ grep -q "^Unit=shirudo-map-export.service$" \
+ ../../systemd/shirudo-map-export.timer &&
+ grep -q "^WantedBy=timers.target$" \
+ ../../systemd/shirudo-map-export.timer
+'
+
+test_expect_success 'keepalive service exports status with TPM and system data' '
+ grep -q "^After=shirudo.service$" \
+ ../../systemd/shirudo-keepalive.service.in &&
+ grep -q "^EnvironmentFile=-/etc/shirudo/map-export.env$" \
+ ../../systemd/shirudo-keepalive.service.in &&
+ grep -q "^ExecStart=@bindir@/shirudo status --otel --include-system$" \
+ ../../systemd/shirudo-keepalive.service.in
+'
+
+test_expect_success 'keepalive timer waits five seconds between runs' '
+ grep -q "^OnBootSec=5s$" ../../systemd/shirudo-keepalive.timer &&
+ grep -q "^OnUnitInactiveSec=5s$" \
+ ../../systemd/shirudo-keepalive.timer &&
+ grep -q "^Unit=shirudo-keepalive.service$" \
+ ../../systemd/shirudo-keepalive.timer &&
+ grep -q "^WantedBy=timers.target$" \
+ ../../systemd/shirudo-keepalive.timer
+'
+
+test_expect_success 'target install resolves and stages exporter units' '
+ sed "s|@bindir@|/opt/shirudo/bin|g" \
+ ../../systemd/shirudo-map-export.service.in >"$GENERATED" &&
+ sed "s|@bindir@|/opt/shirudo/bin|g" \
+ ../../systemd/shirudo-keepalive.service.in >"$GENERATED_KEEPALIVE" &&
+ (
+ cd ../.. &&
+ make -n -f Makefile.shirudo bindir=/opt/shirudo/bin \
+ DESTDIR="$WORK/target" \
+ systemdunitdir=/usr/lib/systemd/system install-target \
+ >"$WORK/target.plan"
+ ) &&
+ grep -q "^ExecStart=/opt/shirudo/bin/shirudo upatch map --all$" \
+ "$GENERATED" &&
+ grep -q "^ExecStart=/opt/shirudo/bin/shirudo status --otel --include-system$" \
+ "$GENERATED_KEEPALIVE" &&
+ grep -q "systemd/shirudo-map-export.service" "$WORK/target.plan" &&
+ grep -q "systemd/shirudo-map-export.timer" "$WORK/target.plan" &&
+ grep -q "systemd/shirudo-keepalive.service" "$WORK/target.plan" &&
+ grep -q "systemd/shirudo-keepalive.timer" "$WORK/target.plan"
+'
+
+test_expect_success 'operator install excludes exporter units' '
+ (
+ cd ../.. &&
+ make -n -f Makefile.shirudo DESTDIR="$WORK/operator" \
+ install-operator >"$WORK/operator.plan"
+ ) &&
+ ! grep -q "shirudo-map-export" "$WORK/operator.plan" &&
+ ! grep -q "shirudo-keepalive" "$WORK/operator.plan"
+'
+
+test_expect_success 'target package enables and removes exporter timers safely' '
+ grep -q "systemctl enable shirudo-map-export.timer" \
+ ../../packaging/deb/builddeb.sh &&
+ grep -q "systemctl --no-reload disable --now shirudo-map-export.timer" \
+ ../../packaging/deb/builddeb.sh &&
+ grep -q "systemctl enable shirudo-keepalive.timer" \
+ ../../packaging/deb/builddeb.sh &&
+ grep -q "systemctl --no-reload disable --now shirudo-keepalive.timer" \
+ ../../packaging/deb/builddeb.sh
+'
+
+test_expect_success 'the rpm target package carries exporter timer scriptlets' '
+ for unit in shirudo-map-export shirudo-keepalive
+ do
+ grep -q "systemctl enable $unit.timer" \
+ ../../packaging/rpm/buildrpm.sh &&
+ grep -q "systemctl --no-reload disable --now $unit.timer" \
+ ../../packaging/rpm/buildrpm.sh || return 1
+ done
+'
+
+test_done
diff --git a/testing/t0018-status-otel.sh b/testing/otel/t0018-status-otel.sh
similarity index 96%
rename from testing/t0018-status-otel.sh
rename to testing/otel/t0018-status-otel.sh
index 1c42016d..4390bbc9 100644
--- a/testing/t0018-status-otel.sh
+++ b/testing/otel/t0018-status-otel.sh
@@ -3,13 +3,13 @@
# Copyright (c) 2026 Authors of shirudo
cd "$(dirname "$0")"
-. ./test-lib.sh
+. ../test-lib.sh
-S=../shirudo
+S=../../shirudo
test_expect_success 'status --otel sends a structured keepalive log' '
work=$(mktemp -d)
- python3 helper/otel-mock.py success "$work/port" "$work/body" \
+ python3 ../helper/otel-mock.py success "$work/port" "$work/body" \
"$work/meta" &
server=$!
trap "kill $server 2>/dev/null || true; wait $server 2>/dev/null || true; rm -rf $work" EXIT
@@ -55,7 +55,7 @@ PY
test_expect_success 'status --json --otel keeps JSON output available' '
work=$(mktemp -d)
- python3 helper/otel-mock.py success "$work/port" "$work/body" \
+ python3 ../helper/otel-mock.py success "$work/port" "$work/body" \
"$work/meta" &
server=$!
trap "kill $server 2>/dev/null || true; wait $server 2>/dev/null || true; rm -rf $work" EXIT
diff --git a/testing/t1115-map-export-all.sh b/testing/otel/t1115-map-export-all.sh
similarity index 99%
rename from testing/t1115-map-export-all.sh
rename to testing/otel/t1115-map-export-all.sh
index adfb2953..c101893b 100644
--- a/testing/t1115-map-export-all.sh
+++ b/testing/otel/t1115-map-export-all.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2026 Authors of shirudo
cd "$(dirname "$0")"
-. ./integration-lib.sh
+. ../integration-lib.sh
target_guard
command -v python3 >/dev/null 2>&1 || test_skip_all "no python3"
FIXTURES=${SHIRUDO_TEST_FIXTURES_DIR:?target fixture directory is not set}
diff --git a/testing/t1116-otel-backend.sh b/testing/otel/t1116-otel-backend.sh
similarity index 99%
rename from testing/t1116-otel-backend.sh
rename to testing/otel/t1116-otel-backend.sh
index 79a30cb8..a4dec736 100644
--- a/testing/t1116-otel-backend.sh
+++ b/testing/otel/t1116-otel-backend.sh
@@ -5,7 +5,7 @@
# t1116 -- systemd map-export service and timer coverage.
cd "$(dirname "$0")"
-. ./integration-lib.sh
+. ../integration-lib.sh
target_guard
command -v python3 >/dev/null 2>&1 || test_skip_all "no python3"
command -v systemctl >/dev/null 2>&1 || test_skip_all "no systemctl"
diff --git a/testing/t1117-otel-serialized-metric.sh b/testing/otel/t1117-otel-serialized-metric.sh
similarity index 96%
rename from testing/t1117-otel-serialized-metric.sh
rename to testing/otel/t1117-otel-serialized-metric.sh
index b24fbb4e..5457e942 100644
--- a/testing/t1117-otel-serialized-metric.sh
+++ b/testing/otel/t1117-otel-serialized-metric.sh
@@ -5,7 +5,7 @@
# t1117 -- serializer-to-OTLP metric coverage using a host-built fixture.
cd "$(dirname "$0")"
-. ./integration-lib.sh
+. ../integration-lib.sh
target_guard
command -v python3 >/dev/null 2>&1 || test_skip_all "no python3"
command -v systemctl >/dev/null 2>&1 || test_skip_all "no systemctl"
@@ -58,7 +58,7 @@ assert metrics["shirudo.serialized.bytes"]["sum"]["dataPoints"][0]["asInt"] == "
PY
test_expect_success 'serialized counters become cumulative OTLP metrics' '
- python3 helper/otel-mock.py success "$WORK/otel.port" "$WORK/otel.body" "$WORK/otel.meta" &
+ python3 ../helper/otel-mock.py success "$WORK/otel.port" "$WORK/otel.body" "$WORK/otel.meta" &
SERVER=$!;
i=0; while test ! -s "$WORK/otel.port" && test "$i" -lt 100; do i=$((i+1)); sleep .1; done;
test -s "$WORK/otel.port" &&
diff --git a/testing/run-target-tests.sh b/testing/run-target-tests.sh
index 999ebf0c..80d3fe98 100755
--- a/testing/run-target-tests.sh
+++ b/testing/run-target-tests.sh
@@ -25,9 +25,9 @@ for t in \
t1108-tpm-chain.sh \
t1111-upatch-get.sh \
t1114-uprobe-multi.sh \
- t1115-map-export-all.sh \
- t1116-otel-backend.sh \
- t1117-otel-serialized-metric.sh \
+ otel/t1115-map-export-all.sh \
+ otel/t1116-otel-backend.sh \
+ otel/t1117-otel-serialized-metric.sh \
t1122-initrd.sh \
t1123-keys.sh \
tamperproof/t1121-bpf-keyring.sh \
diff --git a/testing/run-tests.sh b/testing/run-tests.sh
index 40efa184..3667f5e8 100755
--- a/testing/run-tests.sh
+++ b/testing/run-tests.sh
@@ -28,6 +28,19 @@ for t in t0[0-9][0-9][0-9]-*.sh; do
fi
done
+for t in otel/t0[0-9][0-9][0-9]-*.sh; do
+ [ -e "$t" ] || continue
+ found=1
+ if sh "$t"; then
+ :
+ else
+ fail=$((fail + 1))
+ if [ -n "$SHIRUDO_TEST_SUITE_FAILURES_FILE" ]; then
+ printf '%s\n' "$t" >>"$SHIRUDO_TEST_SUITE_FAILURES_FILE" 2>/dev/null || :
+ fi
+ fi
+done
+
for t in upatch/kernel-obs/dns/t0[0-9][0-9][0-9]-*.sh; do
[ -e "$t" ] || continue
found=1
diff --git a/testing/t0015-test-vm-cli.sh b/testing/t0015-test-vm-cli.sh
index 38b55d60..bda75140 100755
--- a/testing/t0015-test-vm-cli.sh
+++ b/testing/t0015-test-vm-cli.sh
@@ -900,6 +900,7 @@ test_expect_success 'make -C testing test runs the complete pipeline in order' '
test_expect_success 'operator and target runners have disjoint explicit scopes' '
grep -q "for t in t0\[0-9\]\[0-9\]\[0-9\]-\*.sh" ../testing/run-tests.sh &&
+ grep -q "for t in otel/t0\[0-9\]\[0-9\]\[0-9\]-\*.sh" ../testing/run-tests.sh &&
! grep -q "t1101" ../testing/run-tests.sh &&
for test_name in \
t1200-target-fixtures.sh \
@@ -913,9 +914,9 @@ test_expect_success 'operator and target runners have disjoint explicit scopes'
t1108-tpm-chain.sh \
t1111-upatch-get.sh \
t1114-uprobe-multi.sh \
- t1115-map-export-all.sh \
- t1116-otel-backend.sh \
- t1117-otel-serialized-metric.sh \
+ otel/t1115-map-export-all.sh \
+ otel/t1116-otel-backend.sh \
+ otel/t1117-otel-serialized-metric.sh \
t1122-initrd.sh \
t1123-keys.sh \
t1124-keys-add.sh \
diff --git a/testing/t0017-systemd-map-export.sh b/testing/t0017-systemd-map-export.sh
deleted file mode 100755
index 641db10e..00000000
--- a/testing/t0017-systemd-map-export.sh
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-
-cd "$(dirname "$0")"
-. ./test-lib.sh
-
-WORK=$(mktemp -d)
-GENERATED=$WORK/shirudo-map-export.service
-GENERATED_KEEPALIVE=$WORK/shirudo-keepalive.service
-GENERATED_BPM=$WORK/shirudo-bpm-repo-update.service
-trap 'rm -rf "$WORK"' EXIT
-
-test_expect_success 'map export service runs the configured batch exporter' '
- grep -q "^After=shirudo.service$" \
- ../systemd/shirudo-map-export.service.in &&
- grep -q "^ConditionPathExists=/run/shirudo/bpffs/lsm_link$" \
- ../systemd/shirudo-map-export.service.in &&
- grep -q "^EnvironmentFile=-/etc/shirudo/map-export.env$" \
- ../systemd/shirudo-map-export.service.in &&
- grep -q "^ExecStart=@bindir@/shirudo upatch map --all$" \
- ../systemd/shirudo-map-export.service.in
-'
-
-test_expect_success 'map export timer waits five seconds between runs' '
- grep -q "^OnBootSec=5s$" ../systemd/shirudo-map-export.timer &&
- grep -q "^OnUnitInactiveSec=5s$" \
- ../systemd/shirudo-map-export.timer &&
- grep -q "^Unit=shirudo-map-export.service$" \
- ../systemd/shirudo-map-export.timer &&
- grep -q "^WantedBy=timers.target$" \
- ../systemd/shirudo-map-export.timer
-'
-
-test_expect_success 'keepalive service exports status with TPM and system data' '
- grep -q "^After=shirudo.service$" \
- ../systemd/shirudo-keepalive.service.in &&
- grep -q "^EnvironmentFile=-/etc/shirudo/map-export.env$" \
- ../systemd/shirudo-keepalive.service.in &&
- grep -q "^ExecStart=@bindir@/shirudo status --otel --include-system$" \
- ../systemd/shirudo-keepalive.service.in
-'
-
-test_expect_success 'keepalive timer waits five seconds between runs' '
- grep -q "^OnBootSec=5s$" ../systemd/shirudo-keepalive.timer &&
- grep -q "^OnUnitInactiveSec=5s$" \
- ../systemd/shirudo-keepalive.timer &&
- grep -q "^Unit=shirudo-keepalive.service$" \
- ../systemd/shirudo-keepalive.timer &&
- grep -q "^WantedBy=timers.target$" \
- ../systemd/shirudo-keepalive.timer
-'
-
-test_expect_success 'BPM repository refresh service runs update before upgrade' '
- grep -q "^Wants=network-online.target$" \
- ../systemd/shirudo-bpm-repo-update.service.in &&
- grep -q "^After=network-online.target shirudo.service$" \
- ../systemd/shirudo-bpm-repo-update.service.in &&
- grep -q "^RequiresMountsFor=/etc/shirudo/bpm /var/lib/shirudo$" \
- ../systemd/shirudo-bpm-repo-update.service.in &&
- grep -q "^EnvironmentFile=-/etc/shirudo/bpm/environment$" \
- ../systemd/shirudo-bpm-repo-update.service.in &&
- grep -n "bpm repo update" ../systemd/shirudo-bpm-repo-update.service.in |
- cut -d: -f1 >"$WORK/bpm-update-line" &&
- grep -n "bpm upgrade" ../systemd/shirudo-bpm-repo-update.service.in |
- cut -d: -f1 >"$WORK/bpm-upgrade-line" &&
- test "$(cat "$WORK/bpm-update-line")" -lt \
- "$(cat "$WORK/bpm-upgrade-line")"
-'
-
-test_expect_success 'BPM repository refresh timer runs at boot and every minute' '
- grep -q "^OnBootSec=0s$" \
- ../systemd/shirudo-bpm-repo-update.timer &&
- grep -q "^OnUnitInactiveSec=60s$" \
- ../systemd/shirudo-bpm-repo-update.timer &&
- grep -q "^AccuracySec=1s$" \
- ../systemd/shirudo-bpm-repo-update.timer &&
- grep -q "^Unit=shirudo-bpm-repo-update.service$" \
- ../systemd/shirudo-bpm-repo-update.timer &&
- grep -q "^WantedBy=timers.target$" \
- ../systemd/shirudo-bpm-repo-update.timer
-'
-
-test_expect_success 'target install resolves and stages both exporter units' '
- sed "s|@bindir@|/opt/shirudo/bin|g" \
- ../systemd/shirudo-map-export.service.in >"$GENERATED" &&
- sed "s|@bindir@|/opt/shirudo/bin|g" \
- ../systemd/shirudo-keepalive.service.in >"$GENERATED_KEEPALIVE" &&
- sed "s|@bindir@|/opt/shirudo/bin|g" \
- ../systemd/shirudo-bpm-repo-update.service.in >"$GENERATED_BPM" &&
- (
- cd .. &&
- make -n -f Makefile.shirudo bindir=/opt/shirudo/bin \
- DESTDIR="$WORK/target" \
- systemdunitdir=/usr/lib/systemd/system install-target \
- >"$WORK/target.plan"
- ) &&
- grep -q "^ExecStart=/opt/shirudo/bin/shirudo upatch map --all$" \
- "$GENERATED" &&
- grep -q "^ExecStart=/opt/shirudo/bin/shirudo status --otel --include-system$" \
- "$GENERATED_KEEPALIVE" &&
- grep -q "^ExecStart=/opt/shirudo/bin/shirudo bpm repo update$" \
- "$GENERATED_BPM" &&
- grep -q "^ExecStart=/opt/shirudo/bin/shirudo bpm upgrade$" \
- "$GENERATED_BPM" &&
- grep -q "systemd/shirudo.service" "$WORK/target.plan" &&
- grep -q "systemd/shirudo-map-export.service" "$WORK/target.plan" &&
- grep -q "systemd/shirudo-map-export.timer" "$WORK/target.plan" &&
- grep -q "systemd/shirudo-keepalive.service" "$WORK/target.plan" &&
- grep -q "systemd/shirudo-keepalive.timer" "$WORK/target.plan" &&
- grep -q "systemd/shirudo-bpm-repo-update.service" "$WORK/target.plan" &&
- grep -q "systemd/shirudo-bpm-repo-update.timer" "$WORK/target.plan"
-'
-
-test_expect_success 'operator install excludes target exporter units' '
- (
- cd .. &&
- make -n -f Makefile.shirudo DESTDIR="$WORK/operator" \
- install-operator >"$WORK/operator.plan"
- ) &&
- ! grep -q "shirudo-map-export" "$WORK/operator.plan" &&
- ! grep -q "shirudo-keepalive" "$WORK/operator.plan" &&
- ! grep -q "shirudo-bpm-repo-update" "$WORK/operator.plan"
-'
-
-test_expect_success 'target package enables and removes the timer safely' '
- grep -q "systemctl enable shirudo-map-export.timer" \
- ../packaging/deb/builddeb.sh &&
- grep -q "systemctl --no-reload disable --now shirudo-map-export.timer" \
- ../packaging/deb/builddeb.sh &&
- grep -q "systemctl enable shirudo-keepalive.timer" \
- ../packaging/deb/builddeb.sh &&
- grep -q "systemctl --no-reload disable --now shirudo-keepalive.timer" \
- ../packaging/deb/builddeb.sh &&
- grep -q "systemctl enable shirudo-bpm-repo-update.timer" \
- ../packaging/deb/builddeb.sh &&
- grep -q "systemctl --no-reload disable --now shirudo-bpm-repo-update.timer" \
- ../packaging/deb/builddeb.sh
-'
-
-test_expect_success 'the rpm target package carries the same timer scriptlets' '
- for unit in shirudo-map-export shirudo-keepalive shirudo-bpm-repo-update \
- shirudo-bpm-tree-sync
- do
- grep -q "systemctl enable $unit.timer" ../packaging/rpm/buildrpm.sh &&
- grep -q "systemctl --no-reload disable --now $unit.timer" \
- ../packaging/rpm/buildrpm.sh || return 1
- done &&
- grep -q "systemctl enable shirudo.service" ../packaging/rpm/buildrpm.sh &&
- grep -q "systemctl --no-reload disable shirudo.service" ../packaging/rpm/buildrpm.sh
-'
-
-test_done
diff --git a/testing/t0019-bpm-repo-update.sh b/testing/t0019-bpm-repo-update.sh
new file mode 100755
index 00000000..d8d4608a
--- /dev/null
+++ b/testing/t0019-bpm-repo-update.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+# SPDX-License-Identifier: BSD-2-Clause
+# Copyright (c) 2026 Authors of shirudo
+
+cd "$(dirname "$0")"
+. ./test-lib.sh
+
+WORK=$(mktemp -d)
+GENERATED_BPM=$WORK/shirudo-bpm-repo-update.service
+trap 'rm -rf "$WORK"' EXIT
+
+test_expect_success 'BPM repository refresh service runs update before upgrade' '
+ grep -q "^Wants=network-online.target$" \
+ ../systemd/shirudo-bpm-repo-update.service.in &&
+ grep -q "^After=network-online.target shirudo.service$" \
+ ../systemd/shirudo-bpm-repo-update.service.in &&
+ grep -q "^RequiresMountsFor=/etc/shirudo/bpm /var/lib/shirudo$" \
+ ../systemd/shirudo-bpm-repo-update.service.in &&
+ grep -q "^EnvironmentFile=-/etc/shirudo/bpm/environment$" \
+ ../systemd/shirudo-bpm-repo-update.service.in &&
+ grep -n "bpm repo update" \
+ ../systemd/shirudo-bpm-repo-update.service.in |
+ cut -d: -f1 >"$WORK/bpm-update-line" &&
+ grep -n "bpm upgrade" \
+ ../systemd/shirudo-bpm-repo-update.service.in |
+ cut -d: -f1 >"$WORK/bpm-upgrade-line" &&
+ test "$(cat "$WORK/bpm-update-line")" -lt \
+ "$(cat "$WORK/bpm-upgrade-line")"
+'
+
+test_expect_success 'BPM repository refresh timer runs at boot and every minute' '
+ grep -q "^OnBootSec=0s$" \
+ ../systemd/shirudo-bpm-repo-update.timer &&
+ grep -q "^OnUnitInactiveSec=60s$" \
+ ../systemd/shirudo-bpm-repo-update.timer &&
+ grep -q "^AccuracySec=1s$" \
+ ../systemd/shirudo-bpm-repo-update.timer &&
+ grep -q "^Unit=shirudo-bpm-repo-update.service$" \
+ ../systemd/shirudo-bpm-repo-update.timer &&
+ grep -q "^WantedBy=timers.target$" \
+ ../systemd/shirudo-bpm-repo-update.timer
+'
+
+test_expect_success 'target install resolves and stages the BPM refresh unit' '
+ sed "s|@bindir@|/opt/shirudo/bin|g" \
+ ../systemd/shirudo-bpm-repo-update.service.in >"$GENERATED_BPM" &&
+ (
+ cd .. &&
+ make -n -f Makefile.shirudo bindir=/opt/shirudo/bin \
+ DESTDIR="$WORK/target" \
+ systemdunitdir=/usr/lib/systemd/system install-target \
+ >"$WORK/target.plan"
+ ) &&
+ grep -q "^ExecStart=/opt/shirudo/bin/shirudo bpm repo update$" \
+ "$GENERATED_BPM" &&
+ grep -q "^ExecStart=/opt/shirudo/bin/shirudo bpm upgrade$" \
+ "$GENERATED_BPM" &&
+ grep -q "systemd/shirudo.service" "$WORK/target.plan" &&
+ grep -q "systemd/shirudo-bpm-repo-update.service" "$WORK/target.plan" &&
+ grep -q "systemd/shirudo-bpm-repo-update.timer" "$WORK/target.plan"
+'
+
+test_expect_success 'operator install excludes the BPM refresh unit' '
+ (
+ cd .. &&
+ make -n -f Makefile.shirudo DESTDIR="$WORK/operator" \
+ install-operator >"$WORK/operator.plan"
+ ) &&
+ ! grep -q "shirudo-bpm-repo-update" "$WORK/operator.plan"
+'
+
+test_expect_success 'target package enables and removes the BPM refresh timer' '
+ grep -q "systemctl enable shirudo-bpm-repo-update.timer" \
+ ../packaging/deb/builddeb.sh &&
+ grep -q "systemctl --no-reload disable --now shirudo-bpm-repo-update.timer" \
+ ../packaging/deb/builddeb.sh
+'
+
+test_expect_success 'the rpm target package carries BPM and service timer scriptlets' '
+ for unit in shirudo-bpm-repo-update shirudo-bpm-tree-sync
+ do
+ grep -q "systemctl enable $unit.timer" ../packaging/rpm/buildrpm.sh &&
+ grep -q "systemctl --no-reload disable --now $unit.timer" \
+ ../packaging/rpm/buildrpm.sh || return 1
+ done &&
+ grep -q "systemctl enable shirudo.service" ../packaging/rpm/buildrpm.sh &&
+ grep -q "systemctl --no-reload disable shirudo.service" \
+ ../packaging/rpm/buildrpm.sh
+'
+
+test_done
diff --git a/testing/upatch/infra/test.plan.md b/testing/upatch/infra/test.plan.md
index 3bff2f55..ee9f6564 100644
--- a/testing/upatch/infra/test.plan.md
+++ b/testing/upatch/infra/test.plan.md
@@ -26,8 +26,8 @@ this review.
| UI-15 | Target rejects an artifact signed by an untrusted key | Covered | `t1200-target-fixtures.sh` | Keep the foreign-signed fixture rejection and valid non-Shirudo keyring denial. |
| UI-16 | `upatch get` reads loaded source information from the kernel | Covered | `t1111-upatch-get.sh` | The current assertion checks that the loaded marker source appears in output. Detailed JSON and line-location assertions are not present. |
| UI-17 | uprobe.multi verifies target identity and attaches all matched offsets | Covered | `t1114-uprobe-multi.sh` | Keep build-ID mismatch refusal, target/function status, and execution of both matched functions. |
-| UI-18 | `upatch map` emits detailed map JSON and appends NDJSON records | Covered | `t0008-upatch-serializer-pages.sh`, `t1115-map-export-all.sh`, `t1200-target-fixtures.sh` | Keep output-path validation, schema and per-map JSON checks. This row covers the upatch map interface, not exporter transport. |
-| UI-19 | Target executes a serializer and decodes its output | Covered | `t1117-otel-serialized-metric.sh` | Keep the serialized-counter fixture assertions for decoded values and cumulative metric fields; generic exporter behavior is outside this matrix. |
+| UI-18 | `upatch map` emits detailed map JSON and appends NDJSON records | Covered | `t0008-upatch-serializer-pages.sh`, `otel/t1115-map-export-all.sh`, `t1200-target-fixtures.sh` | Keep output-path validation, schema and per-map JSON checks. This row covers the upatch map interface, not exporter transport. |
+| UI-19 | Target executes a serializer and decodes its output | Covered | `otel/t1117-otel-serialized-metric.sh` | Keep the serialized-counter fixture assertions for decoded values and cumulative metric fields; generic exporter behavior is outside this matrix. |
## Review notes