All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH] unit: check cipher support and cleanup in test-storage
Date: Mon,  5 May 2025 05:35:40 -0700	[thread overview]
Message-ID: <20250505123540.281773-1-prestwoj@gmail.com> (raw)

The __storage_decrypt API requires AES_CTR so support should be
checked before running that test. In addition storage_exit was never
being called which leaves unbalanced mlock/munlock calls.
---
 unit/test-storage.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/unit/test-storage.c b/unit/test-storage.c
index c40518e6..765d9967 100644
--- a/unit/test-storage.c
+++ b/unit/test-storage.c
@@ -44,12 +44,19 @@ static void test_short_encrypted_bytes(const void *data)
 
 int main(int argc, char *argv[])
 {
+	int ret;
+
 	l_test_init(&argc, &argv);
 
 	storage_init((const uint8_t *)"abc123", 6);
 
-	l_test_add("/storage/profile encryption",
+	if (l_cipher_is_supported(L_CIPHER_AES_CTR))
+		l_test_add("/storage/profile encryption",
 			test_short_encrypted_bytes, NULL);
 
-	return l_test_run();
+	ret = l_test_run();
+
+	storage_exit();
+
+	return ret;
 }
-- 
2.34.1


             reply	other threads:[~2025-05-05 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 12:35 James Prestwood [this message]
2025-05-05 12:39 ` [PATCH] unit: check cipher support and cleanup in test-storage Marcel Holtmann
2025-05-05 12:50   ` James Prestwood
2025-05-05 12:55     ` Marcel Holtmann
2025-05-05 12:58       ` James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250505123540.281773-1-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.