Skip to content

Commit

Permalink
tests/backends.c: fix a failure when /sys isn't available on Linux on…
Browse files Browse the repository at this point in the history
… non-x86

Since 2.9, Linux discovery aborts if /sys isn't available.
Usually it will fallback to the x86 backend... except on non-x86 platforms obviously
where it would fallback to "noos" instead.

The hwloc_backends.c test verified that the "Backend" info attribute was the same
in the XML-loaded topology and the original topology, but it did not handle the
case where that info attribute did not exist at all, which is the case when
only "noos" is used.

This is first reported by Simon South on https://issues.guix.gnu.org/61493
Thanks to Ludovic Courtes for forwarding to me.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Mar 7, 2023
1 parent 2d20a32 commit 0780a3b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/hwloc/hwloc_backends.c
@@ -1,5 +1,5 @@
/*
* Copyright © 2012-2022 Inria. All rights reserved.
* Copyright © 2012-2023 Inria. All rights reserved.
* See COPYING in top-level directory.
*/

Expand Down Expand Up @@ -46,10 +46,14 @@ static const char *get_backend_name(hwloc_topology_t topo)
static void assert_backend_name(hwloc_topology_t topo, const char *wanted)
{
const char *found = get_backend_name(topo);
int diff;
assert(found);
diff = strcmp(found, wanted);
assert(!diff);
if (!wanted) {
assert(!found);
} else {
int diff;
assert(found);
diff = strcmp(found, wanted);
assert(!diff);
}
}

static void assert_foo_bar(hwloc_topology_t topo, int setornot)
Expand Down

0 comments on commit 0780a3b

Please sign in to comment.