Skip to content

Commit

Permalink
Fix test config generation
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Dec 7, 2023
1 parent 2078bdc commit 9170736
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion log/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif()
gz_build_tests(
TYPE "UNIT"
SOURCES ${gtest_sources}
LIB_DEPS ${log_lib_target} ${EXTRA_TEST_LIB_DEPS}
LIB_DEPS ${log_lib_target} ${EXTRA_TEST_LIB_DEPS} test_config
TEST_LIST logging_tests
)

Expand Down
10 changes: 0 additions & 10 deletions log/src/Log_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,7 @@ TEST(Log, NullDescriptorUnopenedLog)
TEST(Log, OpenCorruptDatabase)
{
log::Log logFile;
<<<<<<< HEAD
std::string path =
testing::portablePathUnion(GZ_TRANSPORT_LOG_TEST_PATH, "data");
path = testing::portablePathUnion(path, "state.tlog");

std::cout << path << std::endl;

logFile.Open(path);
=======
logFile.Open(kCorruptDbTestPath);
>>>>>>> gz-transport12
EXPECT_GT(logFile.EndTime(), 0ns) << "logFile.EndTime() == "
<< logFile.EndTime().count() << "ns";;
}
1 change: 1 addition & 0 deletions log/test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ gz_build_tests(
ChirpParams
${PROJECT_LIBRARY_TARGET_NAME}-log
${EXTRA_TEST_LIB_DEPS}
test_config
INCLUDE_DIRS
${CMAKE_BINARY_DIR}/test/
)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif()
# Build the unit tests.
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}
TEST_LIST test_list
LIB_DEPS ${EXTRA_TEST_LIB_DEPS})
LIB_DEPS ${EXTRA_TEST_LIB_DEPS} test_config)

foreach(test ${test_list})

Expand Down
1 change: 1 addition & 0 deletions src/Node_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <thread>

#include "gz/transport/MessageInfo.hh"
#include "gz/transport/Node.hh"
#include "gz/transport/TransportTypes.hh"

#include <gz/utils/Environment.hh>
Expand Down
7 changes: 4 additions & 3 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ install(TARGETS ${service_executable} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/gz
# Build the unit tests.
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}
TEST_LIST test_list
LIB_DEPS ${EXTRA_TEST_LIB_DEPS})
LIB_DEPS
gz
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
${EXTRA_TEST_LIB_DEPS} test_config)

foreach(test ${test_list})
target_link_libraries(${test} gz gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER})

# Inform each test of its output directory so it knows where to call the
# auxiliary files from. Using a generator expression here is useful for
# multi-configuration generators, like Visual Studio.
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "gtest/gtest.h"
#include "gz/transport/Node.hh"

#include "test_config.hh"

using namespace gz;

static std::string g_partition; // NOLINT(*)
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/gz_src_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <gz/utils/Environment.hh>

#include "test_utils.hh"

using namespace gz;

// Global constants.
Expand Down
12 changes: 7 additions & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
configure_file (test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh)
include_directories (
${PROJECT_BINARY_DIR}/include
)

add_subdirectory(gtest_vendor)
add_subdirectory(integration)
add_subdirectory(performance)
add_subdirectory(regression)

configure_file (test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh)
add_library(test_config INTERFACE)
target_include_directories(test_config INTERFACE
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/test
)
3 changes: 2 additions & 1 deletion test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif()

gz_build_tests(TYPE INTEGRATION SOURCES ${tests}
TEST_LIST test_list
LIB_DEPS ${EXTRA_TEST_LIB_DEPS})
LIB_DEPS ${EXTRA_TEST_LIB_DEPS} test_config)

set(auxiliary_files
authPubSubSubscriberInvalid_aux
Expand Down Expand Up @@ -54,6 +54,7 @@ foreach(AUX_EXECUTABLE ${auxiliary_files})
${PROJECT_LIBRARY_TARGET_NAME}
gtest
${EXTRA_TEST_LIB_DEPS}
test_config
)
endforeach(AUX_EXECUTABLE)

Expand Down
2 changes: 2 additions & 0 deletions test/test_config.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
#define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf"
#define GZ_VERSION_FULL "@PROJECT_VERSION_FULL@"

#include "test_utils.hh"

#endif // GZ_TRANSPORT_TEST_CONFIG_HH_

0 comments on commit 9170736

Please sign in to comment.