Skip to content

Commit

Permalink
Merge branch 'master' into python3
Browse files Browse the repository at this point in the history
  • Loading branch information
lrineau committed Jul 19, 2023
2 parents 5614b39 + a89f0f1 commit f873936
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 51 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/secret.txt
/secret.file
testsuite/*
.vscode
4 changes: 2 additions & 2 deletions Debian-testing-clang-main/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM debian:testing
FROM cgal/testsuite-docker:debian-testing
ARG dockerfile_url
ENV DOCKERFILE_URL=$dockerfile_url

RUN apt-get update -y && apt-get install -y wget \
&& wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc \
&& echo 'deb http://apt.llvm.org/unstable/ llvm-toolchain main' > /etc/apt/sources.list.d/llvm.list \
&& apt-get update -y \
&& apt-get install -y clang cmake make \
&& apt-get install -y clang \
&& apt-get clean all

ENV CXX=/usr/bin/clang++
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ It is also possible to only test specific packages, but keep in mind that this w
--packages Core Mesh_2 Mesh_3


Running the testsuite for one container
---------------------------------------

Use a command similar to that one:

docker run --rm -t -i -v $PWD/run-testsuite.sh:/mnt/run-testsuite.sh:z -v $HOME/Git/cgal-master:/mnt/testsuite:ro,z -v $PWD/testresults:/mnt/testresults:z cgal/testsuite-docker:debian-testing bash -x /mnt/run-testsuite.sh

If you want a limited testsuite, you can have a file `testresults/list_test_packages` containing something like:

echo Mesh_2
echo Triangulation_2

Default Arguments
-----------------

Expand Down
85 changes: 49 additions & 36 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

set -e

curl -o cgal.tar.gz -L $(curl -s https://api.github.com/repos/CGAL/cgal/releases/latest | jq -r .tarball_url)
mkdir -p cgal
tar -xzf cgal.tar.gz -C cgal --strip-components=1

if command -v selinuxenabled >/dev/null && selinuxenabled; then
chcon -Rt container_file_t cgal
fi

if [ -n "$GITHUB_SHA" ]; then
COMMIT_URL=https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA}
fi
Expand All @@ -14,26 +22,31 @@ function dockerbuild() {
fi
}

function dockerbuildandtest() {
dockerbuild $1 $2
docker run --rm -v $PWD/cgal:/cgal cgal/testsuite-docker:$1 bash -c 'cmake -DWITH_examples=ON /cgal && cmake --build . -t terrain'
}

if [ "$1" = ArchLinux ]
then
dockerbuild archlinux ArchLinux
dockerbuild archlinux-cxx14 ArchLinux-CXX14
dockerbuild archlinux-cxx17-release ArchLinux-CXX17-Release
dockerbuild archlinux-clang ArchLinux-clang
dockerbuild archlinux-clang-cxx14 ArchLinux-clang-CXX14
dockerbuild archlinux-clang-cxx17-release ArchLinux-clang-CXX17-Release
dockerbuild archlinux-clang-cxx20-release ArchLinux-clang-CXX20-Release
dockerbuild archlinux-clang-release ArchLinux-clang-Release
dockerbuildandtest archlinux ArchLinux
dockerbuildandtest archlinux-cxx14 ArchLinux-CXX14
dockerbuildandtest archlinux-cxx17-release ArchLinux-CXX17-Release
dockerbuildandtest archlinux-clang ArchLinux-clang
dockerbuildandtest archlinux-clang-cxx14 ArchLinux-clang-CXX14
dockerbuildandtest archlinux-clang-cxx17-release ArchLinux-clang-CXX17-Release
dockerbuildandtest archlinux-clang-cxx20-release ArchLinux-clang-CXX20-Release
dockerbuildandtest archlinux-clang-release ArchLinux-clang-Release
elif [ "$1" = CentOS-5 ]
then
dockerbuild centos5 CentOS-5
dockerbuildandtest centos5 CentOS-5
elif [ "$1" = CentOS-6 ]
then
dockerbuild centos6 CentOS-6
dockerbuild centos6-cxx11-boost157 CentOS-6-CXX11-Boost157
dockerbuildandtest centos6 CentOS-6
dockerbuildandtest centos6-cxx11-boost157 CentOS-6-CXX11-Boost157
elif [ "$1" = CentOS-6-32 ]
then
dockerbuild centos6-32 CentOS-6-32
dockerbuildandtest centos6-32 CentOS-6-32
elif [ "$1" = CentOS-7-ICC-beta ]
then
if [ -z "$ICC_BETA_ACTIVATION_SERIAL_NUMBER" -a -n "$TRAVIS_PULL_REQUEST" ]; then
Expand All @@ -49,45 +62,45 @@ then
fi
elif [ "$1" = CentOS-7-ICC ]
then
dockerbuild centos7-icc CentOS-7-ICC
dockerbuildandtest centos7-icc CentOS-7-ICC
elif [ "$1" = CentOS-7 ]
then
dockerbuild centos7 CentOS-7
dockerbuild centos7-release CentOS-7-Release
dockerbuildandtest centos7 CentOS-7
dockerbuildandtest centos7-release CentOS-7-Release
elif [ "$1" = Debian-stable ]
then
dockerbuild debian-stable Debian-stable
dockerbuild debian-stable-release Debian-stable-Release
dockerbuild debian-stable-cross-compilation-for-arm Debian-stable-cross-compilation-for-arm
dockerbuildandtest debian-stable Debian-stable
dockerbuildandtest debian-stable-release Debian-stable-Release
dockerbuildandtest debian-stable-cross-compilation-for-arm Debian-stable-cross-compilation-for-arm
elif [ "$1" = Debian-testing ]
then
dockerbuild debian-testing Debian-testing
dockerbuild debian-testing-clang-main Debian-testing-clang-main
dockerbuildandtest debian-testing Debian-testing
dockerbuildandtest debian-testing-clang-main Debian-testing-clang-main
elif [ "$1" = Fedora ]
then
dockerbuild fedora Fedora
dockerbuild fedora-with-leda Fedora-with-LEDA
dockerbuild fedora-release Fedora-Release
dockerbuild fedora-strict-ansi Fedora-strict-ansi
dockerbuildandtest fedora Fedora
dockerbuildandtest fedora-with-leda Fedora-with-LEDA
dockerbuildandtest fedora-release Fedora-Release
dockerbuildandtest fedora-strict-ansi Fedora-strict-ansi
elif [ "$1" = Fedora-32 ]
then
dockerbuild fedora-32 Fedora-32
dockerbuild fedora-32-release Fedora-32-Release
dockerbuildandtest fedora-32 Fedora-32
dockerbuildandtest fedora-32-release Fedora-32-Release
elif [ "$1" = Fedora-rawhide ]
then
dockerbuild fedora-rawhide Fedora-rawhide
dockerbuild fedora-rawhide-release Fedora-rawhide-Release
dockerbuildandtest fedora-rawhide Fedora-rawhide
dockerbuildandtest fedora-rawhide-release Fedora-rawhide-Release
elif [ "$1" = Ubuntu ]
then
dockerbuild ubuntu Ubuntu
dockerbuild ubuntu-cxx11 Ubuntu-CXX11
dockerbuild ubuntu-no-deprecated-code Ubuntu-NO_DEPRECATED_CODE
dockerbuild ubuntu-no-gmp-no-leda Ubuntu-no-gmp-no-leda
dockerbuildandtest ubuntu Ubuntu
dockerbuildandtest ubuntu-cxx11 Ubuntu-CXX11
dockerbuildandtest ubuntu-no-deprecated-code Ubuntu-NO_DEPRECATED_CODE
dockerbuildandtest ubuntu-no-gmp-no-leda Ubuntu-no-gmp-no-leda
elif [ "$1" = Ubuntu-GCC-master ]
then
dockerbuild ubuntu-gcc6 Ubuntu-GCC6
dockerbuild ubuntu-gcc6-cxx1z Ubuntu-GCC6-CXX1Z
dockerbuild ubuntu-gcc6-release Ubuntu-GCC6-Release
dockerbuild ubuntu-gcc_master_cxx20-release Ubuntu-GCC_master_cpp20-Release
dockerbuildandtest ubuntu-gcc6 Ubuntu-GCC6
dockerbuildandtest ubuntu-gcc6-cxx1z Ubuntu-GCC6-CXX1Z
dockerbuildandtest ubuntu-gcc6-release Ubuntu-GCC6-Release
dockerbuildandtest ubuntu-gcc_master_cxx20-release Ubuntu-GCC_master_cpp20-Release
fi
docker images
3 changes: 2 additions & 1 deletion test_container/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.11...3.22)
project(TestCGAL C CXX) # To Enable Compiler Checks

# We output results at the end, because some Find scripts do not
Expand All @@ -9,6 +9,7 @@ set(CGAL_MODULES_DIR $ENV{CGAL_MODULES_DIR})

set(CMAKE_MODULE_PATH "${CGAL_MODULES_DIR}" ${CMAKE_MODULE_PATH})

include(CGAL_Common)
find_package(BLAS QUIET)
find_package(Boost 1.39.0 OPTIONAL_COMPONENTS thread system program_options QUIET)
find_package(ESBTL QUIET)
Expand Down
27 changes: 15 additions & 12 deletions test_container/test_container.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3

import argparse
import docker
Expand All @@ -14,18 +14,18 @@ def main():
description='''This script checks if a docker container can run the CGAL testsuite.''')

parser.add_argument('--image', help='Image to check')
parser.add_argument('--modules-dir', metavar='/path/to/cgal/Installation/cmake/modules',
help='Path to a CGAL cmake modules dir')
parser.add_argument('--cgal-dir', metavar='/path/to/cgal',
help='Path to a CGAL installation')
parser.add_argument('--docker-url', metavar='protocol://hostname/to/docker.sock[:PORT]',
default='unix://var/run/docker.sock',
help='The protocol+hostname+port where the Docker server is hosted.')

args = parser.parse_args()

assert args.image
assert args.modules_dir
args.modules_dir = os.path.abspath(args.modules_dir) # make the path absolute
docker_client = docker.Client(base_url=args.docker_url)
assert args.cgal_dir
args.cgal_dir = os.path.abspath(args.cgal_dir) # make the path absolute
docker_client = docker.APIClient(base_url=args.docker_url)
this_path = os.path.dirname(os.path.realpath(__file__))

image_name_regex = re.compile('(.*/)?([^:]*)(:.*)?')
Expand All @@ -40,13 +40,13 @@ def main():
container = docker_client.create_container(
image=args.image,
name=chosen_name,
environment={'CGAL_MODULES_DIR' : '/mnt/modules'},
environment={'CGAL_MODULES_DIR' : '/mnt/cgal/Installation/cmake/modules'},
entrypoint=['/mnt/test/run-test.sh'],
volumes=['/mnt/modules', '/mnt/test'],
host_config=docker.utils.create_host_config(binds={
args.modules_dir:
host_config=docker_client.create_host_config(binds={
args.cgal_dir:
{
'bind': '/mnt/modules',
'bind': '/mnt/cgal',
'ro': True
},
this_path:
Expand All @@ -67,13 +67,16 @@ def main():
# We have to wait until the container dies to access the log since
# docker_client.log(strem=True) is broken...
for ev in docker_client.events(since=before_start, decode=True):
if ev['Type'] != 'container':
continue;
assert isinstance(ev, dict)
if ev[u'id'] == container[u'Id'] and ev[u'status'] == u'die':
if ev['id'] == container['Id'] and ev['status'] == 'die':
# our container died, time to print the log
break

log = docker_client.logs(container=container)
print log
for line in log.splitlines():
print(line)

if __name__ == "__main__":
main()
Expand Down

0 comments on commit f873936

Please sign in to comment.