Skip to content

Commit

Permalink
test: add backends
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hirsch <scivision@users.noreply.github.com>
  • Loading branch information
scivision committed Nov 4, 2021
1 parent 8aa410e commit fb123e4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
12 changes: 12 additions & 0 deletions contrib/windows-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ check_include_file("dirent.h" HAVE_DIRENT_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
check_symbol_exists(mkstemp "stdlib.h" HAVE_MKSTEMP)

try_run(
_have_cpuid
compileOK
${CMAKE_CURRENT_BINARY_DIR}/x86cpuid
${CMAKE_CURRENT_SOURCE_DIR}/have_x86_cpuid.c
)
if(_have_cpuid EQUAL 0)
set(HWLOC_HAVE_X86_CPUID 1)
else()
set(HWLOC_HAVE_X86_CPUID 0)
endif()

configure_file(${TOPDIR}/contrib/windows/hwloc_config.h include/hwloc/autogen/config.h COPYONLY)
configure_file(${TOPDIR}/contrib/windows/static-components.h include/static-components.h COPYONLY)
if(MSVConly)
Expand Down
9 changes: 9 additions & 0 deletions contrib/windows-cmake/have_x86_cpuid.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// using macros from https://stackoverflow.com/a/66249936/7703794 (CC BY-SA 3.0)

int main(void) {
#if defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86)
return 0;
#else
return 1;
#endif
}
2 changes: 2 additions & 0 deletions contrib/windows/private_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#cmakedefine HAVE_MKSTEMP

#cmakedefine HWLOC_HAVE_X86_CPUID

/* Define to 1 if the system has the type `CACHE_DESCRIPTOR'. */
#define HAVE_CACHE_DESCRIPTOR 0

Expand Down
14 changes: 13 additions & 1 deletion tests/hwloc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
foreach(t api_version)
foreach(t api_version backends bind
bitmap bitmap_compare_inclusion bitmap_first_last_weight bitmap_singlify bitmap_string
distances get_area_memlocation get_cache_covering_cpuset get_closest_objs get_largest_objs_inside_cpuset
get_last_cpu_location get_next_obj_covering_cpuset get_obj_below_array_by_type get_obj_covering_cpuset
get_obj_inside_cpuset get_obj_with_same_locality get_shared_cache_covering_obj
groups insert_misc iodevs is_thissystem list_components obj_infos object_userdata pci_backend synthetic
topology_abi topology_allow topology_diff topology_dup topology_restrict type_depth type_sscanf
)
add_executable(hwloc_${t} hwloc_${t}.c)
target_link_libraries(hwloc_${t} PRIVATE hwloc::hwloc)

add_test(NAME ${t} COMMAND hwloc_${t})
set_tests_properties(${t} PROPERTIES TIMEOUT 10)
endforeach()

target_compile_definitions(hwloc_type_sscanf PRIVATE XMLTESTDIR=\"${CMAKE_CURRENT_SOURCE_DIR}/xml/\")

set_tests_properties(get_obj_with_same_locality PROPERTIES ENVIRONMENT HWLOC_TOP_SRCDIR=${TOPDIR})

0 comments on commit fb123e4

Please sign in to comment.