commit | d012b32ba19154e93ed7496914508e2087685dfa | [log] [tgz] |
---|---|---|
author | Jan Kundrát <jan.kundrat@cesnet.cz> | Fri Jan 12 18:37:05 2024 +0100 |
committer | Jan Kundrát <jan.kundrat@cesnet.cz> | Fri Jan 12 23:28:18 2024 +0100 |
tree | f19fd43e34b818e7f5f8e141930e842a41c73dd6 | |
parent | 2ec3748047bb82e38a513d0a62542eec2b2d3f8e [diff] [blame] |
cmake: tests: simplify sysrepo fixtures In rousette, we've adapted a much simplified approach for preparing the isolated sysrepo environment. Let's pick it up in this project as well. Change-Id: I2cd1bfaf7b76b834a144886021d20c77954da60c See-also: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/6572 See-also: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/6804 See-also: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/6805 See-also: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/6806 See-also: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/6807 See-also: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/6808 See-also: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/6809
diff --git a/cmake/SysrepoClean.cmake b/cmake/SysrepoClean.cmake new file mode 100644 index 0000000..8edf1b5 --- /dev/null +++ b/cmake/SysrepoClean.cmake
@@ -0,0 +1,14 @@ +foreach(var THIS_BINARY_DIR TEST_NAME SYSREPO_SHM_PREFIX) + if(NOT ${var}) + message(FATAL_ERROR "${var} not specified") + endif() +endforeach() + +set(shm_files_pattern "/dev/shm/${SYSREPO_SHM_PREFIX}*") +file(GLOB shm_files ${shm_files_pattern}) +set(dummy_nonexisting_file_to_silence_warnings ${CMAKE_CURRENT_BUILD_DIR}/sysrepo-dummy-non-existing-file-for-cleanup) + +message(STATUS "Removing ${shm_files_pattern}") +file(REMOVE ${shm_files} ${dummy_nonexisting_file_to_silence_warnings}) +message(STATUS "Removing ${THIS_BINARY_DIR}/test_repositories/test_${TEST_NAME}") +file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/test_repositories/test_${TEST_NAME}")