diff --git a/overlay.nix b/overlay.nix index d3652d5..e328262 100644 --- a/overlay.nix +++ b/overlay.nix @@ -120,6 +120,10 @@ let nanos6 = bsc.nanos6Release; nanos6Release = callPackage ./bsc/nanos6/default.nix { }; nanos6Git = callPackage ./bsc/nanos6/git.nix { }; + nanos6Debug = bsc.nanos6.overrideAttrs (old: { + dontStrip = true; + enableDebugging = true; + }); jemalloc = self.jemalloc.overrideAttrs (old: { @@ -546,6 +550,10 @@ let }; }; }; + + test = { + hwloc = callPackage ./test/bugs/hwloc.nix { }; + }; }; }); diff --git a/test/bugs/hwloc.c b/test/bugs/hwloc.c new file mode 100644 index 0000000..e0ca8ec --- /dev/null +++ b/test/bugs/hwloc.c @@ -0,0 +1,36 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + size_t i, coreCount; + hwloc_topology_t topology; + hwloc_obj_t obj; + + if(hwloc_topology_init(&topology)) + { + fprintf(stderr, "hwloc_topology_init failed\n"); + exit(EXIT_FAILURE); + } + + if(hwloc_topology_load(topology)) + { + fprintf(stderr, "hwloc_topology_load failed\n"); + exit(EXIT_FAILURE); + } + + coreCount = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_CORE); + printf("coreCount = %zu\n", coreCount); + + for(i = 0; i < coreCount; i++) + { + obj = hwloc_get_obj_by_type(topology, HWLOC_OBJ_PU, i); + assert(obj != NULL); + assert(obj->parent != NULL); + printf("obj->parent->type = %d, i = %zu\n", obj->parent->type, i); + assert(obj->parent->type == HWLOC_OBJ_CORE); + } + + printf("hwloc test OK\n"); +} diff --git a/test/bugs/hwloc.nix b/test/bugs/hwloc.nix new file mode 100644 index 0000000..2546d3d --- /dev/null +++ b/test/bugs/hwloc.nix @@ -0,0 +1,20 @@ +{ + stdenv +, hwloc +, strace +}: + +stdenv.mkDerivation { + name = "hwloc-test"; + + src = ./.; + + buildInputs = [ hwloc strace ]; + + buildPhase = '' + ls -l /sys + gcc -lhwloc hwloc.c -o hwloc + strace ./hwloc + ''; + +}