Skip to content

Commit

Permalink
fixes for ArchLinux, and small polish of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lrineau committed Nov 18, 2024
1 parent 9718eb2 commit 0386ee1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
18 changes: 14 additions & 4 deletions run-testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,19 @@ for pkg in $LIST_TEST_PACKAGES; do
TO_TEST="${TO_TEST}|$pkg"
fi
done
#unsets the limit of 1024 bits for the logs through ssh
echo "SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000000)" > CTestCustom.cmake
echo "SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1000000000)" >> CTestCustom.cmake

# unset the limits of 1 KiB for the logs and set them to 1 GB instead
cat <<EOF > CTestCustom.cmake
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000000)
set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1000000000)
EOF

# add a configuration file for the tests (required since CMake-3.32)
cat <<EOF > CTestConfiguration.cmake
SourceDirectory: ${CGAL_RELEASE_DIR}
BuildDirectory: ${CGAL_SRC_BUILD_DIR}
EOF

CTEST_OPTS="-T Start -T Test --timeout 1200 ${DO_NOT_TEST:+-E execution___of__}"
if [ -z "${SHOW_PROGRESS}" ]; then
ctest ${TO_TEST:+-L ${TO_TEST} } ${CTEST_OPTS} -j${CGAL_NUMBER_OF_JOBS} ${KEEP_TESTS:+-FC .}>${CGAL_TESTRESULTS}ctest-${CGAL_TEST_PLATFORM}.log || :
Expand All @@ -123,7 +133,7 @@ echo "CGAL_TEST_PLATFORM ${PLATFORM}" >> "$RESULT_FILE"
grep -e "^-- Operating system: " "${CGAL_TESTRESULTS}installation-${CGAL_TEST_PLATFORM}.log"|sort -u >> $RESULT_FILE
grep -e "^-- USING " "${CGAL_TESTRESULTS}installation-${CGAL_TEST_PLATFORM}.log"|sort -u >> $RESULT_FILE
sed -n '/^-- Third-party library /p' "${CGAL_TESTRESULTS}installation-${CGAL_TEST_PLATFORM}.log" >> $RESULT_FILE
#Use sed to get the content of DEBUG or RELEASE CXX FLAGS so that Multiconfiguration platforms do provide their CXXXFLAGS to the testsuite page (that greps USING CXXFLAGS to get info)
# Use sed to get the content of DEBUG or RELEASE CXX FLAGS so that Multi-config platforms do provide their CXXFLAGS to the testsuite page (that greps USING CXXFLAGS to get info)
sed -i -E 's/(^-- USING )(DEBUG|RELEASE) (CXXFLAGS)/\1\3/' $RESULT_FILE
echo "------------" >> "$RESULT_FILE"
touch ../../../../../.scm-branch
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function dockerbuildandtest() {
echo "::group::Test image $1"
docker run --rm -v $PWD/cgal:/cgal cgal/testsuite-docker:$1 bash -c 'cmake -DWITH_examples=ON -S /cgal -B /build && cmake --build /build -t terrain -v'
if command -v python3 >/dev/null; then
python3 ./test_container/test_container.py --image cgal/testsuite-docker:$1 --cgal-dir $HOME/cgal
python3 ./test_container/test_container.py --image cgal/testsuite-docker:$1 --cgal-dir $PWD/cgal ${DOCKER_HOST:+--docker-url "${DOCKER_HOST}"}
fi
echo '::endgroup::'
}
Expand Down
2 changes: 1 addition & 1 deletion test_container/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1...3.26)
cmake_minimum_required(VERSION 3.1...3.30)
project(TestCGAL C CXX) # To Enable Compiler Checks

# We output results at the end, because some Find scripts do not
Expand Down
8 changes: 4 additions & 4 deletions test_container/run-test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -l
#!/bin/sh

mkdir /cgal_test && cd /cgal_test
cp /mnt/test/CMakeLists.txt .
cmake .
set -e

cmake -S /mnt/test -B /cgal_test
15 changes: 14 additions & 1 deletion test_container/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ def main():
else:
chosen_name = 'CGAL-{}-test_container'.format(res.group(2))

try:
docker_client.remove_container(container=chosen_name, force=True)
except docker.errors.NotFound:
pass
except docker.errors.APIError as e:
logging.warning("Failed to remove container %s: %s", chosen_name, e)
container = docker_client.create_container(
image=args.image,
name=chosen_name,
Expand Down Expand Up @@ -74,10 +80,17 @@ def main():
# our container died, time to print the log
break

log = docker_client.logs(container=container)
log = docker_client.logs(container=container).decode('utf-8')
for line in log.splitlines():
print(line)

exit_code = docker_client.inspect_container(container['Id'])['State']['ExitCode']
if exit_code != 0:
logging.error('Container exited with code {}'.format(exit_code))
exit(exit_code)
else:
logging.info('Container exited successfully')

if __name__ == "__main__":
main()

0 comments on commit 0386ee1

Please sign in to comment.