From 6d6e2a7920bd9d98f50711f684b51ba527a0e842 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 21:51:55 -0400 Subject: [PATCH] add simple check whether the compiled executable can actually run --- unittest/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index c7f46a7f7b..f5d990d3ed 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -1,5 +1,14 @@ include(GTest) +# check if we can run the compiled executable and whether it prints +# the LAMMPS version header in the output for an empty input +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/in.empty) +add_test(NAME RunLammps + COMMAND $ -log none -echo none -in in.empty + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set_tests_properties(RunLammps PROPERTIES + PASS_REGULAR_EXPRESSION "^LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]\\)") + if(BUILD_MPI) function(add_mpi_test) set(MPI_TEST_NUM_PROCS 1)