From b76dfc8247893c40fd55e9e134e796fabb39ee6d Mon Sep 17 00:00:00 2001 From: cmuhammedrafi Date: Wed, 28 Aug 2024 09:51:43 +0530 Subject: [PATCH] test code --- l1networkmanager.cmake | 83 ++++++++++-------------------------------- 1 file changed, 20 insertions(+), 63 deletions(-) diff --git a/l1networkmanager.cmake b/l1networkmanager.cmake index 9d38a9d1..4466647a 100644 --- a/l1networkmanager.cmake +++ b/l1networkmanager.cmake @@ -1,93 +1,50 @@ -message("Starting the build process for unit tests...") +message("Building for unit tests...") -# Print the value of CMAKE_CURRENT_SOURCE_DIR -message("CMAKE_CURRENT_SOURCE_DIR is set to: ${CMAKE_CURRENT_SOURCE_DIR}") - -# Generating empty headers to suppress compiler errors -message("Generating empty headers to suppress compiler errors...") -set(BASEDIR "${CMAKE_CURRENT_SOURCE_DIR}/headers") -message("BASEDIR is set to: ${BASEDIR}") +message("Generating empty headers to suppress compiler errors") +file(GLOB BASEDIR Tests) +set(BASEDIR ${BASEDIR}/headers) set(EMPTY_HEADERS_DIRS - ${BASEDIR} - ${BASEDIR}/rdk/iarmbus - ${BASEDIR}/network -) -message("Empty header directories are set to: ${EMPTY_HEADERS_DIRS}") + ${BASEDIR} + ${BASEDIR}/rdk/iarmbus + ${BASEDIR}/network + ) set(EMPTY_HEADERS - ${BASEDIR}/rdk/iarmbus/libIARM.h - ${BASEDIR}/rdk/iarmbus/libIBus.h - ${BASEDIR}/rdk/iarmbus/libIBusDaemon.h - ${BASEDIR}/network/wifiSrvMgrIarmIf.h - ${BASEDIR}/network/netsrvmgrIarm.h -) -message("Empty headers are set to: ${EMPTY_HEADERS}") + ${BASEDIR}/rdk/iarmbus/libIARM.h + ${BASEDIR}/rdk/iarmbus/libIBus.h + ${BASEDIR}/rdk/iarmbus/libIBusDaemon.h + ${BASEDIR}/network/wifiSrvMgrIarmIf.h + ${BASEDIR}/network/netsrvmgrIarm.h + ) -# Create directories for the empty headers -message("Creating directories for empty headers if they do not exist...") file(MAKE_DIRECTORY ${EMPTY_HEADERS_DIRS}) -# Check if any empty headers already exist file(GLOB_RECURSE EMPTY_HEADERS_AVAILABLE "${BASEDIR}/*") if (EMPTY_HEADERS_AVAILABLE) - message("Found existing empty headers. Skipping already generated headers to avoid rebuild:") - foreach (header ${EMPTY_HEADERS_AVAILABLE}) - message(" - ${header}") - endforeach () + message("Skip already generated headers to avoid rebuild") list(REMOVE_ITEM EMPTY_HEADERS ${EMPTY_HEADERS_AVAILABLE}) -else () - message("No existing empty headers found. Proceeding to generate new ones...") endif () - -# Generate empty headers if they do not exist if (EMPTY_HEADERS) file(TOUCH ${EMPTY_HEADERS}) - message("Generated the following empty headers:") - foreach (header ${EMPTY_HEADERS}) - message(" - ${header}") - endforeach () -else () - message("No new empty headers were generated.") endif () -# Include directories -message("Including directories: ${EMPTY_HEADERS_DIRS}") include_directories(${EMPTY_HEADERS_DIRS}) -# Adding compiler and linker options for all targets -message("Adding compiler and linker options for all targets...") - -set(MOCK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Test/mocks") -message("MOCK_DIR is set to: ${MOCK_DIR}") +message("Adding compiler and linker options for all targets") +file(GLOB BASEDIR Tests/mocks) set(FAKE_HEADERS - ${MOCK_DIR}/Iarm.h -) -message("Fake headers to include are set to: ${FAKE_HEADERS}") + ${BASEDIR}/Iarm.h + ) foreach (file ${FAKE_HEADERS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${file}") - message("Added include for: ${file}") endforeach () -# Add compile options -message("Adding compile options -Wall and -Werror...") add_compile_options(-Wall -Werror) -# Add link options -message("Adding link options for wrapped functions...") add_link_options(-Wl,-wrap,system -Wl,-wrap,popen -Wl,-wrap,syslog -Wl,-wrap,pclose -Wl,-wrap,getmntent -Wl,-wrap,setmntent -Wl,-wrap,v_secure_popen -Wl,-wrap,v_secure_pclose -Wl,-wrap,v_secure_system) -# Display all files available in the Test folder -message("Displaying all files available in the Test folder:") -file(GLOB_RECURSE TEST_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Test/*") -foreach (test_file ${TEST_FILES}) - message(" - ${test_file}") -endforeach () - -# Setting build options -message("Setting build option to disable IARMBus package finding...") +message("Setting build options") set(CMAKE_DISABLE_FIND_PACKAGE_IARMBus ON) - -message("Build configuration complete.")