Skip to content

Commit

Permalink
conf: drop custom esp coverage support in favour of upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
sobuch authored and erhankur committed Dec 20, 2024
1 parent 73f7461 commit 9a1b68a
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .gitlab/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ build_linux_armhf_test:
CONF_HOST: "arm-linux-gnueabihf"
PLATFORM_NAME: "linux-armhf-test"
TEST_CFLAGS: ""
GCOV_BUILD_OPTS: "--enable-build-gcov"
GCOV_BUILD_OPTS: "--enable-gcov"

build_linux_armhf_sanitizer_test:
extends: .build_linux_arm_template
Expand Down Expand Up @@ -231,7 +231,7 @@ build_linux_arm64_test:
CONF_HOST: "aarch64-linux-gnu"
PLATFORM_NAME: "linux-arm64-test"
TEST_CFLAGS: ""
GCOV_BUILD_OPTS: "--enable-build-gcov"
GCOV_BUILD_OPTS: "--enable-gcov"

.build_windows_template: &build_windows_template
stage: build_openocd
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(BUILD_JLINK)
endif()

#TODO can be added to the ADDITIONAL_CLEAN_FILES properties
if(BUILD_GCOV)
if(USE_GCOV)
add_custom_target(gcov-clean
COMMAND ${CMAKE_MAKE_PROGRAM} clean
COMMAND find . -name "*.gcno" -type f -delete
Expand Down
2 changes: 1 addition & 1 deletion cmake/BuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ option(BUILD_REMOTE_BITBANG "Build support for the Remote Bitbang driver" ON)
# Espressif additions
option(BUILD_ESP_REMOTE "Build support for the ESP remote protocol over TCP or USB" ON)
option(BUILD_ESP_COMPRESSION "Build support for the ESP flasher image compression" ON)
option(BUILD_GCOV "Build support for the coverage" OFF)
option(USE_GCOV "Build support for the coverage" OFF)
option(BUILD_SANITIZERS "Build support with the sanitizer flags" OFF)

# USB1 Adapters #TODO check default values
Expand Down
2 changes: 1 addition & 1 deletion cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
#cmakedefine01 BUILD_ESP_GPIO

/* 0 if you don't want OpenOCD source code coverage support */
#cmakedefine01 BUILD_GCOV
#cmakedefine01 USE_GCOV

/* 0 if you don't want MPSSE mode of FTDI based devices */
#cmakedefine01 BUILD_FTDI
Expand Down
4 changes: 2 additions & 2 deletions cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ if(BUILD_ESP_COMPRESSION)
check_include_files(zlib.h HAVE_ZLIB_H)
endif()

if(BUILD_GCOV)
if(USE_GCOV)
# CFLAGS+=" -fprofile-arcs -ftest-coverage"
endif()

Expand Down Expand Up @@ -378,7 +378,7 @@ set(OPENOCD_COMMON_COMPILER_FLAGS

# TODO: add sanitizers and gcov as custom target.
# Check https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake
if(BUILD_GCOV)
if(USE_GCOV)
set(OPENOCD_COMMON_COMPILER_FLAGS ${OPENOCD_COMMON_COMPILER_FLAGS} -fprofile-arcs -ftest-coverage)
SET(CMAKE_EXE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage")
endif()
13 changes: 0 additions & 13 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,6 @@ AC_ARG_ENABLE([esp-compression],
[Disable compression support for the ESP devices]),
[build_esp_compression=$enableval], [build_esp_compression=yes])

AC_ARG_ENABLE([build-gcov],
AS_HELP_STRING([--enable-build-gcov],
[Enable building support with coverage]),
[build_gcov=$enableval], [build_gcov=no])

AC_ARG_ENABLE([remote-bitbang],
AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang driver]),
[build_remote_bitbang=$enableval], [build_remote_bitbang=no])
Expand Down Expand Up @@ -665,13 +660,6 @@ AS_IF([test "x$build_esp_compression" = "xyes"], [
AC_DEFINE([BUILD_ESP_COMPRESSION], [0], [0 if you don't want ESP compression support.])
])

AS_IF([test "x$build_gcov" = "xyes"], [
AC_DEFINE([BUILD_GCOV], [1], [1 if you want OpenOCD source code coverage support.])
CFLAGS+=" -fprofile-arcs -ftest-coverage"
], [
AC_DEFINE([BUILD_GCOV], [0], [0 if you don't want OpenOCD source code coverage support.])
])

PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
use_libusb1=yes
AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
Expand Down Expand Up @@ -843,7 +831,6 @@ AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"
AM_CONDITIONAL([BUILD_ESP_REMOTE], [test "x$build_esp_remote" = "xyes"])
AM_CONDITIONAL([BUILD_ESP_COMPRESSION], [test "x$build_esp_compression" = "xyes"])

AM_CONDITIONAL([BUILD_GCOV], [test "x$build_gcov" = "xyes"])
AM_CONDITIONAL([USE_GCOV], [test "x$enable_gcov" = "xyes"])

# Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
Expand Down
5 changes: 0 additions & 5 deletions src/openocd.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,8 @@ int openocd_main(int argc, char *argv[])

if (ret == ERROR_FAIL)
return EXIT_FAILURE;
#if !BUILD_GCOV
/* We want openocd to exit normally in order to
generate coverage and profiling data. Killing openocd with
signals prevents data generation */
else if (ret != ERROR_OK)
exit_on_signal(ret);
#endif

return ret;
}

0 comments on commit 9a1b68a

Please sign in to comment.