ctest: Incorrect uname values used when running in Docker.
When executing cmake inside of a Docker container for running ctest and reporting the values back to CDash, the OS Name, OS Platform, OS Release, and OS Version fields will all be incorrect as they will reflect the host system and not that of the Docker container. For instance, running an Ubuntu 20.04 container on an Ubuntu 18.04 host will report all of these fields for the 18.04 host.
As an example the value of CMAKE_HOST_SYSTEM_VERSION as well as others automatically get set with uname -r
which will return the host system values as Docker shares the kernel with the container. For these instances could the Docker environment be ascertained with something like such:
if [ -f /.dockerenv ]; then
And then use /etc/os-release
to depict a more accurate environment to report back to CDash?