From 026907a9ce6af096af7b6821f24a3728e190ef79 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Feb 2021 12:44:42 +0100 Subject: [PATCH 01/18] =?UTF-8?q?#=20Ceci=20est=20la=20combinaison=20de=20?= =?UTF-8?q?7=20commits.=20#=20Ceci=20est=20le=20premier=20message=20de=20v?= =?UTF-8?q?alidation=C2=A0:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First step of action # Ceci est le message de validation numéro 2 : add ssh stuff # Ceci est le message de validation numéro 3 : Update github action # Ceci est le message de validation numéro 4 : Fix Logic # Ceci est le message de validation numéro 5 : Don't override the PATH !!! # Ceci est le message de validation numéro 6 : Download the known host too, so it is possible to add new IPs in it. # Ceci est le message de validation numéro 7 : Fix GIT path and better management of VERSION_NUMBER --- .github/workflows/filter_testsuite.yml | 99 +++++++++++++++++++ .../run_testsuite_from_branch_name.sh | 69 +++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 .github/workflows/filter_testsuite.yml create mode 100644 Scripts/developer_scripts/run_testsuite_from_branch_name.sh diff --git a/.github/workflows/filter_testsuite.yml b/.github/workflows/filter_testsuite.yml new file mode 100644 index 000000000000..f2eb2dd589ec --- /dev/null +++ b/.github/workflows/filter_testsuite.yml @@ -0,0 +1,99 @@ +name: Filter Testsuite + +on: + issue_comment: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v3 + id: check + with: + result-encoding: string + script: | + const userName = context.payload.comment.user.login + if(userName == 'maxGimeno') { + const body = context.payload.comment.body + if(body.includes("/testme")) { + return 'OK' + } + } + return 'stop' + - uses: actions/github-script@v3 + if: steps.check.result != 'stop' + id: get_label + with: + result-encoding: string + script: | + //get branch name and username + const pr_url = context.payload.issue.pull_request.url + const pr_content = await github.request(pr_url) + const label = pr_content.data.head.label + console.log(label) + return label + - uses: actions/github-script@v3 + if: steps.check.result != 'stop' + id: get_base + with: + result-encoding: string + script: | + //get branch name and username + const pr_url = context.payload.issue.pull_request.url + const pr_content = await github.request(pr_url) + const base = pr_content.data.base.ref + console.log(base) + return base + - name: Run Testsuite + if: steps.check.outputs.result != 'stop' + run: | + mkdir -p ~/.ssh + #ssh key + ( + cat <> ~/.ssh/id_rsa + chmod 600 /home/runner/.ssh/id_rsa + #ssh public key + ( + cat <> ~/.ssh/id_rsa.pub + chmod 644 /home/runner/.ssh/id_rsa.pub + #known hosts + wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_known_hosts -O ~/.ssh/known_hosts + #config file + wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_config -O ~/.ssh/config + #list of hosts + wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_host_list -O ~/ssh_host_list + #ssh command + LABEL="${{ steps.get_label.outputs.result }}" + USER_NAME=$(echo $LABEL | cut -d':' -f 1) + BRANCH_NAME=$(echo $LABEL | cut -d':' -f 2) + BASE="${{ steps.get_base.outputs.result }}" + mapfile -t HOSTS < ~/ssh_host_list; + LAST_INDEX=$((${#HOSTS[@]}-1)) + for i in ${!HOSTS[@]}; do + HOST=$(echo ${HOSTS[$i]}|cut -d' ' -f 1 ) + PATH_TO_SCRIPT=$(echo ${HOSTS[$i]}|cut -d' ' -f 2 ) + if [ "$i" -ne "$LAST_INDEX" ] ; then + ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE" + else + ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" + fi + done + - name: Post address + uses: actions/github-script@v3 + if: steps.check.outputs.result != 'stop' + with: + script: | + const address = "The testsuite is lauched. results will be found, after it is done, here : https://cgal.geometryfactory.com/~mgimeno/test_suite/TESTRESULTS/index.shtml " + github.issues.createComment({ + owner: "maxGimeno", + repo: "cgal", + issue_number: ${{ github.event.issue.number }}, + body: address + }); diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh new file mode 100644 index 000000000000..99b59fc1fe67 --- /dev/null +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +#To run: $1 = name of the user +# $2 = name of the branch +# $3 = base ref name (master, 5.1.x, 5.2.x, etc...) +# $4 = if given, update the VERSION_NUMBER + + +if uname | grep -q -i cygwin; then + #Is supposed to ignore \r as eol character. + export SHELLOPTS + set -o igncr +fi +source "$(dirname $0)/.autofilterrc" +USER_REPO=$1 +BRANCH_NAME=$2 +BASE_NAME=$3 +cd ${CGAL_ROOT} +scp mgimeno@cgal.geometryfactory.com:public_html/test_suite/VERSION_NUMBER . +cd ${CGAL_GIT_DIR} +if [ ! -d cgal ]; then + git clone --depth 1 --no-single-branch https://github.com/CGAL/cgal.git + cd cgal + git remote rename origin cgal + cd .. +fi +cd cgal +git fetch --depth 1 cgal +git remote add $USER_REPO https://github.com/$USER_REPO/cgal.git +git fetch --depth 1 $USER_REPO +git checkout $BRANCH_NAME +git reset --hard $USER_REPO/$BRANCH_NAME +#setup the list_test_packages +LIST_OF_PKGS=$(git diff --name-only HEAD cgal/$BASE_NAME |cut -s -d/ -f1 |sort -u | xargs -I {} ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true) +if [ "$LIST_OF_PKGS" != "" ]; then + if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi + for f in $LIST_OF_PKGS + do + echo "echo \"$f\"" >> ${CGAL_ROOT}/list_test_packages + echo "echo \"${f}_Examples\"" >> ${CGAL_ROOT}/list_test_packages + echo "echo \"${f}_Demo\"" >> ${CGAL_ROOT}/list_test_packages + done +fi +( +#create the release from the branch +echo " Create release..." +cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=0.0-Ic-$(cat ${CGAL_ROOT}/VERSION_NUMBER) -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log +echo "done." +DEST=$(sed -E 's/.*CGAL-TEST\/(.*)/\1/' log); + +cd ${CGAL_ROOT} + +if [ -L CGAL-I ]; then rm CGAL-I; fi +ln -s $PWD/CGAL-TEST/$DEST CGAL-I +echo "starting testsuite..." + +./autotest_cgal -c +)>${CGAL_ROOT}/autotest.log2 2>&1 & +echo "finished." +if [ -n "$4" ]; then + cd ${CGAL_ROOT} + V=$(cat VERSION_NUMBER) + V=$(($V+1)) + echo $V > VERSION_NUMBER + scp VERSION_NUMBER mgimeno@cgal.geometryfactory.com:public_html/test_suite/VERSION_NUMBER +fi + +echo "exit." +exit 0 From 7a526ea537963a09b0886a1139ca190e8f3a0050 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 23 Jul 2021 14:14:31 +0200 Subject: [PATCH 02/18] First step of action add ssh stuff Update github action Fix Logic Don't override the PATH !!! Download the known host too, so it is possible to add new IPs in it. Fix GIT path and better management of VERSION_NUMBER fix autotest_cgal Fixes for scripts --- .github/workflows/filter_testsuite.yml | 9 +++++---- Scripts/developer_scripts/autotest_cgal | 16 ++++++++++------ .../run_testsuite_from_branch_name.sh | 13 ++++++++----- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/filter_testsuite.yml b/.github/workflows/filter_testsuite.yml index f2eb2dd589ec..61ff21ff405b 100644 --- a/.github/workflows/filter_testsuite.yml +++ b/.github/workflows/filter_testsuite.yml @@ -75,14 +75,15 @@ jobs: BRANCH_NAME=$(echo $LABEL | cut -d':' -f 2) BASE="${{ steps.get_base.outputs.result }}" mapfile -t HOSTS < ~/ssh_host_list; - LAST_INDEX=$((${#HOSTS[@]}-1)) for i in ${!HOSTS[@]}; do HOST=$(echo ${HOSTS[$i]}|cut -d' ' -f 1 ) PATH_TO_SCRIPT=$(echo ${HOSTS[$i]}|cut -d' ' -f 2 ) - if [ "$i" -ne "$LAST_INDEX" ] ; then - ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE" - else + if [ "$i" -ne "0" ] ; then + echo "ssh ${HOST} ${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" + else + echo "ssh ${HOST} ${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" + ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE" fi done - name: Post address diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal index 619f9fea7612..4ad3e7b8b1a9 100755 --- a/Scripts/developer_scripts/autotest_cgal +++ b/Scripts/developer_scripts/autotest_cgal @@ -380,6 +380,8 @@ setup_dirs() CGAL_DIR=`readlink "${CGAL_ROOT}/CGAL-I"` CGAL_TEST_DIR=${CGAL_DIR}/test + CGAL_DATA_DIR=${CGAL_DIR}/data + export CGAL_DATA_DIR=$(echo "$CGAL_DATA_DIR" | sed -E 's/\/cygdrive\/([a-z])\//\U\1:\//') if [ ! -d "${CGAL_DIR}/cmake" ]; then mkdir "${CGAL_DIR}/cmake" @@ -619,28 +621,28 @@ LIST_TEST_PACKAGES='${LIST_TEST_PACKAGES}' CGAL_ROOT='${CGAL_ROOT}' rm -rf '${CGAL_BINARY_DIR}/test'; - if [ -f '${LIST_TEST_PACKAGES}' ]; then - mkdir '${CGAL_BINARY_DIR}/test' cp '${CGAL_TEST_DIR}/collect_cgal_testresults_from_cmake' '${CGAL_BINARY_DIR}/test' cp '${CGAL_TEST_DIR}/makefile2' '${CGAL_BINARY_DIR}/test' cp '${CGAL_TEST_DIR}/run_testsuite_with_cmake' '${CGAL_BINARY_DIR}/test' - # list all packages in CGAL_TEST_DIR. If PACKAGE is found in LIST_TEST_PACKAGES, - # copy it, else prepare for the special "skipped" case in the table. +# list all packages in CGAL_TEST_DIR. If PACKAGE is found in LIST_TEST_PACKAGES, +# copy it, else prepare for the special "skipped" case in the table. for PACKAGE in \$(ls "${CGAL_TEST_DIR}"); do if [ -d "${CGAL_TEST_DIR}/\$PACKAGE" ]; then if source '${LIST_TEST_PACKAGES}' '${CGAL_ROOT}' | egrep -q \$PACKAGE; then - mkdir "\${CGAL_BINARY_DIR}/test/\${PACKAGE}" + mkdir "${CGAL_BINARY_DIR}/test/\${PACKAGE}" + cp -r "${CGAL_TEST_DIR}/\${PACKAGE}" '${CGAL_BINARY_DIR}/test' + elif [ "\$PACKAGE" = "resources" ]; then + mkdir "${CGAL_BINARY_DIR}/test/\${PACKAGE}" cp -r "${CGAL_TEST_DIR}/\${PACKAGE}" '${CGAL_BINARY_DIR}/test' else mkdir "${CGAL_BINARY_DIR}/test/\${PACKAGE}" touch "${CGAL_BINARY_DIR}/test/\${PACKAGE}/skipped" fi fi - done else @@ -768,6 +770,7 @@ run_test_on_host() fi for PLATFORM in ${PLATFORMS}; do + run_test_on_host_and_platform "${HOST}" "${PLATFORM}" publish_results "${HOST}" "${PLATFORM}" done @@ -985,3 +988,4 @@ rm -f "$LOCK_FILE"; ## Local Variables: ## sh-basic-offset: 2 ## End: + diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index 99b59fc1fe67..a19a6ca4ee71 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -11,12 +11,13 @@ if uname | grep -q -i cygwin; then export SHELLOPTS set -o igncr fi -source "$(dirname $0)/.autofilterrc" +source ~/.autofilterrc +echo "CGAL_ROOT = $CGAL_ROOT" > log USER_REPO=$1 BRANCH_NAME=$2 BASE_NAME=$3 cd ${CGAL_ROOT} -scp mgimeno@cgal.geometryfactory.com:public_html/test_suite/VERSION_NUMBER . +scp ${VERSION_NUMBER_SSH_URL} . cd ${CGAL_GIT_DIR} if [ ! -d cgal ]; then git clone --depth 1 --no-single-branch https://github.com/CGAL/cgal.git @@ -44,6 +45,7 @@ fi ( #create the release from the branch echo " Create release..." +echo "CGAL_VERSION=0.0-Ic-$(cat ${CGAL_ROOT}/VERSION_NUMBER)"> log cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=0.0-Ic-$(cat ${CGAL_ROOT}/VERSION_NUMBER) -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log echo "done." DEST=$(sed -E 's/.*CGAL-TEST\/(.*)/\1/' log); @@ -55,15 +57,16 @@ ln -s $PWD/CGAL-TEST/$DEST CGAL-I echo "starting testsuite..." ./autotest_cgal -c -)>${CGAL_ROOT}/autotest.log2 2>&1 & -echo "finished." + if [ -n "$4" ]; then cd ${CGAL_ROOT} V=$(cat VERSION_NUMBER) V=$(($V+1)) echo $V > VERSION_NUMBER - scp VERSION_NUMBER mgimeno@cgal.geometryfactory.com:public_html/test_suite/VERSION_NUMBER + scp VERSION_NUMBER ${VERSION_NUMBER_SSH_URL} fi +)>${CGAL_ROOT}/autotest.log2 2>&1 & +echo "finished." echo "exit." exit 0 From 4635ac2e15b08743941a4120dae406e4a4ce919c Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 23 Jul 2021 12:05:49 +0200 Subject: [PATCH 03/18] Add files for testresults Add test collection script odifications for "skipped" fixes on conditions --- .github/workflows/filter_testsuite.yml | 4 +- .../filter_testsuite/create_testresult_page | 705 ++++++++++++++++++ .../filter_testsuite/testresult.css | 74 ++ .../filter_testsuite/to_zipped_format | 232 ++++++ .../filter_testsuite/treat_result_collection | 185 +++++ .../run_testsuite_from_branch_name.sh | 2 +- .../test/collect_cgal_testresults_from_cmake | 5 +- 7 files changed, 1203 insertions(+), 4 deletions(-) create mode 100755 Maintenance/test_handling/filter_testsuite/create_testresult_page create mode 100644 Maintenance/test_handling/filter_testsuite/testresult.css create mode 100755 Maintenance/test_handling/filter_testsuite/to_zipped_format create mode 100755 Maintenance/test_handling/filter_testsuite/treat_result_collection diff --git a/.github/workflows/filter_testsuite.yml b/.github/workflows/filter_testsuite.yml index 61ff21ff405b..3c2e6364c053 100644 --- a/.github/workflows/filter_testsuite.yml +++ b/.github/workflows/filter_testsuite.yml @@ -78,11 +78,11 @@ jobs: for i in ${!HOSTS[@]}; do HOST=$(echo ${HOSTS[$i]}|cut -d' ' -f 1 ) PATH_TO_SCRIPT=$(echo ${HOSTS[$i]}|cut -d' ' -f 2 ) - if [ "$i" -ne "0" ] ; then + if [ "$i" = "0" ] ; then echo "ssh ${HOST} ${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" else - echo "ssh ${HOST} ${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" + echo "ssh ${HOST} ${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE" ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE" fi done diff --git a/Maintenance/test_handling/filter_testsuite/create_testresult_page b/Maintenance/test_handling/filter_testsuite/create_testresult_page new file mode 100755 index 000000000000..399e57d5dddf --- /dev/null +++ b/Maintenance/test_handling/filter_testsuite/create_testresult_page @@ -0,0 +1,705 @@ +#!/usr/bin/env perl +# +# first author: Geert-Jan Giezeman +# recent maintainer: Laurent Rineau (2009-2011) +# +# This script creates a WWW page with a table of test suite results. +# +# Usage: +# create_testresult_page + +# Creates the following files : +# - results-$version.shtml +# - versions.inc (contains the version selector) +# - index.shtml -> results-$version.shtml (symlink) + +use Cwd; +use strict; +use Date::Format; + +my $test_results_url="https://cgal.geometryfactory.com/~mgimeno/test_suite/TESTRESULTS/index.shtml"; + +my ($PLATFORMS_BESIDE_RESULTS, $PLATFORMS_REF_BETWEEN_RESULTS)=(1,1); + +my $TEMPPAGE="tmp$$.html"; +my $TEMPPAGE2="tmp2$$.html"; +my $release_name; +my @platforms_to_do; +my @known_platforms; +my %platform_short_names; +my %platform_is_optimized; +my %platform_is_64bits; +my @available_platforms; +my %test_directories = (); +my @testresults; +my $testresult_dir=cwd()."/TESTRESULTS"; + +# Inspired from +# http://cpansearch.perl.org/src/EDAVIS/Sort-Versions-1.5/Versions.pm +sub sort_releases($$) +{ + # Take arguments in revert order: one wants to sort from the recent to + # the old releases. + my $b = $_[0]; + my $a = $_[1]; + + #take only the numbers from release id, skipping the bug-fix + #number, and I and Ic + my @A = ($a =~ /(\d+)\.(\d+)\.?(:?\d+)?(:?-Ic?-)?(\d+)?/a); + my @B = ($b =~ /(\d+)\.(\d+)\.?(:?\d+)?(:?-Ic?-)?(\d+)?/a); + + while(@A and @B) { + my $av = shift(@A); + my $bv = shift(@B); + #$av and $bv are integers + if($av == $bv) { next; } + return $av <=> $bv; + } + return @A <=> @B; +} + +sub write_selects() +{ + print OUTPUTV "

You can browse the test results of a different version :

"; + my %releases; + foreach $_ (glob("results-*.shtml")) { + $_ =~ /results-(\d+.\d+)([^I]*)((-Ic?)-([^I].*))\.shtml/a; + $releases{"$1"}=1; + } + print OUTPUTV "\n"; + print OUTPUTV " \n"; + my $count = 0; + foreach $_ (sort sort_releases (keys %releases)) { + print OUTPUTV " \n"; + $count++ > 3 && last; + } + print OUTPUTV "\n"; + print OUTPUTV "\n"; + write_select("sel"); + $count = 0; + foreach $_ (sort sort_releases (keys %releases)) { + write_select("sel" . $count, $_); + $count++ > 3 && last; + } + print OUTPUTV "\n
All releases (last one)CGAL-$_
\n"; +} + +sub write_select() +{ + my $id = shift(@_); + my $pattern = ".*"; + if (@_ != 0) { + $pattern = quotemeta(shift(@_)); + } + my($filename, @result); + print OUTPUTV " "; +} + +sub list_platforms() +{ + my ($filename, @result); + foreach $_ (glob("results_*.txt")) { + ($filename) = m/results_(.*?)\.txt\s*/; + push(@result, $filename) if $filename; + } + return @result; +} + +sub list_packages($) +# +# Fill %test_directories with the packages found in the argument platform. +# Return false if that platform does not have a list of packages. +{ + my ($platform) = @_; + my $test_result="results_${platform}.txt"; + open(TESTRESULT, $test_result) or return 0; + while () { + if (/^\s*(.*?)\s+(\w)\s*$/) { + $test_directories{$1} = ''; + } + } + close TESTRESULT or return 0; + return 1; +} + +sub collect_results_of_platform($) +{ + my ($platform) = @_; +# Create an anonymous hash that hashes packages to their result. + my $platform_results = {}; + my $test_result="results_${platform}.txt"; + my ($yeahs, $nays, $warnings,$reqs, $skips) = (0,0,0,0,0); + my $resulttext; + open(TESTRESULT, $test_result) or return $platform_results; + while () { + if (/^\s*(.*?)\s+(\w)\s*$/) { + #($package,$succes) = ($1,$2); + if ($2 eq 'y' or $2 eq 'Y') { + $resulttext = 'y'; + ++$yeahs; + } elsif ($2 eq 'w' or $2 eq 'W') { + $resulttext = 'w'; + ++$warnings; + } elsif ($2 eq 'n' or $2 eq 'N') { + $resulttext = 'n'; + ++$nays; + } elsif ($2 eq 'r') { + $resulttext = 'r'; + ++$reqs; + } elsif ($2 eq 's') { + $resulttext = 's'; + ++$skips; + } else { + $resulttext = ' '; + } + $platform_results->{$1} = $resulttext; + } + } + close TESTRESULT; + $platform_results->{"y"} = $yeahs; + $platform_results->{"n"} = $nays; + $platform_results->{"w"} = $warnings; + $platform_results->{"r"} = $reqs; + $platform_results->{"s"} = $skips; + return $platform_results; +} + +sub collect_results() +{ + my $platform; + foreach $platform (@platforms_to_do) { + list_packages($platform); + } + foreach $platform (@platforms_to_do) { + push(@testresults, collect_results_of_platform($platform)); + } +} + +sub print_result_table() +{ + my $platform_count = scalar(@platforms_to_do); + + print OUTPUT <<"EOF"; + + + + + + + +EOF + + print_platforms_numbers(); + + print OUTPUT "\n"; + my $test_directory; + my $test_num = 0; + foreach $test_directory (sort keys %test_directories) { + if ($PLATFORMS_REF_BETWEEN_RESULTS) { + $test_num++; + if ($test_num == 15) { + $test_num = 0; + print OUTPUT "\n\n"; + } + } + # my $version; + # if ( -r "$test_directory/version" ) { + # open(VERSION, "$test_directory/version"); + # while() { + # ($version) = /^\s*([^\s]*)\s/; + # last if $version; + # } + # close VERSION; + # } + print OUTPUT "\n\n"; + print OUTPUT "\n"; + # if ( $version ) { + # print OUTPUT "\n"; + # } else { + # print OUTPUT "\n"; + # } + my ($platform_num,$platform)=(0,""); + $platform_num=0; + foreach $platform (@platforms_to_do) { + my ($result,$resulttext); + $resulttext = $testresults[$platform_num]->{$test_directory}; + if (! defined($resulttext)) { + $resulttext = ' '; + } + print OUTPUT '\n"; + ++$platform_num; + + } + print OUTPUT "\n"; + } + print OUTPUT "
PackageTest Platform
\n"; + print OUTPUT 'Platform Description'; + print OUTPUT "\n"; + print_platforms_numbers(); + print OUTPUT "\n
$test_directory$version?.? ', "$resulttext
\n"; +} + +sub print_resultpage() +{ + my $platform_count = scalar(@platforms_to_do); + + print OUTPUT '

Test Results

'."\n"; + print OUTPUT '

In the table below, each column is numbered, and corresponds to a platform. '; + print OUTPUT 'Each column number is a link to the platform description table.

', "\n"; + if ($PLATFORMS_BESIDE_RESULTS) { + print OUTPUT <<"EOF"; + + +\n
+EOF + } + + print_result_table(); + + if ($PLATFORMS_BESIDE_RESULTS) { + print OUTPUT "\n\n"; + if ($platform_count > 0) { + my $repeat_count = (1 + 1.1/16.5)*scalar(keys %test_directories)/($platform_count+0.25); + while ($repeat_count >= 1) { + $repeat_count--; + print OUTPUT "\n"; + } + } + print OUTPUT "
\n"; + print_platforms(); + print OUTPUT "
\n
\n"; + } +} + +sub sort_pf +{ + # MSVS first + if($a =~ m/^MS/) { + if($b =~ m/^MS/) { + return $a cmp $b; + } + else + { + return -1; + } + } + if($b =~ m/^MS/) { return 1; } + + # g++/gcc second + if($a =~ m/^g[c+][c+]/) { + if($b =~ m/^g[c+][c+]/) { + return $a cmp $b; + } + else + { + return -1; + } + } + if($b =~ m/^g[c+][c+]/) { return 1; } + + # Intel third + if($a =~ m/^[iI]/) { + if($b =~ m/^[iI]/) { + return $a cmp $b; + } + else + { + return -1; + } + } + if($b =~ m/^[iI]/) { return 1; } + + # SunPro last + if($a =~ m/^[Ss][uU[Nn]/) { + if($b =~ m/^[Ss][uU[Nn]/) { + return $a cmp $b; + } + else + { + return 1; + } + } + if($b =~ m/^[Ss][uU[Nn]/) { return -1; } + + return $a cmp $b; +} + +sub parse_platform($) +{ + my ($pf) = @_; + $pf =~ s/_LEDA$//; + my @list = split /_/, $pf; + return @list; +} + +sub parse_platform_2($) +{ + my ($pf) = @_; + my @list = parse_platform($pf); +# if (@list > 3) { +# splice(@list,0,@list-3); +# } + while (@list < 3) { + push(@list,'?'); + } + return @list; +} + +sub short_pfname($) +{ + my @pflist = parse_platform_2($_[0]); + my $shortpf; + if(@pflist < 4) { + $shortpf = join('_', $pflist[1], $pflist[2]); + } + elsif($pflist[2] !~ /Linux/i) { + $shortpf = join('_', $pflist[3], $pflist[2]); + if(@pflist >= 5) { + $shortpf = join('_', $shortpf, $pflist[4]); + } + } + else { + $shortpf = $pflist[3]; + if(@pflist >= 5) { + $shortpf = join('_', $shortpf, $pflist[4]); + } + } + return $shortpf; +} + +sub choose_platforms() +{ + my (%platform_index, $pf); +# List all platforms for which there are results + @available_platforms = list_platforms(); + my $index = 0; +# Put all known platforms in a hash table. + for ($index=0; $index < @known_platforms; $index += 1) { + $pf = $known_platforms[$index]; + $platform_index{$pf} = 1; + } +# Check if there are platforms listed that are not known. Warn about this +# and add those platforms at the end of the list of known platforms. + foreach (@available_platforms) { + $pf = $_; + my $shortpf = short_pfname($pf); + $pf =~ s/^[^_]*_//; + $pf =~ s/_LEDA$//; + if (!exists $platform_index{$shortpf}) { + # print STDERR "Warning: Platform $_ is unknown!\n"; + $platform_index{$shortpf} = 1; + push(@known_platforms,$shortpf); # ??? + $platform_short_names{$shortpf} = $shortpf; + } + } + +# Make a list of all the platforms that are to be treated, in the order they +# appear in the list of known_platforms. + @platforms_to_do = (); + @known_platforms = sort sort_pf @known_platforms; + for ($index=0; $index < @known_platforms; $index += 1) { + $pf = $known_platforms[$index]; + my $ind2 = 0; + foreach (@available_platforms) { + my $apf = short_pfname($_); + if ($apf eq $pf) { + push(@platforms_to_do, $_); + } + } + } +} + +sub print_platform_descriptions() +{ + my ($i,$pf_no,$pf) = (0,1); + print OUTPUT <<'EOF'; +

Platform Description and Summary

+ + + + + + + + + + + + + + + + + + +EOF + my ($platform_num)=(0); + foreach $pf (@platforms_to_do) { + my $pf_num_plus_one = $platform_num + 1; + print OUTPUT "\n\n"; + print OUTPUT "\n"; + print OUTPUT "\n"; + print OUTPUT "\n"; + print OUTPUT "\n"; + print OUTPUT "\n"; + print OUTPUT "\n"; + $index = 8; + while ($index) { + $index--; + $_ = $tmp[$index]; + if($index > 2) { + print OUTPUT "\n"; + } else { + print OUTPUT "\n"; + } + } + } else { + print OUTPUT ">$pf_short"; + my $index = 12; + while ($index) { + print OUTPUT "\n"; + } + } + ++$platform_num; + } + print OUTPUT "
OS and compilerTesterywnrsCMakeBOOSTMPFRGMPQT5LEDACXXFLAGSLDFLAGS
$pf_no\n"; + $pf_no++; + # my $pf_short = join('_',parse_platform_2($pf)); + (my $pf_short) = ($pf =~ m/_(.*)/); + print OUTPUT "; # CGAL_VERSION + $_ = ; # COMPILER + chomp; + my $compiler = $_; + print OUTPUT " title=\"$compiler\">$pf_short"; + $_ = ; # TESTER_NAME + chomp; + my $tester_name = $_; + $_ = ; # TESTER_ADDRESS + chomp; + my $tester_address = $_; + + my $county = $testresults[$platform_num]->{"y"}; + my $countw = $testresults[$platform_num]->{"w"}; + my $countn = $testresults[$platform_num]->{"n"}; + my $countr = $testresults[$platform_num]->{"r"}; + my $counts = $testresults[$platform_num]->{"s"}; + + my $index = 8; + my @tmp; + while ($index) { + $index--; + $_ = ; + chomp; + $tmp[$index] = $_; + } + ($platform_is_optimized{$pf}) = ($tmp[1] =~ m|([-/]x?O[1-9])|); + $_ = ; + chomp; + print OUTPUT "$tester_name$county$countw$countn$countr$counts$_$_?
\n

\n"; +} + +sub print_platforms_numbers() +{ + my ($platform_num,$platform)=(0,""); + foreach $platform (@platforms_to_do) { + ++$platform_num; + my $pf_short = short_pfname($platform); + my $class = ""; + my $tag = ""; + if($platform_is_optimized{$platform} || $platform_is_64bits{$platform}) + { + $class = " class=\""; + $tag = " ( "; + if($platform_is_64bits{$platform}) { + $class = "$class os64bits"; + $tag = $tag . "64 bits "; + } + if($platform_is_optimized{$platform}) { + $class = "$class highlight"; + $tag = $tag ." optimized: $platform_is_optimized{$platform}"; + } + $class = $class . "\""; + $tag = $tag . " )"; + } + print OUTPUT "$platform_num\n"; + } +} + +sub print_platforms() +{ + my ($pf_no,$pf) = (1,""); + print OUTPUT '',"\n"; + foreach $pf (@platforms_to_do) { + print OUTPUT "\n\n"; + } + print OUTPUT "
$pf_no\n"; + $pf_no++; + my $pf_short = short_pfname($pf); + print OUTPUT "$platform_short_names{$pf_short}"; + print OUTPUT "\n
\n"; +} + +sub result_filename($) +{ + return "results".substr($_[0],4).".shtml"; +# $name =~ s/-Ic?-/-/; +} + + +sub print_little_header(){ + + my $release_version = substr($release_name, 5); + print OUTPUT<<"EOF"; + + + + + ${release_name} Test Results + + + + + +

Test Results of ${release_name} + +jump to results

+ +

The results of the tests are presented in a table +('y' = success, 'w' = warning, 'n' = failure, 'r' = a requirement is not found, 's' = package skipped by tester), +and the error + compiler output from each test can be retrieved by clicking +on it.

+

N.B. The detection of warnings is not exact. +Look at the output to be sure!

+
    +EOF + if ( -r "announce.html" ) { + print OUTPUT<<"EOF"; +
  1. Announcement of this release
  2. +EOF + } + + print OUTPUT "
\n"; +} + + +sub main() +{ + if (scalar(@ARGV) != 1 ) { + print STDERR "usage: $0 directory\n"; + exit 1; + } + + $release_name =shift(@ARGV); + + $release_name =~ s<(\s+)$><>; + $release_name =~ s<(/)$><>; + chdir $testresult_dir or die; + if ( ! -d $release_name ) { + print STDERR "$release_name is not a valid directory\n"; + exit 1; + } + +# init_known_platforms(); + chdir $testresult_dir or die; + chdir $release_name or die; + choose_platforms(); + chdir ".."; + + umask 0022; + unlink $TEMPPAGE; + unlink $TEMPPAGE2; + open(OUTPUT,">$TEMPPAGE") or die; + open(OUTPUTV,">$TEMPPAGE2") or die; + chdir $testresult_dir or die; + chdir $release_name or die; + collect_results(); + print_little_header(); + print_platform_descriptions(); + print_resultpage(); + + print OUTPUT << 'EOF'; +

This page has been created by the test results + collection scripts (in trunk/Maintenance/test_handling). + See the log here.

+ +

+ ">Valid HTML 4.01 Strict +

+EOF + print OUTPUT "\n\n"; + + close OUTPUT; + chdir ".."; + + my $WWWPAGE = result_filename($release_name); + rename $TEMPPAGE, $WWWPAGE; + chmod 0644, $WWWPAGE; + unlink "index.shtml"; + symlink $WWWPAGE, "index.shtml"; + + # Deal with the versions.inc file. + write_selects(); + my $VERSIONS_WEBPAGE="versions.inc"; + rename $TEMPPAGE2, $VERSIONS_WEBPAGE; + chmod 0644, $VERSIONS_WEBPAGE; +} + +sub init_known_platforms() +{ + my ($short_name, $full_name); + open(PLATFORMS,'known_platforms') or die; + @known_platforms = (); + while() { + ($short_name, $full_name) =split; + $full_name = short_pfname($full_name); + push(@known_platforms,$full_name); + $platform_short_names{$full_name} = $full_name; + } + close(PLATFORMS); +} + +main(); diff --git a/Maintenance/test_handling/filter_testsuite/testresult.css b/Maintenance/test_handling/filter_testsuite/testresult.css new file mode 100644 index 000000000000..f45f172b5ff7 --- /dev/null +++ b/Maintenance/test_handling/filter_testsuite/testresult.css @@ -0,0 +1,74 @@ +body {color: black; background-color: #C0C0D0; font-family: sans-serif;} + +P { +width: 80ex +} + +A { + text-decoration: none; +} + +TABLE.result { font-weight: bold; background-color: white; padding: 1em; table-layout: fixed;} + +TABLE.summary TD { white-space: nowrap } +TABLE.result,TABLE.summary { border-collapse: collapse; } +TABLE.result TD,TABLE.summary TD { border-width: 1px; border-style: solid; } +TABLE.result TD { padding: 0;} +TABLE.result TD > a { font-weight: normal; font-family: monospace; display: block; padding: 0.2ex 0.5ex 0.2ex 0.5ex;} + +TABLE.beside TABLE { border-collapse: collapse; font-family: monospace; } + +TABLE.beside TABLE TD { padding: 0.2ex 0.5ex 0.2ex 0.5ex; } + +TD.highlight {background-color: rgb(80%,80%,80%)} +TD.os64bits {font-style:italic} +.cmaketag {font-weight: bold; color: rgb(100%,20%,20%);} + + +TD.ok {background-color: rgb(50%,100%,50%)} +TD.warning {background-color: rgb(100%,100%,50%)} +TD.error {background-color: rgb(100%,50%,50%)} +TD.na {background-color: white;} +TD.requirements { background-color: rgb(65%,65%,100%) } +TD.skip { background-color: rgb(90%,100%,100%) } + +TH.ok {background-color: rgb(50%,100%,50%)} +TH.warning {background-color: rgb(100%,100%,50%)} +TH.error {background-color: rgb(100%,50%,50%)} +TH.requirements { background-color: rgb(65%,65%,100%) } +TH.skip { background-color: rgb(90%,100%,100%) } + +TD.ok A {font-size:large; text-decoration: none} +TD.ok A:link {color: rgb(0%,0%,100%)} +TD.ok A:visited {color: rgb(0%,80%,100%)} + +TD.warning A {font-size:large; text-decoration: none} +TD.warning A:link {color: rgb(0%,0%,100%)} +TD.warning A:visited {color: rgb(80%,80%,100%)} + +TD.error A {font-size: large; text-decoration: none} +TD.error A:link {color: rgb(0%,0%,100%)} +TD.error A:visited {color: rgb(80%,0%,100%)} + +TD.requirements A {font-size: large; text-decoration: none} +TD.requirements A:link {color: rgb(0%,0%,100%)} +TD.requirements A:visited {color: rgb(100%,100%,65%)} +TD.skip A {font-size: large; text-decoration: none} + +SELECT { font-family: monospace; } + +#permalink,#jump_to_results { + font-size: 0.5em; + font-weight: normal; +} +#permalink::before,#jump_to_results::before{ + content: "(" +} +#permalink::after,#jump_to_results::after{ + content: ")" +} + +TABLE.result TD > a.package_name { + color: black; + font-weight: bold; +} diff --git a/Maintenance/test_handling/filter_testsuite/to_zipped_format b/Maintenance/test_handling/filter_testsuite/to_zipped_format new file mode 100755 index 000000000000..d8c7c1cd433b --- /dev/null +++ b/Maintenance/test_handling/filter_testsuite/to_zipped_format @@ -0,0 +1,232 @@ +#!/usr/bin/env perl + +use Cwd; +use strict; + +my $TMPDIR; +my $version = ""; +my $final_version; + +my $original_arguments=join(" ", @ARGV); + +sub print_log +{ + print TESTRESULTSLOG (@_); +} + +sub print_log_err +{ + print TESTRESULTSLOG (@_); + print STDERR (@_); +} + +sub usage { + print STDERR "$0: usage\n"; + print STDERR "$0 [-v version] result1.tar[.gz] ...\n"; + print STDERR "$0: you called it with the arguments:\n"; + print STDERR "$0 $original_arguments\n"; +} + +sub make_tempdir() +{ + my $dirno = 1; + $TMPDIR = "TMP$dirno"; + while ( -f $TMPDIR or -d $TMPDIR ) { + ++$dirno; + $TMPDIR = "TMP$dirno"; + } + mkdir($TMPDIR,0770) or die "Cannot create temporary directory $TMPDIR\n"; +} + +sub reformat_results($) +{ + $_ = shift; + s/\.tar//; + my $platform = $_; +# system("dos2unix ${platform}.txt ${platform}.txt"); + open (PLATFORM_RESULTS,"<${platform}.txt") or return; + my $line; + while ( ($line = ) && /^\s*$/) { + } + $_ = $line; + open (PLATFORM_INFO,">${platform}.info") or return; + open (PLATFORM_NEW_RESULTS,">${platform}.new_results") or return; + my ($CGAL_VERSION,$LEDA_VERSION,$COMPILER,$TESTER_NAME,$TESTER_ADDRESS,$GMP,$MPFR,$ZLIB,$OPENGL,$BOOST,$QT,$QT4,$QT5,$CMAKE) = ("-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","no"); + my ($LDFLAGS,$CXXFLAGS) = ("", ""); + while (! /^------/) { + if(/^\s*$/) { + goto NEXT; + } + if(/^-- USING CMake version: ([\w\.-]+)/) { + $CMAKE = $1; + } + if (/^CGAL_VERSION\s+([\w\.-]+)/) { + $CGAL_VERSION = $1; + } + if (/LEDA_VERSION = '([^']+)'/) { + $LEDA_VERSION="$1"; + } + if (/LEDAWIN_VERSION = '([^']+)'/) { + $LEDA_VERSION="$LEDA_VERSION+win"; + } + if (/COMPILER_VERSION = '([^']+)'/) { + $COMPILER = $1; + } + if (/^TESTER_NAME\s+(.*)$/) { + $TESTER_NAME = $1; + } + if (/^TESTER_ADDRESS\s+(.*)$/) { + $TESTER_ADDRESS = $1; + } + if (/MPFR_VERSION = '([^']+)'/) { + $MPFR="$1"; + } + if (/ZLIB_VERSION = '([^']+)'/) { + $ZLIB="$1"; + } + if (/OPENGL_VERSION = '([^']+)'/) { + $OPENGL="$1"; + } + if (/GMP_VERSION = '([^']+)'/) { + $GMP="$1"; + } + if (/GMPXX_VERSION = '([^']+)'/) { + $GMP="$GMP+gmpxx"; + } + if (/QT_VERSION = '([^']+)'/) { + $QT="$1"; + } + if (/QT4_VERSION = '([^']+)'/) { + $QT4="$1"; + } + if (/Qt5_VERSION = '([^']+)'/) { + $QT5="$1"; + } + if (/BOOST_VERSION = '([^']+)'/) { + $BOOST="$1"; + } +# if (/BOOST_THREAD_VERSION = '([^']+)'/) { +# $BOOST="$BOOST+thread"; +# } +# if (/BOOST_PROGRAM_OPTIONS_VERSION = '([^']+)'/) { +# $BOOST="$BOOST+program_options"; +# } +# if (/BOOST_BIMAP_VERSION = '([^']+)'/) { +# $BOOST="$BOOST+bimap"; +# } + if (/USING +CXXFLAGS = '([^']*)'/) { + $CXXFLAGS="$CXXFLAGS $1"; + } + if (/USING +LDFLAGS = '([^']*)'/) { + $LDFLAGS="$LDFLAGS $1"; + } +# if(/^CGAL_TEST_PLATFORM /) { +# # should be the last one of the header +# last; +# } +# if(! /^[A-Z][a-z]/ ) { +# # the header is finished +# print PLATFORM_NEW_RESULTS $_; +# last; +# } +NEXT: if(! ($_= )) { + # should never happen!! + last; + } + } + while () { + print PLATFORM_NEW_RESULTS $_; + } + rename("${platform}.new_results","${platform}.txt") or die "cannot rename!"; + print PLATFORM_INFO <<"EOF"; +$CGAL_VERSION +$COMPILER +$TESTER_NAME +$TESTER_ADDRESS +$CMAKE +$BOOST +$MPFR +$GMP +$QT5 +$LEDA_VERSION +$CXXFLAGS +$LDFLAGS +EOF + close(PLATFORM_INFO); + close(PLATFORM_RESULTS); + close(PLATFORM_NEW_RESULTS); + $final_version="CGAL-$CGAL_VERSION"; + if ($version + && $version ne "CGAL-$CGAL_VERSION" + && ($version !~ /^CGAL-${CGAL_VERSION}-Ic?-[\d]+$/)) { + die "Wrong version in $platform: $CGAL_VERSION instead of $version.\n"; + } +} + +sub one_archive($) +{ + my $archive = shift; + if (! -f $archive) { + print STDERR "$archive is not a valid filename\n"; + return 0; + } + if ( $archive =~ m/\.gz$/ ) { + system("gunzip", "$archive") == 0 or return 0; + $archive =~ s/\.gz$//; + } + if ( $archive =~ m/.*\.tgz$/ ) { + system("gunzip", "$archive") == 0 or return 0; + $archive =~ s/\.tgz$/.tar/; + } + if ( $archive !~ /\.tar$/) { + print STDERR "$0: $archive not a tar file\n"; + return 0; + } + make_tempdir(); + rename("$archive","$TMPDIR/$archive") or die "cannot rename(\"$archive\",\"$TMPDIR/$archive\")"; + chdir("$TMPDIR") or die "cannot chdir"; + system("gtar", "xf", "$archive") == 0 or die "cannot untar $archive"; + unlink($archive); + + reformat_results($archive); + system('gzip',glob("*/*")) == 0 or die "cannot gzip (while processing $archive)"; + system('chmod','-R','a+r,og+w','.') == 0 or die "cannot chmod"; + system('tar', 'cf', "../$archive", glob("*")) == 0 or die "cannot tar"; + chdir('..') or die; + system('rm', '-rf', "$TMPDIR")== 0 or die "cannot rm -rf"; + return 1; +} + +sub all_archives() { + my $archive; + foreach $archive (@ARGV) { + if (one_archive($archive)) { + my $date=`date`; + chop $date; + print_log("$final_version : $archive successfully reformatted. [ $date ]\n"); + } else { + print_log_err("$final_version : Could not reformat $archive\n"); + } + } +} + +if ($#ARGV < 0) { + usage; + exit 1; +} + +if ($ARGV[0] eq "-v") { + shift; + $version = shift; +} + +if ($#ARGV < 0) { + usage; + exit 1; +} + +open (TESTRESULTSLOG, ">>../test_results.log") + or die "Could not open test_results.log\n"; +all_archives(); +close (TESTRESULTSLOG); +exit 0; diff --git a/Maintenance/test_handling/filter_testsuite/treat_result_collection b/Maintenance/test_handling/filter_testsuite/treat_result_collection new file mode 100755 index 000000000000..7369f88a7a47 --- /dev/null +++ b/Maintenance/test_handling/filter_testsuite/treat_result_collection @@ -0,0 +1,185 @@ +#!/usr/bin/env perl + +use Cwd; +use strict; + +#$ENV{PATH}= +#'/sw/bin:/sbin:/usr/sbin:/usr/bsd:/bin:/usr/bin'; + + + +my $currentdir=cwd(); + +my $scriptsdir; +my $unpack_dir_base; +my $unpack_dir; +my $testresult_dir; +my $lockfile="cgal_testannounce.lock"; +#my $announcements_dir="/private/CGAL/testannouncements"; +my $announcements_dir="/u/termite/0/user/spion/CGAL/testannouncements"; +my $lock_cmd= "/usr/local/bin/lockfile"; +my $ftp_results_dir="$currentdir/incoming/"; +my $check_file="processed_test_results"; + +my ($cgal_version,$tarname,@results); + +$testresult_dir="$currentdir/TESTRESULTS"; +$scriptsdir="$currentdir"; +$unpack_dir_base="$currentdir"; + + +sub make_unpackdir() +{ + my $dirno = 1; + my $TMPDIR; + $TMPDIR = "$unpack_dir_base/TMP$dirno"; + while ( -f $TMPDIR or -d $TMPDIR ) { + ++$dirno; + $TMPDIR = "$unpack_dir_base/TMP$dirno"; + } + mkdir($TMPDIR,0770) or die "Cannot create temporary directory $TMPDIR\n"; + $unpack_dir = $TMPDIR; +} + +sub unpack_results{ + chdir $unpack_dir or die; + my $filename="$ftp_results_dir/$_[0]"; + system "cp $ftp_results_dir/$_[0] $_[0]"; + system "chmod 644 $_[0]"; + system("gunzip", "$_[0]")== 0 + or die "Could not gunzip $_[0]\n"; + @results=grep /tar$|tar\.gz$/, `tar tf ${tarname}`; + chomp @results; + system("tar", "xf", ${tarname}, @results); + if( ($? != 0) || (@results == 0) ) { + print TESTRESULTSLOG "(EE) Cannot read tar file \"${tarname}\"!\n"; + } + else { + print TESTRESULTSLOG "(II) Processing tar file \"${tarname}\"...\n"; + system("$scriptsdir/to_zipped_format", "-v", $cgal_version, @results)==0 + or die "to_zipped_format failed on \"$filename\". Test collection not installed.\n"; + } +} + + +sub install_results() +{ + if (-d $testresult_dir) { + chdir $testresult_dir or die; + } else { + mkdir $testresult_dir or die; + chdir $testresult_dir or die; + } + if (-d $cgal_version) { + chdir $cgal_version or die; + } else { + mkdir $cgal_version or die; + chdir $cgal_version or die; + } + my $resultfile; + for $resultfile (@results) { + $resultfile =~ s/\.gz//; + system('tar','--force-local','-xf',"${unpack_dir}/${resultfile}")==0 or die; +# unlink "${unpack_dir}/$resultfile"; + } + chdir ".." or die; +# system("./create_testresult_page", $cgal_version); + +# clean up stuff in UNPACK_DIR + + chdir $unpack_dir or die; +# unlink $tarname; +# notify(); + +} + +# Save the content of $check_file in the hash %check_file_content, to avoid +# opening, reading, and closing that file at every call of the function +# `exist_in_file` (called thousands of times) +my %check_file_content; +open my $fh, $check_file || die ("Could not open $check_file"); +while (my $contents = <$fh>){ + chop $contents; + $check_file_content{$contents} = 1; +} +close $fh; + +#return 0 if it exists and 1 otherwise +sub exist_in_file{ + if ( $check_file_content{$_[0]} == 1) { + return 0; + } else { + return 1; + } +} + + +#first argument is a string +sub append_to_file{ + chdir($currentdir); + + if ( -w $check_file ) { + open FILE, ">> $check_file" || die ("Could not open $check_file"); + } else { + open FILE, "> $check_file" || die ("Could not open $check_file"); + } + print FILE "$_[0]\n"; + close FILE; +} + + +open (TESTRESULTSLOG, ">>", "./test_results.log") + or die "Could not open test_results.log\n"; + +my $dir_h; +my $i; +my $is_good; +my $res; +chdir($currentdir) || die("Could not chdir to $currentdir"); +opendir($dir_h, $ftp_results_dir) || die("The ftp directory could no be opened"); +while( $i=readdir($dir_h)){ + next if($i eq "."); + next if ($i eq ".."); + $is_good=1; + if ( $i =~ m/^(CGAL-\d+\.\d+-Ic?-\d+)[-_]/ ) { + $cgal_version=$1; + } else { + if ( $i =~ m/^(CGAL-\d+\.\d+\.\d+-Ic?-\d+)[-_]/ ) { + $cgal_version=$1; + } else { + if ( $i =~ m/^(CGAL-\d+\.\d+\.\d+)[-_]/ ) { + $cgal_version=$1; + } else { + if ( $i =~ m/^(CGAL-\d+\.\d+)[-_]/ ) { + $cgal_version=$1; + } else { + # die "$i is not a valid name for a testresult collection.\n"; + $is_good=0; + } + } + } + } + if ( $is_good == 1 ){ + if ( -s "$ftp_results_dir/$i" && + exist_in_file($i) == 1 && + system("fuser", "$ftp_results_dir/$i") != 0 ){ + system "cp $ftp_results_dir/$i $i"; + system "chmod 644 $i"; + $res = system "gunzip -t $i"; + system "rm -rf $i"; + if ( $res == 0 ){ + append_to_file($i); + $tarname=`basename $i .gz`; + chomp $tarname; + make_unpackdir(); + eval {unpack_results($i)} && eval{install_results()}; + $@ && warn $@; + chdir($unpack_dir_base); + system('rm','-rf',$unpack_dir); + system "./create_testresult_page $cgal_version"; + } + } + } +} +closedir($dir_h); +close (TESTRESULTSLOG); diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index a19a6ca4ee71..175788377313 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -58,7 +58,7 @@ echo "starting testsuite..." ./autotest_cgal -c -if [ -n "$4" ]; then +if [ "$4" = "y" ]; then cd ${CGAL_ROOT} V=$(cat VERSION_NUMBER) V=$(($V+1)) diff --git a/Testsuite/test/collect_cgal_testresults_from_cmake b/Testsuite/test/collect_cgal_testresults_from_cmake index 23a0741df382..54b5d502ce0b 100755 --- a/Testsuite/test/collect_cgal_testresults_from_cmake +++ b/Testsuite/test/collect_cgal_testresults_from_cmake @@ -30,7 +30,10 @@ RESULT_FILE='' # print timings on fd3 print_testresult() { - if [ ! -f ErrorOutput_$1 ] ; then + if [ -f skipped ]; then + RESULT="s" + TIMING="0" + elif [ ! -f ErrorOutput_$1 ] ; then RESULT="?" TIMING="?" else From 5a20cf1c94212e02b0392d89b73f8fa0e9ad48e7 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 23 Jul 2021 14:18:13 +0200 Subject: [PATCH 04/18] clean-up --- Scripts/developer_scripts/autotest_cgal | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal index 4ad3e7b8b1a9..e0b985e03392 100755 --- a/Scripts/developer_scripts/autotest_cgal +++ b/Scripts/developer_scripts/autotest_cgal @@ -628,8 +628,8 @@ if [ -f '${LIST_TEST_PACKAGES}' ]; then cp '${CGAL_TEST_DIR}/makefile2' '${CGAL_BINARY_DIR}/test' cp '${CGAL_TEST_DIR}/run_testsuite_with_cmake' '${CGAL_BINARY_DIR}/test' -# list all packages in CGAL_TEST_DIR. If PACKAGE is found in LIST_TEST_PACKAGES, -# copy it, else prepare for the special "skipped" case in the table. + # list all packages in CGAL_TEST_DIR. If PACKAGE is found in LIST_TEST_PACKAGES, + # copy it, else prepare for the special "skipped" case in the table. for PACKAGE in \$(ls "${CGAL_TEST_DIR}"); do if [ -d "${CGAL_TEST_DIR}/\$PACKAGE" ]; then if source '${LIST_TEST_PACKAGES}' '${CGAL_ROOT}' | egrep -q \$PACKAGE; then @@ -643,6 +643,7 @@ if [ -f '${LIST_TEST_PACKAGES}' ]; then touch "${CGAL_BINARY_DIR}/test/\${PACKAGE}/skipped" fi fi + done else @@ -770,7 +771,6 @@ run_test_on_host() fi for PLATFORM in ${PLATFORMS}; do - run_test_on_host_and_platform "${HOST}" "${PLATFORM}" publish_results "${HOST}" "${PLATFORM}" done @@ -988,4 +988,3 @@ rm -f "$LOCK_FILE"; ## Local Variables: ## sh-basic-offset: 2 ## End: - From f26796488911911ac96327b6bb07b534159f8214 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 26 Jul 2021 12:24:32 +0200 Subject: [PATCH 05/18] Fix list_test_packages --- .../run_testsuite_from_branch_name.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index 175788377313..6ed259be1665 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -32,9 +32,17 @@ git fetch --depth 1 $USER_REPO git checkout $BRANCH_NAME git reset --hard $USER_REPO/$BRANCH_NAME #setup the list_test_packages -LIST_OF_PKGS=$(git diff --name-only HEAD cgal/$BASE_NAME |cut -s -d/ -f1 |sort -u | xargs -I {} ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true) +TMP_LIST=$(git diff --name-only HEAD cgal/$BASE_NAME |cut -s -d/ -f1 |sort -u | xargs -I {} ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true) +LIST_OF_PKGS="" +for PKG in $(ls) ; do + if [ -f $PKG/package_info/$PKG/dependencies ]; then + if [ -n "$(comm -12 <(echo "$LIST_OF_PKGS"|sort) <(cat $PKG/package_info/$PKG/dependencies|sort))" ]; then + LIST_OF_PKGS="$LIST_OF_PKGS $PKG" + fi + fi +done +if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi if [ "$LIST_OF_PKGS" != "" ]; then - if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi for f in $LIST_OF_PKGS do echo "echo \"$f\"" >> ${CGAL_ROOT}/list_test_packages From 4acf4ca6336491064c61d343f61e48817ee6c0ff Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 26 Jul 2021 14:56:48 +0200 Subject: [PATCH 06/18] test CGAL_VERSION value --- .github/workflows/filter_testsuite.yml | 10 +++------ .../run_testsuite_from_branch_name.sh | 21 +++++++++---------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/.github/workflows/filter_testsuite.yml b/.github/workflows/filter_testsuite.yml index 3c2e6364c053..3104da560bae 100644 --- a/.github/workflows/filter_testsuite.yml +++ b/.github/workflows/filter_testsuite.yml @@ -73,18 +73,14 @@ jobs: LABEL="${{ steps.get_label.outputs.result }}" USER_NAME=$(echo $LABEL | cut -d':' -f 1) BRANCH_NAME=$(echo $LABEL | cut -d':' -f 2) + PR_NUMBER=$(python -c "import json; import os; y = json.load(open(os.environ['GITHUB_EVENT_PATH'])); print(y[\"number\"])") BASE="${{ steps.get_base.outputs.result }}" mapfile -t HOSTS < ~/ssh_host_list; for i in ${!HOSTS[@]}; do HOST=$(echo ${HOSTS[$i]}|cut -d' ' -f 1 ) PATH_TO_SCRIPT=$(echo ${HOSTS[$i]}|cut -d' ' -f 2 ) - if [ "$i" = "0" ] ; then - echo "ssh ${HOST} ${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" - ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y" - else - echo "ssh ${HOST} ${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE" - ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE" - fi + echo "ssh ${HOST} ${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE $PR_NUMBER" + ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE $PR_NUMBER" done - name: Post address uses: actions/github-script@v3 diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index 6ed259be1665..5f3883a005a4 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -3,7 +3,7 @@ #To run: $1 = name of the user # $2 = name of the branch # $3 = base ref name (master, 5.1.x, 5.2.x, etc...) -# $4 = if given, update the VERSION_NUMBER +# $4 = number of the PR if uname | grep -q -i cygwin; then @@ -16,8 +16,9 @@ echo "CGAL_ROOT = $CGAL_ROOT" > log USER_REPO=$1 BRANCH_NAME=$2 BASE_NAME=$3 +PR_NUMBER=$4 + cd ${CGAL_ROOT} -scp ${VERSION_NUMBER_SSH_URL} . cd ${CGAL_GIT_DIR} if [ ! -d cgal ]; then git clone --depth 1 --no-single-branch https://github.com/CGAL/cgal.git @@ -26,6 +27,9 @@ if [ ! -d cgal ]; then cd .. fi cd cgal +CGAL_VERSION="CGAL-$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define CGAL_VERSION " Installation/include/CGAL/version.h))-${PR_NUMBER}" +echo $CGAL_VERSION > log +exit 0 git fetch --depth 1 cgal git remote add $USER_REPO https://github.com/$USER_REPO/cgal.git git fetch --depth 1 $USER_REPO @@ -53,8 +57,10 @@ fi ( #create the release from the branch echo " Create release..." -echo "CGAL_VERSION=0.0-Ic-$(cat ${CGAL_ROOT}/VERSION_NUMBER)"> log -cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=0.0-Ic-$(cat ${CGAL_ROOT}/VERSION_NUMBER) -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log +CGAL_VERSION="CGAL-$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define CGAL_VERSION " Installation/include/CGAL/version.h))-${PR_NUMBER}" + +echo "CGAL_VERSION = ${CGAL_VERSION}"> log +cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=${CGAL_VERSION} -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log echo "done." DEST=$(sed -E 's/.*CGAL-TEST\/(.*)/\1/' log); @@ -66,13 +72,6 @@ echo "starting testsuite..." ./autotest_cgal -c -if [ "$4" = "y" ]; then - cd ${CGAL_ROOT} - V=$(cat VERSION_NUMBER) - V=$(($V+1)) - echo $V > VERSION_NUMBER - scp VERSION_NUMBER ${VERSION_NUMBER_SSH_URL} -fi )>${CGAL_ROOT}/autotest.log2 2>&1 & echo "finished." From 30a43908a92ff6433346f387317abadc1ce5d522 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 10:47:04 +0200 Subject: [PATCH 07/18] test CGAL_VERSION value --- .github/workflows/filter_testsuite.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/filter_testsuite.yml b/.github/workflows/filter_testsuite.yml index 3104da560bae..2c2bc279eeb9 100644 --- a/.github/workflows/filter_testsuite.yml +++ b/.github/workflows/filter_testsuite.yml @@ -45,6 +45,15 @@ jobs: const base = pr_content.data.base.ref console.log(base) return base + - uses: actions/github-script@v3 + if: steps.get_round.outputs.result != 'stop' + id: get_pr_number + with: + result-encoding: string + script: | + //get pullrequest url + const pr_number = context.payload.issue.number + return pr_number - name: Run Testsuite if: steps.check.outputs.result != 'stop' run: | @@ -66,14 +75,14 @@ jobs: #known hosts wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_known_hosts -O ~/.ssh/known_hosts #config file - wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_config -O ~/.ssh/config + wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_config -O ~/.ssh/config #list of hosts wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_host_list -O ~/ssh_host_list #ssh command LABEL="${{ steps.get_label.outputs.result }}" USER_NAME=$(echo $LABEL | cut -d':' -f 1) BRANCH_NAME=$(echo $LABEL | cut -d':' -f 2) - PR_NUMBER=$(python -c "import json; import os; y = json.load(open(os.environ['GITHUB_EVENT_PATH'])); print(y[\"number\"])") + PR_NUMBER=${{ steps.get_pr_number.outputs.result }} BASE="${{ steps.get_base.outputs.result }}" mapfile -t HOSTS < ~/ssh_host_list; for i in ${!HOSTS[@]}; do From e2e9f7385d89f34d2ba68b2f09cf2a62c4e4c869 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 10:43:54 +0200 Subject: [PATCH 08/18] Use a queue --- .../run_testsuite_from_branch_name.sh | 46 ++++++++++++++++--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index 5f3883a005a4..80fb48724325 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -12,7 +12,35 @@ if uname | grep -q -i cygwin; then set -o igncr fi source ~/.autofilterrc -echo "CGAL_ROOT = $CGAL_ROOT" > log + + + + +queue_insert (){ +echo "$1 $2 $3 $4">>$CGAL_ROOT/queue_file +if [ ! -f running ];then + execute $1 $2 $3 $4 +fi +} + +queue_pop(){ +mv queue_file tmp + egrep -v "$1 $2 $3 $4" tmp>$CGAL_ROOT/queue_file + if [ "$( log -exit 0 git fetch --depth 1 cgal git remote add $USER_REPO https://github.com/$USER_REPO/cgal.git git fetch --depth 1 $USER_REPO @@ -54,11 +79,9 @@ if [ "$LIST_OF_PKGS" != "" ]; then echo "echo \"${f}_Demo\"" >> ${CGAL_ROOT}/list_test_packages done fi -( #create the release from the branch echo " Create release..." CGAL_VERSION="CGAL-$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define CGAL_VERSION " Installation/include/CGAL/version.h))-${PR_NUMBER}" - echo "CGAL_VERSION = ${CGAL_VERSION}"> log cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=${CGAL_VERSION} -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log echo "done." @@ -72,8 +95,17 @@ echo "starting testsuite..." ./autotest_cgal -c -)>${CGAL_ROOT}/autotest.log2 2>&1 & echo "finished." +queue_pop $1 $2 $3 $4 +} + + +( +cd $CGAL_ROOT +queue_insert $1 $2 $3 $4 + +)>${CGAL_ROOT}/autotest.log2 2>&1 & + echo "exit." exit 0 From 477f7231b3e329f23f576ff90fbb5aa4ccbf24b1 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 11:11:36 +0200 Subject: [PATCH 09/18] Don't use a queue file after all --- .../run_testsuite_from_branch_name.sh | 40 +------------------ 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index 80fb48724325..d0a79a7d2a4d 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -12,35 +12,8 @@ if uname | grep -q -i cygwin; then set -o igncr fi source ~/.autofilterrc - - - - -queue_insert (){ -echo "$1 $2 $3 $4">>$CGAL_ROOT/queue_file -if [ ! -f running ];then - execute $1 $2 $3 $4 -fi -} - -queue_pop(){ -mv queue_file tmp - egrep -v "$1 $2 $3 $4" tmp>$CGAL_ROOT/queue_file - if [ "$(${CGAL_ROOT}/autotest.log2 2>&1 & - echo "exit." exit 0 From 02152abfee06096a82b7f8f51694d2991652bfad Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 11:31:26 +0200 Subject: [PATCH 10/18] Fix CGAL_VERSION --- Scripts/developer_scripts/run_testsuite_from_branch_name.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index d0a79a7d2a4d..6c85febdd81c 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -54,7 +54,7 @@ if [ "$LIST_OF_PKGS" != "" ]; then fi #create the release from the branch echo " Create release..." -CGAL_VERSION="CGAL-$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define CGAL_VERSION " Installation/include/CGAL/version.h))-${PR_NUMBER}" +CGAL_VERSION="$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define CGAL_VERSION " Installation/include/CGAL/version.h))-Ic-${PR_NUMBER}" echo "CGAL_VERSION = ${CGAL_VERSION}"> log cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=${CGAL_VERSION} -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log echo "done." From ab0a35be168bf6b73f98443739b145976917a63e Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 12:03:38 +0200 Subject: [PATCH 11/18] debug liste --- Scripts/developer_scripts/run_testsuite_from_branch_name.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index 6c85febdd81c..bdd61fc61633 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -11,9 +11,8 @@ if uname | grep -q -i cygwin; then export SHELLOPTS set -o igncr fi -source ~/.autofilterrc ( -cd $CGAL_ROOT +source ~/.autofilterrc USER_REPO=$1 BRANCH_NAME=$2 BASE_NAME=$3 @@ -44,6 +43,7 @@ for PKG in $(ls) ; do fi done if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi +echo "list of pkgs = $LIST_OF_PKGS">log if [ "$LIST_OF_PKGS" != "" ]; then for f in $LIST_OF_PKGS do From 7ee8667058091434c3d298fcb7172758b62b6e00 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 12:37:50 +0200 Subject: [PATCH 12/18] debuf list --- Scripts/developer_scripts/run_testsuite_from_branch_name.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index bdd61fc61633..39c1ce851042 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -43,7 +43,7 @@ for PKG in $(ls) ; do fi done if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi -echo "list of pkgs = $LIST_OF_PKGS">log +echo "list of pkgs = $LIST_OF_PKGS">${CGAL_ROOT}/log if [ "$LIST_OF_PKGS" != "" ]; then for f in $LIST_OF_PKGS do From 352cb7b9be89935272f5f61f61900b85c9b904ec Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 12:48:06 +0200 Subject: [PATCH 13/18] plus --- Scripts/developer_scripts/run_testsuite_from_branch_name.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index 39c1ce851042..a4c2edeaccc3 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -18,7 +18,7 @@ BRANCH_NAME=$2 BASE_NAME=$3 PR_NUMBER=$4 -cd ${CGAL_ROOT} + cd ${CGAL_GIT_DIR} if [ ! -d cgal ]; then git clone --depth 1 --no-single-branch https://github.com/CGAL/cgal.git @@ -43,7 +43,7 @@ for PKG in $(ls) ; do fi done if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi -echo "list of pkgs = $LIST_OF_PKGS">${CGAL_ROOT}/log +echo "list of pkgs = ${LIST_OF_PKGS}">${CGAL_ROOT}/log if [ "$LIST_OF_PKGS" != "" ]; then for f in $LIST_OF_PKGS do @@ -55,10 +55,10 @@ fi #create the release from the branch echo " Create release..." CGAL_VERSION="$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define CGAL_VERSION " Installation/include/CGAL/version.h))-Ic-${PR_NUMBER}" -echo "CGAL_VERSION = ${CGAL_VERSION}"> log cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=${CGAL_VERSION} -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log echo "done." DEST=$(sed -E 's/.*CGAL-TEST\/(.*)/\1/' log); +echo "CGAL_VERSION = ${CGAL_VERSION}"> log cd ${CGAL_ROOT} From dec96f5dd8f48b26d60b091f39551d48533ef8d7 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 12:52:02 +0200 Subject: [PATCH 14/18] fix sourcing --- Scripts/developer_scripts/run_testsuite_from_branch_name.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index a4c2edeaccc3..125b2035d314 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -11,8 +11,8 @@ if uname | grep -q -i cygwin; then export SHELLOPTS set -o igncr fi -( source ~/.autofilterrc +( USER_REPO=$1 BRANCH_NAME=$2 BASE_NAME=$3 From 2a861a7fd17caddb5373ca401230fa4890588037 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 12:54:44 +0200 Subject: [PATCH 15/18] Fix list_of_pkgs --- Scripts/developer_scripts/run_testsuite_from_branch_name.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index 125b2035d314..dfd843a4e93a 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -34,10 +34,11 @@ git checkout $BRANCH_NAME git reset --hard $USER_REPO/$BRANCH_NAME #setup the list_test_packages TMP_LIST=$(git diff --name-only HEAD cgal/$BASE_NAME |cut -s -d/ -f1 |sort -u | xargs -I {} ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true) + LIST_OF_PKGS="" for PKG in $(ls) ; do if [ -f $PKG/package_info/$PKG/dependencies ]; then - if [ -n "$(comm -12 <(echo "$LIST_OF_PKGS"|sort) <(cat $PKG/package_info/$PKG/dependencies|sort))" ]; then + if [ -n "$(comm -12 <(echo "$TMP_LIST"|sort) <(cat $PKG/package_info/$PKG/dependencies|sort))" ]; then LIST_OF_PKGS="$LIST_OF_PKGS $PKG" fi fi From 22a61aaa00f9cd07e126cbea228fedd84c9b869f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Jul 2021 13:53:15 +0200 Subject: [PATCH 16/18] remove debug --- Scripts/developer_scripts/run_testsuite_from_branch_name.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh index dfd843a4e93a..675ea0020d80 100644 --- a/Scripts/developer_scripts/run_testsuite_from_branch_name.sh +++ b/Scripts/developer_scripts/run_testsuite_from_branch_name.sh @@ -44,7 +44,6 @@ for PKG in $(ls) ; do fi done if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi -echo "list of pkgs = ${LIST_OF_PKGS}">${CGAL_ROOT}/log if [ "$LIST_OF_PKGS" != "" ]; then for f in $LIST_OF_PKGS do @@ -59,7 +58,6 @@ CGAL_VERSION="$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=${CGAL_VERSION} -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log echo "done." DEST=$(sed -E 's/.*CGAL-TEST\/(.*)/\1/' log); -echo "CGAL_VERSION = ${CGAL_VERSION}"> log cd ${CGAL_ROOT} From f9e2b630e97ed76b45dfd82164dcc074cb13b4c1 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 30 Jul 2021 13:20:03 +0200 Subject: [PATCH 17/18] CLea-up and simplify --- .github/workflows/filter_testsuite.yml | 47 ++++---------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/.github/workflows/filter_testsuite.yml b/.github/workflows/filter_testsuite.yml index 2c2bc279eeb9..ba7b4a8792a4 100644 --- a/.github/workflows/filter_testsuite.yml +++ b/.github/workflows/filter_testsuite.yml @@ -9,20 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/github-script@v3 - id: check - with: - result-encoding: string - script: | - const userName = context.payload.comment.user.login - if(userName == 'maxGimeno') { - const body = context.payload.comment.body - if(body.includes("/testme")) { - return 'OK' - } - } - return 'stop' - - uses: actions/github-script@v3 - if: steps.check.result != 'stop' + if: github.event.comment.user.login == 'maxGimeno' && contains(github.event.comment.body, '/testme') id: get_label with: result-encoding: string @@ -31,31 +18,11 @@ jobs: const pr_url = context.payload.issue.pull_request.url const pr_content = await github.request(pr_url) const label = pr_content.data.head.label - console.log(label) - return label - - uses: actions/github-script@v3 - if: steps.check.result != 'stop' - id: get_base - with: - result-encoding: string - script: | - //get branch name and username - const pr_url = context.payload.issue.pull_request.url - const pr_content = await github.request(pr_url) const base = pr_content.data.base.ref - console.log(base) - return base - - uses: actions/github-script@v3 - if: steps.get_round.outputs.result != 'stop' - id: get_pr_number - with: - result-encoding: string - script: | - //get pullrequest url - const pr_number = context.payload.issue.number - return pr_number + console.log(label) + return label+":"+base - name: Run Testsuite - if: steps.check.outputs.result != 'stop' + if: github.event.comment.user.login == 'maxGimeno' && contains(github.event.comment.body, '/testme') run: | mkdir -p ~/.ssh #ssh key @@ -82,8 +49,8 @@ jobs: LABEL="${{ steps.get_label.outputs.result }}" USER_NAME=$(echo $LABEL | cut -d':' -f 1) BRANCH_NAME=$(echo $LABEL | cut -d':' -f 2) - PR_NUMBER=${{ steps.get_pr_number.outputs.result }} - BASE="${{ steps.get_base.outputs.result }}" + BASE=$(echo $LABEL | cut -d':' -f 3) + PR_NUMBER=${{ github.event.issue.number }} mapfile -t HOSTS < ~/ssh_host_list; for i in ${!HOSTS[@]}; do HOST=$(echo ${HOSTS[$i]}|cut -d' ' -f 1 ) @@ -93,7 +60,7 @@ jobs: done - name: Post address uses: actions/github-script@v3 - if: steps.check.outputs.result != 'stop' + if: github.event.comment.user.login == 'maxGimeno' && contains(github.event.comment.body, '/testme') with: script: | const address = "The testsuite is lauched. results will be found, after it is done, here : https://cgal.geometryfactory.com/~mgimeno/test_suite/TESTRESULTS/index.shtml " From 618b439d9a0f557a6226e5122e04dfb3409083e2 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 30 Jul 2021 14:25:34 +0200 Subject: [PATCH 18/18] Factorize condition --- .github/workflows/filter_testsuite.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/filter_testsuite.yml b/.github/workflows/filter_testsuite.yml index ba7b4a8792a4..3748df82818a 100644 --- a/.github/workflows/filter_testsuite.yml +++ b/.github/workflows/filter_testsuite.yml @@ -6,10 +6,10 @@ on: jobs: build: + if: github.event.comment.user.login == 'maxGimeno' && contains(github.event.comment.body, '/testme') runs-on: ubuntu-latest steps: - uses: actions/github-script@v3 - if: github.event.comment.user.login == 'maxGimeno' && contains(github.event.comment.body, '/testme') id: get_label with: result-encoding: string @@ -22,7 +22,6 @@ jobs: console.log(label) return label+":"+base - name: Run Testsuite - if: github.event.comment.user.login == 'maxGimeno' && contains(github.event.comment.body, '/testme') run: | mkdir -p ~/.ssh #ssh key @@ -60,7 +59,6 @@ jobs: done - name: Post address uses: actions/github-script@v3 - if: github.event.comment.user.login == 'maxGimeno' && contains(github.event.comment.body, '/testme') with: script: | const address = "The testsuite is lauched. results will be found, after it is done, here : https://cgal.geometryfactory.com/~mgimeno/test_suite/TESTRESULTS/index.shtml "