diff --git a/core/src/tests/add_new_unit_test.sh b/core/src/tests/add_new_unit_test.sh new file mode 100755 index 00000000000..9233e88271b --- /dev/null +++ b/core/src/tests/add_new_unit_test.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +# create and add an empty unittest file + +if [ "x$1" = "x" ]; then + echo "You should enter: $0 testname" + exit 1 +fi + +if [ -f "$1.cc" ]; then + echo "Filename for test already exists: $1.cc" + exit 1 +fi + +if grep -w "$1.cc" CMakeLists.txt; then + echo "$1.cc already exists in CMakeLists.txt" + exit 1 +fi + +file_created="false" +if cat > "$1.cc" < "$1.cc" <> CMakeLists.txt; then + echo "Adding to CMakeLists.txt failed" + exit 1 +fi + +exit 0 + diff --git a/core/src/tests/test_cmakelists_template.txt.in b/core/src/tests/test_cmakelists_template.txt.in new file mode 100644 index 00000000000..f41d1b8394a --- /dev/null +++ b/core/src/tests/test_cmakelists_template.txt.in @@ -0,0 +1,11 @@ +####### test_@replace@ ##################################### +add_executable(test_@replace@ @replace@.cc) + +target_link_libraries(test_@replace@ + bareos + ${GTEST_LIBRARIES} + ${GTEST_MAIN_LIBRARIES} +) + +gtest_discover_tests(test_@replace@ TEST_PREFIX gtest:) +