From 30a14eff5a3c5684c20286e3ac8d43ae21698504 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 1 Feb 2021 01:55:08 -0800 Subject: [PATCH] Re-enable ign tests, fix test cmd file Signed-off-by: Steve Peters --- src/cmd/CMakeLists.txt | 34 ++++++++++++++++++++++++++-------- src/cmd/cmdtransport.rb.in | 2 -- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 6ada5eb92..74d4beb0b 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -1,15 +1,35 @@ -add_executable( - transport +# Collect source files into the "sources" variable and unit test files into the +# "gtest_sources" variable. +ign_get_libsources_and_unittests(sources gtest_sources) + +set(executable transport) +add_executable(${executable} transport_main.cc ign.cc ) -target_link_libraries(transport +target_link_libraries(${executable} ignition-utils${IGN_UTILS_VER}::cli ${PROJECT_LIBRARY_TARGET_NAME} ) -install(TARGETS transport DESTINATION lib/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/) +install(TARGETS ${executable} DESTINATION lib/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/) + +# Build the unit tests. +ign_build_tests(TYPE UNIT SOURCES ${gtest_sources} + TEST_LIST test_list + LIB_DEPS ${EXTRA_TEST_LIB_DEPS}) + +foreach(test ${test_list}) + + # 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. + target_compile_definitions(${test} PRIVATE + "DETAIL_IGN_TRANSPORT_TEST_DIR=\"$\"" + "IGN_TEST_LIBRARY_PATH=\"$\"") + +endforeach() #=============================================================================== # Generate the ruby script for internal testing. @@ -20,7 +40,7 @@ set(cmd_script_configured_test "${cmd_script_generated_test}.configured") # Set the library_location variable to the full path of the library file within # the build directory. -set(library_location "$") +set(exe_location "$") configure_file( "cmd${IGN_DESIGNATION}.rb.in" @@ -42,9 +62,7 @@ set(cmd_script_configured "${cmd_script_generated}.configured") # Set the library_location variable to the relative path to the library file # within the install directory structure. -set(exe_location "../../../${CMAKE_INSTALL_LIBDIR}/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/$") - -message(STATUS ${exe_location}) +set(exe_location "../../../${CMAKE_INSTALL_LIBDIR}/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/$") configure_file( "cmd${IGN_DESIGNATION}.rb.in" diff --git a/src/cmd/cmdtransport.rb.in b/src/cmd/cmdtransport.rb.in index a1ba4b622..c0670d7d1 100644 --- a/src/cmd/cmdtransport.rb.in +++ b/src/cmd/cmdtransport.rb.in @@ -48,8 +48,6 @@ class Cmd end args = args.join(' ') - puts "#{args}" - puts `#{exe_name} #{args}` end end