Skip to content

Commit 372e832

Browse files
authored
capi: Fix testing stand-alone inclusion of headers (#11882)
If headers with the same filename were in different directories their tests would clobber each other, so this fixes the test paths and filenames to ensure that each header is indeed tested. This then fixes issues with `component/val.h` and `component/linker.h` to add some missing includes.
1 parent d6dbcd2 commit 372e832

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

crates/c-api/include/wasmtime/component/linker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <wasmtime/component/instance.h>
99
#include <wasmtime/conf.h>
1010
#include <wasmtime/error.h>
11+
#include <wasmtime/module.h>
1112
#include <wasmtime/store.h>
1213

1314
#ifdef WASMTIME_FEATURE_COMPONENT_MODEL

crates/c-api/include/wasmtime/component/val.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
99

10+
#include <stdint.h>
11+
#include <wasm.h>
12+
1013
#ifdef __cplusplus
1114
extern "C" {
1215
#endif

crates/c-api/tests/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,14 @@ foreach(header IN LISTS cpp_headers)
6868
if(header_extension STREQUAL ".h.in")
6969
continue()
7070
endif()
71-
cmake_path(GET header FILENAME header_filename)
72-
cmake_path(APPEND CMAKE_CURRENT_BINARY_DIR "header-test" "${header_filename}.cc"
73-
OUTPUT_VARIABLE test_filename)
74-
list(APPEND header_tests ${test_filename})
75-
7671
cmake_path(
7772
RELATIVE_PATH header
7873
BASE_DIRECTORY ${header_root}
7974
OUTPUT_VARIABLE rel_header)
75+
cmake_path(APPEND CMAKE_CURRENT_BINARY_DIR "header-test" "${rel_header}.cc"
76+
OUTPUT_VARIABLE test_filename)
77+
list(APPEND header_tests ${test_filename})
78+
8079
file(WRITE ${test_filename} "#include <${rel_header}>")
8180
endforeach()
8281
add_capi_test(standalone-headers FILES ${header_tests})

0 commit comments

Comments
 (0)