[PATCH 5/5] unit: Fix maxkeys test output
Bastien Nocera <[email protected]> Thu, 31 Jul 2025 16:20:39 +0200
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
The output from our "maxkeys" check was made before running the tests,
which meant that the output didn't conform to the TAP specification.
Move the check to a test, it should provide the same information to test
runners.
---
unit/test-tls.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/unit/test-tls.c b/unit/test-tls.c
index 540416974751..1f7961dc21e6 100644
--- a/unit/test-tls.c
+++ b/unit/test-tls.c
@@ -700,6 +700,18 @@ static void test_tls_test(const void *data)
test_tls_with_ver(test, L_TLS_V10, 0);
}
+static void test_max_keys(const void *data)
+{
+ uint32_t maxkeys;
+ int r;
+
+ r = l_sysctl_get_u32(&maxkeys, "/proc/sys/kernel/keys/%s",
+ getuid() > 0 ? "maxkeys" : "root_maxkeys");
+ if (!r && maxkeys < 2000)
+ l_info("# Running sysctl kernel.keys.%s=2000 is recommended",
+ getuid() > 0 ? "maxkeys" : "root_maxkeys");
+}
+
static void test_tls_version_mismatch_test(const void *data)
{
test_tls_with_ver(&tls_conn_test_version_mismatch,
@@ -929,8 +941,6 @@ static void test_tls_suite_test(const void *data)
int main(int argc, char *argv[])
{
unsigned int i;
- uint32_t maxkeys;
- int r;
l_test_init(&argc, &argv);
@@ -979,12 +989,8 @@ int main(int argc, char *argv[])
goto done;
}
- r = l_sysctl_get_u32(&maxkeys, "/proc/sys/kernel/keys/%s",
- getuid() > 0 ? "maxkeys" : "root_maxkeys");
- if (!r && maxkeys < 2000)
- printf("Running sysctl kernel.keys.%s=2000 is recommended\n",
- getuid() > 0 ? "maxkeys" : "root_maxkeys");
-
+ l_test_add_func("Test maxkeys",
+ test_max_keys, 0);
l_test_add_data_func("TLS connection no auth",
&tls_conn_test_no_auth, test_tls_test,
L_TEST_FLAG_ALLOW_FAILURE);
--
2.50.0