34 lines
1.4 KiB
Diff
34 lines
1.4 KiB
Diff
From b6e0ad2af132a9ddd859735408da381e20a31c72 Mon Sep 17 00:00:00 2001
|
|
From: Omar Sandoval <osandov@osandov.com>
|
|
Date: Thu, 3 Mar 2022 01:17:51 -0800
|
|
Subject: [PATCH] tests: check for missing or invalid /proc/kcore for Linux
|
|
kernel tests
|
|
|
|
If /proc/kcore is missing (e.g., because CONFIG_PROC_KCORE is not
|
|
enabled) or invalid (e.g., Docker mounts /dev/null over /proc/kcore),
|
|
then skip the tests.
|
|
|
|
Signed-off-by: Omar Sandoval <osandov@osandov.com>
|
|
---
|
|
tests/helpers/linux/__init__.py | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/tests/helpers/linux/__init__.py b/tests/helpers/linux/__init__.py
|
|
index 5d71598d..2e48fb85 100644
|
|
--- a/tests/helpers/linux/__init__.py
|
|
+++ b/tests/helpers/linux/__init__.py
|
|
@@ -45,6 +45,13 @@ def setUpClass(cls):
|
|
"Linux helper tests must be run as root "
|
|
"(run with env DRGN_RUN_LINUX_HELPER_TESTS=1 to force)"
|
|
)
|
|
+ except (FileNotFoundError, ValueError):
|
|
+ if force_run:
|
|
+ raise
|
|
+ LinuxHelperTestCase.skip_reason = (
|
|
+ "Linux helper tests require /proc/kcore "
|
|
+ "(run with env DRGN_RUN_LINUX_HELPER_TESTS=1 to force)"
|
|
+ )
|
|
else:
|
|
# Some of the tests use the loop module. Open loop-control
|
|
# so that it is loaded.
|