diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindProtobuf/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/FindProtobuf/Test/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/FindProtobuf/Test/main-generate-grpc.cxx | 6 | ||||
-rw-r--r-- | Tests/FindProtobuf/Test/msgs/example_service.proto | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/ExternalProject/FetchGitRefs.cmake (renamed from Tests/RunCMake/ExternalProject/FetchGitTags.cmake) | 21 | ||||
-rw-r--r-- | Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt (renamed from Tests/RunCMake/ExternalProject/FetchGitTags/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/ExternalProject/RunCMakeTest.cmake | 2 |
12 files changed, 54 insertions, 9 deletions
diff --git a/Tests/FindProtobuf/CMakeLists.txt b/Tests/FindProtobuf/CMakeLists.txt index 1cdb2ae..b4ca29b 100644 --- a/Tests/FindProtobuf/CMakeLists.txt +++ b/Tests/FindProtobuf/CMakeLists.txt @@ -6,5 +6,6 @@ add_test(NAME FindProtobuf.Test COMMAND ${build_generator_args} --build-project TestFindProtobuf --build-options ${build_options} + "-DCMake_TEST_FindProtobuf_gRPC=${CMake_TEST_FindProtobuf_gRPC}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) diff --git a/Tests/FindProtobuf/Test/CMakeLists.txt b/Tests/FindProtobuf/Test/CMakeLists.txt index fc6b37e..84041ea 100644 --- a/Tests/FindProtobuf/Test/CMakeLists.txt +++ b/Tests/FindProtobuf/Test/CMakeLists.txt @@ -52,3 +52,16 @@ target_include_directories(test_desc PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(test_desc msgs ${Protobuf_LIBRARIES}) target_compile_features(test_desc PRIVATE cxx_std_11) add_test(NAME test_desc COMMAND test_desc ${DESC_PROTO_DESC}) + +if(CMake_TEST_FindProtobuf_gRPC) + find_program(gRPC_CPP_PLUGIN grpc_cpp_plugin) + add_library(msgs_grpc msgs/example_service.proto) + target_include_directories(msgs_grpc PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(msgs_grpc PUBLIC ${Protobuf_LIBRARIES}) + protobuf_generate(TARGET msgs_grpc LANGUAGE cpp) + protobuf_generate(TARGET msgs_grpc LANGUAGE grpc GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc PLUGIN "protoc-gen-grpc=${gRPC_CPP_PLUGIN}") + + add_executable(test_generate_grpc main-generate-grpc.cxx) + target_link_libraries(test_generate_grpc PRIVATE msgs_grpc) + add_test(NAME test_generate_grpc COMMAND test_generate_grpc) +endif() diff --git a/Tests/FindProtobuf/Test/main-generate-grpc.cxx b/Tests/FindProtobuf/Test/main-generate-grpc.cxx new file mode 100644 index 0000000..070c6b4 --- /dev/null +++ b/Tests/FindProtobuf/Test/main-generate-grpc.cxx @@ -0,0 +1,6 @@ +#include <msgs/example_service.grpc.pb.h> + +int main() +{ + return 0; +} diff --git a/Tests/FindProtobuf/Test/msgs/example_service.proto b/Tests/FindProtobuf/Test/msgs/example_service.proto new file mode 100644 index 0000000..f35eeb5 --- /dev/null +++ b/Tests/FindProtobuf/Test/msgs/example_service.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package example.msgs; + +import "google/protobuf/empty.proto"; + +service ExampleService { + rpc nothing(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt index 21e60ee..63a10d8 100644 --- a/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt @@ -1 +1 @@ -^CMake Error: failed to create link .* no such file or directory +^CMake Error: failed to create link '[^']+': [A-Za-z] diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake index 5b97aec..d92554a 100644 --- a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake @@ -1,3 +1,3 @@ -if(${actual_stderr_var} MATCHES "operation not permitted") +if(${actual_stderr_var} MATCHES "A required privilege is not held by the client") unset(msg) endif() diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake index 5df5f2f..43573bf 100644 --- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake +++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake @@ -1,4 +1,4 @@ -if(${actual_stderr_var} MATCHES "operation not permitted") +if(${actual_stderr_var} MATCHES "A required privilege is not held by the client") unset(msg) else() if(NOT IS_SYMLINK ${RunCMake_TEST_BINARY_DIR}/L) diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake index d37df01..639c223 100644 --- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake +++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake @@ -1,4 +1,4 @@ -if(${actual_stderr_var} MATCHES "operation not permitted") +if(${actual_stderr_var} MATCHES "A required privilege is not held by the client") unset(msg) else() if(NOT IS_DIRECTORY ${RunCMake_TEST_BINARY_DIR}/L) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 78c3508..a1edbd0 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -359,7 +359,7 @@ run_cmake_command(E_create_symlink-missing-dir # These tests are special on Windows since it will only fail if the user # running the test does not have the priveldge to create symlinks. If this # happens we clear the msg in the -check.cmake and say that the test passes -set(RunCMake_DEFAULT_stderr "(operation not permitted)?") +set(RunCMake_DEFAULT_stderr "(A required privilege is not held by the client)?") set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build) set(RunCMake_TEST_NO_CLEAN 1) @@ -403,7 +403,7 @@ run_cmake_command(E_create_hardlink-no-directory #On Windows, if the user does not have sufficient privileges #don't fail this test -set(RunCMake_DEFAULT_stderr "(operation not permitted)?") +set(RunCMake_DEFAULT_stderr "(A required privilege is not held by the client)?") run_cmake_command(E_create_hardlink-unresolved-symlink-prereq ${CMAKE_COMMAND} -E create_symlink ${dir}/1 ${dir}/1-symlink ) diff --git a/Tests/RunCMake/ExternalProject/FetchGitTags.cmake b/Tests/RunCMake/ExternalProject/FetchGitRefs.cmake index 37d1b40..a00908b 100644 --- a/Tests/RunCMake/ExternalProject/FetchGitTags.cmake +++ b/Tests/RunCMake/ExternalProject/FetchGitRefs.cmake @@ -11,7 +11,7 @@ file(MAKE_DIRECTORY ${srcDir}) file(GLOB entries ${srcRepo}/*) file(REMOVE_RECURSE ${entries} ${binDir}) file(TOUCH ${srcRepo}/firstFile.txt) -configure_file(${CMAKE_CURRENT_LIST_DIR}/FetchGitTags/CMakeLists.txt +configure_file(${CMAKE_CURRENT_LIST_DIR}/FetchGitRefs/CMakeLists.txt ${srcDir}/CMakeLists.txt COPYONLY) function(execGitCommand) @@ -63,5 +63,22 @@ execGitCommand(commit -m "Second file") execGitCommand(tag -a -m "Adding tag" tag_of_interest) execGitCommand(reset --hard HEAD~1) -message(STATUS "Second configure-and-build") +message(STATUS "Configure-and-build, update to tag") configureAndBuild(tag_of_interest) + +# Do the same, but this time for a commit hash +file(TOUCH ${srcRepo}/thirdFile.txt) +execGitCommand(add thirdFile.txt) +execGitCommand(commit -m "Third file") +execGitCommand(tag -a -m "Adding another tag" check_for_hash) +execGitCommand(reset --hard HEAD~1) +execute_process( + WORKING_DIRECTORY ${srcRepo} + COMMAND ${GIT_EXECUTABLE} rev-parse check_for_hash + COMMAND_ERROR_IS_FATAL ANY + OUTPUT_VARIABLE commit_hash + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +message(STATUS "Configure-and-build, update to commit hash ${commit_hash}") +configureAndBuild(${commit_hash}) diff --git a/Tests/RunCMake/ExternalProject/FetchGitTags/CMakeLists.txt b/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt index d9a380c..d9a380c 100644 --- a/Tests/RunCMake/ExternalProject/FetchGitTags/CMakeLists.txt +++ b/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 3205dd5..a4244e3 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -185,6 +185,6 @@ if(GIT_EXECUTABLE) # Note that there appear to be differences in where git writes its output to # on some platforms. It may go to stdout or stderr, so force it to be merged. set(RunCMake_TEST_OUTPUT_MERGE TRUE) - run_cmake(FetchGitTags) + run_cmake(FetchGitRefs) set(RunCMake_TEST_OUTPUT_MERGE FALSE) endif() |