diff options
Diffstat (limited to 'contrib/atf/atf-c++')
| -rw-r--r-- | contrib/atf/atf-c++/atf-c++.3 | 10 | ||||
| -rw-r--r-- | contrib/atf/atf-c++/tests.cpp | 7 | ||||
| -rw-r--r-- | contrib/atf/atf-c++/tests.hpp | 1 |
3 files changed, 17 insertions, 1 deletions
diff --git a/contrib/atf/atf-c++/atf-c++.3 b/contrib/atf/atf-c++/atf-c++.3 index fead776755af..bb83e6214622 100644 --- a/contrib/atf/atf-c++/atf-c++.3 +++ b/contrib/atf/atf-c++/atf-c++.3 @@ -22,7 +22,7 @@ .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.Dd March 6, 2017 +.Dd May 11, 2025 .Dt ATF-C++ 3 .Os .Sh NAME @@ -277,6 +277,14 @@ It is possible to get the path to the test case's source directory from any of its three components by querying the .Sq srcdir configuration variable. +.Ss Requiring kernel modules +Aside from the +.Va require.kmods +meta-data variable available in the header only, one can also check for +additional kernel modules in the test case's body by using the +.Fn require_kmod +function, which takes the name of a single module. +If it is not found, the test case will be automatically skipped. .Ss Requiring programs Aside from the .Va require.progs diff --git a/contrib/atf/atf-c++/tests.cpp b/contrib/atf/atf-c++/tests.cpp index ede9609e32d6..a9f5d4a5fe2c 100644 --- a/contrib/atf/atf-c++/tests.cpp +++ b/contrib/atf/atf-c++/tests.cpp @@ -319,6 +319,13 @@ impl::tc::cleanup(void) } void +impl::tc::require_kmod(const std::string& kmod) + const +{ + atf_tc_require_kmod(kmod.c_str()); +} + +void impl::tc::require_prog(const std::string& prog) const { diff --git a/contrib/atf/atf-c++/tests.hpp b/contrib/atf/atf-c++/tests.hpp index a03cc852dcf8..8fdf15a9f05d 100644 --- a/contrib/atf/atf-c++/tests.hpp +++ b/contrib/atf/atf-c++/tests.hpp @@ -80,6 +80,7 @@ protected: virtual void body(void) const = 0; virtual void cleanup(void) const; + void require_kmod(const std::string&) const; void require_prog(const std::string&) const; friend struct tc_impl; |
