cmake: add custom targets docker-run-${DOCKER_INDEX}

This commit is contained in:
Ryo Nakamura
2025-08-12 14:45:10 +09:00
parent a0153414f6
commit ecee66d03f
2 changed files with 18 additions and 2 deletions

View File

@@ -208,6 +208,16 @@ foreach(x RANGE ${DIST_LISTLEN})
--add-host=ip6-localhost:::1
${DOCKER_IMAGE} /mscp/scripts/test-in-container.sh)
add_custom_target(docker-run-${DOCKER_INDEX}
COMMENT "Start ${DOCKER_IMAGE} container"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND
${CE} run --init --rm --privileged
--sysctl net.ipv6.conf.all.disable_ipv6=0
--add-host=ip6-localhost:::1
-it
${DOCKER_IMAGE} /mscp/scripts/test-in-container.sh bash)
list(APPEND DOCKER_BUILDS docker-build-${DOCKER_INDEX})
list(APPEND DOCKER_BUILDS_NO_CACHE docker-build-${DOCKER_INDEX}-no-cache)
list(APPEND DOCKER_TESTS docker-test-${DOCKER_INDEX})

View File

@@ -28,5 +28,11 @@ for port in 22 8022; do
ssh-keyscan -p $port ::1 >> ${HOME}/.ssh/known_hosts
done
# Run test
python3 -m pytest -v ../test
if [ $# -gt 0 ]; then
# command arguments are passed, exec them
"$@"
else
# no arguments passed, run the test
python3 -m pytest -v ../test
fi