From 0bd03b658ed2d75fdb7cb8f6add201b39b428298 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Thu, 11 Sep 2025 19:58:50 +0100 Subject: [PATCH] cmake: Remove the need to configure tests/test_common.h --- .gitignore | 1 - CMakeLists.txt | 3 --- Makefile.am | 1 + autogen.sh | 2 +- configure.ac | 1 - scripts/github_dist.sh | 14 +++++++++++++- tests/{test_common.h.in => test_common.h} | 2 +- 7 files changed, 16 insertions(+), 8 deletions(-) rename tests/{test_common.h.in => test_common.h} (81%) diff --git a/.gitignore b/.gitignore index 623f4ee9..78ddde9c 100644 --- a/.gitignore +++ b/.gitignore @@ -101,7 +101,6 @@ tests/Makefile tests/oss-fuzz/Makefile.ci tests/testdriver tests/*.o -tests/test_common.h # the cmake/ folder cmake/libcoap diff --git a/CMakeLists.txt b/CMakeLists.txt index 92962d7e..ecf33c6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -763,9 +763,6 @@ configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake_coap_config.h.in configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake_coap_defines.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_defines.h) -configure_file(${CMAKE_CURRENT_LIST_DIR}/tests/test_common.h.in - ${CMAKE_CURRENT_LIST_DIR}/tests/test_common.h) - # # sources # diff --git a/Makefile.am b/Makefile.am index 24c1d22b..9c918ea1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -133,6 +133,7 @@ EXTRA_DIST = \ src/coap_io_contiki.c \ src/coap_io_lwip.c \ src/coap_io_riot.c \ + tests/test_common.h \ tests/test_error_response.h \ tests/test_encode.h \ tests/test_options.h \ diff --git a/autogen.sh b/autogen.sh index 036bc845..9a3a2756 100755 --- a/autogen.sh +++ b/autogen.sh @@ -33,7 +33,7 @@ man/coap*.[357] man/coap*.txt man/Makefile man/Makefile.in missing Makefile Makefile.in stamp-h1 src/.dirstamp libcoap*.la* src/*.*o -tests/*.o tests/Makefile tests/Makefile.in tests/testdriver tests/test_common.h +tests/*.o tests/Makefile tests/Makefile.in tests/testdriver tests/oss-fuzz/Makefile.ci m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 " diff --git a/configure.ac b/configure.ac index 6360442e..b93e9a88 100644 --- a/configure.ac +++ b/configure.ac @@ -1382,7 +1382,6 @@ man/coap-rd.txt man/coap-tls-engine-conf.txt man/Makefile scripts/fix_version.sh -tests/test_common.h tests/Makefile tests/oss-fuzz/Makefile.ci libcoap-$LIBCOAP_NAME_SUFFIX.pc:libcoap-$LIBCOAP_API_VERSION.pc.in diff --git a/scripts/github_dist.sh b/scripts/github_dist.sh index dbefbfed..ade2962e 100755 --- a/scripts/github_dist.sh +++ b/scripts/github_dist.sh @@ -16,7 +16,10 @@ echo $ARCHIVE if test $err = 0 -a "x$ARCHIVE" != "x"; then DIR=`pwd`/`tar taf $ARCHIVE |cut -d/ -f1|head -1` tar xaf $ARCHIVE && cd $DIR - err=$terr + terr=$? + if [ $err = 0 ] ; then + err=$terr + fi # LwIP make -C $DIR/examples/lwip EXTRA_CFLAGS=-Werror @@ -46,6 +49,15 @@ if test $err = 0 -a "x$ARCHIVE" != "x"; then if [ $err = 0 ] ; then err=$terr fi + + # cmake + cmake -E make_directory test-cmake + cd test-cmake + cmake .. -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DENABLE_DTLS=OFF -DENABLE_DOCS=OFF -DWARNING_TO_ERROR=ON + terr=$? + if [ $err = 0 ] ; then + err=$terr + fi fi exit $err diff --git a/tests/test_common.h.in b/tests/test_common.h similarity index 81% rename from tests/test_common.h.in rename to tests/test_common.h index a362db24..39fcbd7d 100644 --- a/tests/test_common.h.in +++ b/tests/test_common.h @@ -8,4 +8,4 @@ * README for terms of use. */ -#include "coap@LIBCOAP_API_VERSION@/coap_internal.h" +#include "coap3/coap_internal.h"