Files
systemd/test/units/TEST-94-COCO/guest-test.sh
T
Paul Meyer 671206e266 test: split coco test per-platform
Grow TEST-94-COCO from a single inline check into the reusable structure
that can be used by multiple future subtests:

- lib.sh: code shared between subtests on the host side.
- guest-test.sh: the testcase_coco_* checks.
- guest-test-runner.sh: runs each testcase_coco_* check, ships guest
  side testcase results over vsock.

Helpers live under test/units/TEST-94-COCO/. The vsock records are
best-effort detail, the aggregate exit status stays the authoritative
pass/fail.

Split the test into subtests per platform/boot flow.

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-09-25 08:15:24 +02:00

18 lines
729 B
Bash

# SPDX-License-Identifier: LGPL-2.1-or-later
# shellcheck shell=bash
#
# Guest-side checks for the confidential computing integration test (TEST-94-COCO). Sourced by
# guest-test-runner.sh inside the confidential guest; each testcase_coco_* function is one
# sub-subtest. The upcoming credential-trust checks land here as further functions.
if [[ "${BASH_SOURCE[0]}" -ef "$0" ]]; then
echo >&2 "This file should not be executed directly"
exit 1
fi
# Assert the guest observes the confidential-virtualization technology the host launched it with.
# COCO_TYPE is provided by the injected guest unit (Environment=, see lib.sh).
testcase_coco_detect_virt() {
assert_eq "$(systemd-detect-virt --cvm)" "${COCO_TYPE:?}"
}