1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// SPDX-FileCopyrightText: Copyright 2026 Au-Zone Technologies
// SPDX-License-Identifier: Apache-2.0
//! DMA-BUF test policy: a skip must not be able to masquerade as coverage.
//!
//! Tests that need a DMA heap return early when `is_dma_available()` is
//! false and report `ok`. On a host whose heap node exists but is not
//! openable by the test user (GitHub's hosted runners ship
//! `/dev/dma_heap/system` as `root:video 0660`), that is indistinguishable
//! from real coverage. `HAL_TEST_REQUIRE_DMA=1` turns the skip into a
//! failure naming the test and the reason, so a lane that is meant to have
//! a heap cannot silently stop testing it.
//!
//! This file has no crate references so it can be `#[path]`-included from
//! both the library's `test_support` module and the integration tests; each
//! compilation unit supplies its own `is_dma_available()` to [`decide`].
/// `true` when `HAL_TEST_REQUIRE_DMA=1` is set.
/// The pure decision: `true` when `satisfied`; otherwise a failure or a skip
/// depending on `require`. The caller reports the skip on a `false` return.
///
/// # Panics
///
/// When `require` is `true` and `satisfied` is `false`. The message names
/// `HAL_TEST_REQUIRE_DMA=1`, `what`, and `why`.
/// `true` when the caller should run; `false` when it should return early,
/// after writing `SKIPPED: {what} - {why}` straight to stderr so libtest's
/// output capture cannot hide it.
///
/// # Panics
///
/// When `HAL_TEST_REQUIRE_DMA=1` and `available` is `false`.