diff -r 560a60fcf6ee -r d53be93acc10 tests/Makefile --- a/tests/Makefile Sun May 24 12:18:44 2026 +0200 +++ b/tests/Makefile Wed Aug 26 16:03:54 2026 +0200 @@ -40,11 +40,16 @@ OBJ_EXT=.o OBJ=$(SRC:%.c=$(TEST_DIR)/%$(OBJ_EXT)) -all: $(TEST_DIR) $(TEST_DIR)/ucxtest +all: $(TEST_DIR) $(TEST_DIR)/ucxtest $(TEST_DIR)/test_header_only$(OBJ_EXT) $(TEST_DIR)/ucxtest: $(OBJ) $(build_dir)/libucx_static.a $(CC) -o $@ $(LDFLAGS) $+ +# tests that the test.h can be used header-only +$(TEST_DIR)/test_header_only$(OBJ_EXT): ../src/cx/test.h + @echo "Checking if test.h is standalone" + $(CC) -o "$@" -c test_header_only.c + $(build_dir)/libucx_static.a: test -f "$@" @@ -54,29 +59,29 @@ FORCE: $(TEST_DIR)/test_allocator$(OBJ_EXT): test_allocator.c ../src/cx/test.h \ - ../src/cx/common.h ../src/cx/allocator.h + ../src/cx/allocator.h ../src/cx/common.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_buffer$(OBJ_EXT): test_buffer.c ../src/cx/test.h \ - ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ + util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \ ../src/cx/buffer.h ../src/cx/allocator.h ../src/cx/string.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_compare$(OBJ_EXT): test_compare.c ../src/cx/test.h \ - ../src/cx/common.h ../src/cx/compare.h + ../src/cx/compare.h ../src/cx/common.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_hash_key$(OBJ_EXT): test_hash_key.c ../src/cx/test.h \ - ../src/cx/common.h ../src/cx/hash_key.h ../src/cx/string.h \ + ../src/cx/hash_key.h ../src/cx/common.h ../src/cx/string.h \ ../src/cx/allocator.h ../src/cx/string.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_hash_map$(OBJ_EXT): test_hash_map.c ../src/cx/test.h \ - ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ + util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \ ../src/cx/array_list.h ../src/cx/list.h ../src/cx/collection.h \ ../src/cx/allocator.h ../src/cx/iterator.h ../src/cx/compare.h \ ../src/cx/list.h ../src/cx/hash_map.h ../src/cx/map.h ../src/cx/string.h \ @@ -85,7 +90,7 @@ $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_iterator$(OBJ_EXT): test_iterator.c ../src/cx/test.h \ - ../src/cx/common.h ../src/cx/iterator.h + ../src/cx/iterator.h ../src/cx/common.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $< @@ -99,7 +104,7 @@ $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_kv_list$(OBJ_EXT): test_kv_list.c ../src/cx/test.h \ - ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ + util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \ ../src/cx/kv_list.h ../src/cx/list.h ../src/cx/collection.h \ ../src/cx/allocator.h ../src/cx/iterator.h ../src/cx/compare.h \ ../src/cx/map.h ../src/cx/string.h ../src/cx/hash_key.h @@ -107,7 +112,7 @@ $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_list$(OBJ_EXT): test_list.c ../src/cx/test.h \ - ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ + util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \ ../src/cx/compare.h ../src/cx/array_list.h ../src/cx/list.h \ ../src/cx/collection.h ../src/cx/allocator.h ../src/cx/iterator.h \ ../src/cx/compare.h ../src/cx/linked_list.h ../src/cx/kv_list.h \ @@ -116,19 +121,19 @@ $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_mempool$(OBJ_EXT): test_mempool.c ../src/cx/test.h \ - ../src/cx/common.h ../src/cx/mempool.h ../src/cx/allocator.h + ../src/cx/mempool.h ../src/cx/common.h ../src/cx/allocator.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_printf$(OBJ_EXT): test_printf.c ../src/cx/test.h \ - ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ + util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \ ../src/cx/printf.h ../src/cx/string.h ../src/cx/allocator.h \ ../src/cx/buffer.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_properties$(OBJ_EXT): test_properties.c ../src/cx/test.h \ - ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ + util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \ ../src/cx/properties.h ../src/cx/string.h ../src/cx/allocator.h \ ../src/cx/map.h ../src/cx/collection.h ../src/cx/iterator.h \ ../src/cx/compare.h ../src/cx/hash_key.h ../src/cx/buffer.h \ @@ -137,13 +142,13 @@ $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_streams$(OBJ_EXT): test_streams.c ../src/cx/test.h \ - ../src/cx/common.h ../src/cx/streams.h ../src/cx/buffer.h \ + ../src/cx/streams.h ../src/cx/common.h ../src/cx/buffer.h \ ../src/cx/allocator.h ../src/cx/string.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $< $(TEST_DIR)/test_string$(OBJ_EXT): test_string.c ../src/cx/test.h \ - ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ + util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \ ../src/cx/string.h ../src/cx/allocator.h ../src/cx/compare.h @echo "Compiling $<" $(CC) -o $@ $(CFLAGS) -I../src -c $<