* [PATCH] tests: Ensure loc_database_lookup finds a match
@ 2025-04-07 1:29 Valters Jansons
2025-04-07 10:10 ` Michael Tremer
0 siblings, 1 reply; 2+ messages in thread
From: Valters Jansons @ 2025-04-07 1:29 UTC (permalink / raw)
To: location
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tests: Ensure loc_database_lookup finds a match
2025-04-07 1:29 [PATCH] tests: Ensure loc_database_lookup finds a match Valters Jansons
@ 2025-04-07 10:10 ` Michael Tremer
0 siblings, 0 replies; 2+ messages in thread
From: Michael Tremer @ 2025-04-07 10:10 UTC (permalink / raw)
To: Valters Jansons; +Cc: location
Hello Valters,
Thank you for this patch.
I have merged it. Indeed there should be no error returned, but the result pointer should be NULL. That was a change in the API but it should always have been like this.
On all the architectures that we are now testing on Jenkins, this is building just fine. I currently don’t build for hppa.
-Michael
> On 7 Apr 2025, at 02:29, Valters Jansons <valter.jansons@gmail.com> wrote:
>
> 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
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-07 10:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-07 1:29 [PATCH] tests: Ensure loc_database_lookup finds a match Valters Jansons
2025-04-07 10:10 ` Michael Tremer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox