#include <hwloc.h>
#include <stdio.h>

/* The body of the test is in a separate .c file and a separate
   library, just to ensure that hwloc didn't force compilation with
   visibility flags enabled. */

int do_test(void)
{
    mytest_hwloc_topology_t topology;
    unsigned depth;
    hwloc_bitmap_t cpu_set;

    /* Just call a bunch of functions to see if we can link and run */

    printf("*** Test 1: bitmap alloc\n");
    cpu_set = mytest_hwloc_bitmap_alloc();
    if (NULL == cpu_set) return 1;
    printf("*** Test 2: topology init\n");
    if (0 != mytest_hwloc_topology_init(&topology)) return 1;
    printf("*** Test 3: topology load\n");
    if (0 != mytest_hwloc_topology_load(topology)) return 1;
    printf("*** Test 4: topology get depth\n");
    depth = mytest_hwloc_topology_get_depth(topology);
    if (depth < 0) return 1;
    printf("    Max depth: %u\n", depth);
    printf("*** Test 5: topology destroy\n");
    mytest_hwloc_topology_destroy(topology);
    printf("*** Test 6: bitmap free\n");
    mytest_hwloc_bitmap_free(cpu_set);

    return 0;
}

#include <hwloc.h>
#include <stdio.h>

/* The body of the test is in a separate .c file and a separate
   library, just to ensure that hwloc didn't force compilation with
   visibility flags enabled. */

int do_test(void)
{
    mytest_hwloc_topology_t topology;
    unsigned depth;
    hwloc_cpuset_t cpu_set;

    /* Just call a bunch of functions to see if we can link and run */

    printf("*** Test 1: cpuset alloc\n");
    cpu_set = mytest_hwloc_cpuset_alloc();
    if (NULL == cpu_set) return 1;
    printf("*** Test 2: topology init\n");
    if (0 != mytest_hwloc_topology_init(&topology)) return 1;
    printf("*** Test 3: topology load\n");
    if (0 != mytest_hwloc_topology_load(topology)) return 1;
    printf("*** Test 4: topology get depth\n");
    depth = mytest_hwloc_topology_get_depth(topology);
    if (depth < 0) return 1;
    printf("    Max depth: %u\n", depth);
    printf("*** Test 5: topology destroy\n");
    mytest_hwloc_topology_destroy(topology);
    printf("*** Test 6: cpuset free\n");
    mytest_hwloc_cpuset_free(cpu_set);

    return 0;
}

--- 
+++ 
@@ -9,12 +9,12 @@
 {
     mytest_hwloc_topology_t topology;
     unsigned depth;
-    hwloc_cpuset_t cpu_set;
+    hwloc_bitmap_t cpu_set;
 
     /* Just call a bunch of functions to see if we can link and run */
 
-    printf("*** Test 1: cpuset alloc\n");
-    cpu_set = mytest_hwloc_cpuset_alloc();
+    printf("*** Test 1: bitmap alloc\n");
+    cpu_set = mytest_hwloc_bitmap_alloc();
     if (NULL == cpu_set) return 1;
     printf("*** Test 2: topology init\n");
     if (0 != mytest_hwloc_topology_init(&topology)) return 1;
@@ -26,8 +26,8 @@
     printf("    Max depth: %u\n", depth);
     printf("*** Test 5: topology destroy\n");
     mytest_hwloc_topology_destroy(topology);
-    printf("*** Test 6: cpuset free\n");
-    mytest_hwloc_cpuset_free(cpu_set);
+    printf("*** Test 6: bitmap free\n");
+    mytest_hwloc_bitmap_free(cpu_set);
 
     return 0;
 }
Convert the embedded test to the bitmap API

git-svn-id: bb34cd5123d2f821b9f934b050c449c8bfd5d5c1@2512 4b44e086-7f34-40ce-a3bd-00e031736276
