From: Bastien Nocera <hadess@hadess.net>
To: ell@lists.linux.dev
Cc: Bastien Nocera <hadess@hadess.net>
Subject: [PATCH 4/4] unit: Skip hwdb test when hwdb isn't available
Date: Tue, 17 Mar 2026 15:28:57 +0100 [thread overview]
Message-ID: <20260317143018.628844-5-hadess@hadess.net> (raw)
In-Reply-To: <20260317143018.628844-1-hadess@hadess.net>
Alpine includes a compatible libudev without implementing hwdb, so skip
the test on that platform.
---
unit/test-hwdb.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/unit/test-hwdb.c b/unit/test-hwdb.c
index 1c4928f3f993..f45f3973d2b9 100644
--- a/unit/test-hwdb.c
+++ b/unit/test-hwdb.c
@@ -14,6 +14,8 @@
#include <ell/ell.h>
+static struct l_hwdb *hwdb = NULL;
+
struct hwdb_stats {
int aliases;
int entries;
@@ -56,11 +58,9 @@ static void check_entry(const char *modalias, struct l_hwdb_entry *entries,
static void test_hwdb(const void *data)
{
- struct l_hwdb *hwdb;
struct hwdb_stats stats = { 0 };
bool result;
- hwdb = l_hwdb_new_default();
assert(hwdb);
result = l_hwdb_foreach(hwdb, check_entry, &stats);
@@ -84,11 +84,18 @@ static void test_hwdb(const void *data)
l_hwdb_unref(hwdb);
}
+static bool test_hwdb_precheck (const void *data)
+{
+ hwdb = l_hwdb_new_default();
+ return hwdb != NULL;
+}
+
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
- l_test_add("hwdb", test_hwdb, NULL);
+ l_test_add_func_precheck("hwdb",
+ test_hwdb, test_hwdb_precheck, 0);
return l_test_run();
}
--
2.53.0
next prev parent reply other threads:[~2026-03-17 14:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 14:28 [PATCH 0/4] More build fixes Bastien Nocera
2026-03-17 14:28 ` [PATCH 1/4] unit: Fix incorrect basename usage Bastien Nocera
[not found] ` <D98F0DC1-9621-4E61-887A-CCA145F16AFF@bluewin.ch>
2026-03-18 16:17 ` Bastien Nocera
2026-03-17 14:28 ` [PATCH 2/4] ell: Fix rawmemchr implementation warning in Alpine/clang Bastien Nocera
2026-03-17 14:28 ` [PATCH 3/4] ell: Fix cert_pkcs12_pbkdf() warning under Alpine/clang Bastien Nocera
2026-03-17 14:28 ` Bastien Nocera [this message]
2026-04-16 9:18 ` [PATCH 0/4] More build fixes Bastien Nocera
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=20260317143018.628844-5-hadess@hadess.net \
--to=hadess@hadess.net \
--cc=ell@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox