public inbox for location@lists.ipfire.org
 help / color / mirror / Atom feed
From: Valters Jansons <valter.jansons@gmail.com>
To: location@lists.ipfire.org
Subject: [PATCH] tests: Ensure loc_database_lookup finds a match
Date: Mon,  7 Apr 2025 04:29:29 +0300	[thread overview]
Message-ID: <20250407012929.19255-1-valter.jansons@gmail.com> (raw)

Commit 9e72b8a modified the lookup function to return 0 even if no
matches are found. As result, the test case could pass even if the
database lookup did not find any matches.

This commit restores the original intent of the test case, by adding
a failure condition when `network1` is NULL. This is similar to how
the subsequent test case was modified for the inverse condition.
---
I was checking https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021952
and wondering why the "Could not look up 2001:db8::" issue would
suddenly disappear. This change popped up as a potential reason.
So I am expecting hppa builds will start failing intermittently again.

 src/test-network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test-network.c b/src/test-network.c
index 0cac1a4..73062f4 100644
--- a/src/test-network.c
+++ b/src/test-network.c
@@ -351,7 +351,7 @@ int main(int argc, char** argv) {
 
 	// Lookup an address in the subnet
 	err = loc_database_lookup_from_string(db, "2001:db8::", &network1);
-	if (err) {
+	if (err || !network1) {
 		fprintf(stderr, "Could not look up 2001:db8::\n");
 		exit(EXIT_FAILURE);
 	}
-- 
2.49.0



             reply	other threads:[~2025-04-07  1:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07  1:29 Valters Jansons [this message]
2025-04-07 10:10 ` Michael Tremer

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=20250407012929.19255-1-valter.jansons@gmail.com \
    --to=valter.jansons@gmail.com \
    --cc=location@lists.ipfire.org \
    /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