From cd9f19055b325eb931fa9778a4087bbfdff1bae0 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Sun, 4 Oct 2026 20:43:23 +0100 Subject: [PATCH] CI: Add in sanitizer runs for 32 and 64 bits --- .github/workflows/main.yml | 43 ++++++++++++++++++++++++++++++++++++++ configure.ac | 20 +++++++++--------- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11a2a147..0e9b729e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -108,6 +108,7 @@ jobs: west sdk install --install-base=zephyrproject/../ -t x86_64-zephyr-elf cd ../../ deactivate + pre-commit: runs-on: ubuntu-latest steps: @@ -116,6 +117,7 @@ jobs: with: python-version: 3.x - uses: pre-commit/action@v3.0.1 + scan-build: runs-on: ubuntu-latest steps: @@ -128,6 +130,7 @@ jobs: run: | ./configure --disable-documentation --disable-doxygen --disable-man --enable-examples --enable-tests --disable-dtls scan-build --status-bugs make V=0 + check-missing-updates: runs-on: ubuntu-latest steps: @@ -142,6 +145,7 @@ jobs: - name: check run: | scripts/check-missing-updates.sh + build-linux: needs: do-caches runs-on: ubuntu-latest @@ -188,6 +192,7 @@ jobs: cd build-${{matrix.TLS}}-${{matrix.CC}} libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression tests/testdriver examples/coap-server -? 2>&1 | head -10 + build-linux2: needs: do-caches runs-on: ubuntu-latest @@ -235,6 +240,34 @@ jobs: cd build-${{matrix.TLS}}-${{matrix.CC}}-${{matrix.OSCORE_ONLY}} libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression tests/testdriver examples/coap-server -? 2>&1 | head -10 + + build-linux-sanitizer: + runs-on: ubuntu-latest + strategy: + matrix: + BITS: ["32", "64" ] + steps: + - uses: actions/checkout@v6 + - name: setup + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags build-essential libc6-dev-i386 libcunit1-dev:i386 + ./autogen.sh + - name: configure-32 + if: matrix.BITS == '32' + run: | + $GITHUB_WORKSPACE/configure --disable-silent-rules --disable-documentation --enable-examples --enable-tests --disable-dtls --enable-sanitizer --build=i386 + - name: configure-64 + if: matrix.BITS == '64' + run: | + $GITHUB_WORKSPACE/configure --disable-silent-rules --disable-documentation --enable-examples --enable-tests --disable-dtls --enable-sanitizer + - name: compile + run: | + make EXTRA_CFLAGS=-Werror + - name: tests + run: | + tests/testdriver + tinydtls-build: runs-on: ubuntu-latest steps: @@ -254,6 +287,7 @@ jobs: - name: test run: | LD_LIBRARY_PATH=ext/tinydtls libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression tests/testdriver + cmake-build: needs: do-caches runs-on: ubuntu-latest @@ -299,6 +333,7 @@ jobs: cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-cmake valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression ./testdriver ./coap-server -? 2>&1 | head -10 + cmake-build2: needs: do-caches runs-on: ubuntu-latest @@ -345,6 +380,7 @@ jobs: cd $GITHUB_WORKSPACE/build-${{matrix.TLS}}-${{matrix.OSCORE_ONLY}}-cmake valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression ./testdriver ./coap-server -? 2>&1 | head -10 + cmake-macos: runs-on: macos-latest @@ -361,6 +397,7 @@ jobs: run: | cd build_test cmake --build . + contiki-build-macos: runs-on: macos-latest @@ -373,6 +410,7 @@ jobs: - name: compile run: | gmake -C examples/contiki + other-build: needs: do-caches runs-on: ubuntu-latest @@ -430,6 +468,7 @@ jobs: - name: compile run: | make -C examples/${{matrix.OS}} EXTRA_CFLAGS=-Werror + ms-build: runs-on: windows-latest @@ -446,6 +485,7 @@ jobs: - name: Build sln shell: cmd run: call .\scripts\msbuild.sln.cmd + ms-cmake: runs-on: windows-latest steps: @@ -466,6 +506,7 @@ jobs: run: | cd build_test cmake --build . + mingw-cmake: runs-on: windows-latest strategy: @@ -544,6 +585,7 @@ jobs: - name: installation check run: | make install && ls -lR $GITHUB_WORKSPACE/test-install + distribution-tarball: needs: do-caches runs-on: ubuntu-latest @@ -571,6 +613,7 @@ jobs: cd build-dist make dist cp -f libcoap-*.tar.bz2 ${{ runner.temp }} + distribution-builds: needs: distribution-tarball runs-on: ubuntu-latest diff --git a/configure.ac b/configure.ac index 79c69758..962a8e66 100644 --- a/configure.ac +++ b/configure.ac @@ -1027,16 +1027,16 @@ if test "x$build_gcov" = "xyes"; then fi # configure options -# __sanitize__ -AC_ARG_ENABLE([sanitize], - [AS_HELP_STRING([--enable-sanitize], +# __sanitizer__ +AC_ARG_ENABLE([sanitizer], + [AS_HELP_STRING([--enable-sanitizer], [Enable building with sanitize=address,undefined coverage support [default=no]])], - [build_sanitize="$enableval"], - [build_sanitize="no"]) + [build_sanitizer="$enableval"], + [build_sanitizer="no"]) SAN_CFLAGS= SAN_LIBS= -if test "x$build_sanitize" = "xyes"; then +if test "x$build_sanitizer" = "xyes"; then AX_CHECK_COMPILE_FLAG([-fsanitize=address,undefined], [SAN_CFLAGS="-fsanitize=address,undefined"]) SAN_LIBS="$SAN_CFLAGS" AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer], [SAN_CFLAGS="$SAN_CFLAGS -fno-omit-frame-pointer"]) @@ -1383,7 +1383,7 @@ AC_MSG_CHECKING([operating system]) # The "ADDITIONAL_CFLAGS" is needed as this is a stand-alone definition # for the doxygen part. case $host in - i386-pc-none) + *386-pc-none) AC_MSG_RESULT([Linux 32bit]) ADDITIONAL_CFLAGS="-D_GNU_SOURCE -m32" LIBCOAP_NAME_SUFFIX=$LIBCOAP_NAME_SUFFIX-32 @@ -1745,10 +1745,10 @@ if test "x$enable_static" = "xyes"; then else AC_MSG_RESULT([ build static library : "no"]) fi -if test "x$enable_sanitize" = "xyes"; then - AC_MSG_RESULT([ build with sanitize : "yes"]) +if test "x$enable_sanitizer" = "xyes"; then + AC_MSG_RESULT([ build with sanitizer : "yes"]) else - AC_MSG_RESULT([ build with sanitize : "no"]) + AC_MSG_RESULT([ build with sanitizer : "no"]) fi mkdir -p include/coap$LIBCOAP_API_VERSION