From 72c1958ee9b7c137461214e97554a7404cd4f8e6 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 7 May 2020 21:51:45 -0500 Subject: [PATCH] update script to new api/v1 interface --- contrib/utilities/query_testsuite | 52 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/contrib/utilities/query_testsuite b/contrib/utilities/query_testsuite index be0e53902e..b69414c281 100755 --- a/contrib/utilities/query_testsuite +++ b/contrib/utilities/query_testsuite @@ -15,13 +15,13 @@ ## --------------------------------------------------------------------- set -eu -BASE_URL="https://cdash.43-1.org/" +BASE_URL="https://cdash.43-1.org" # Quick and dirty script to query CDash on the command line and create a # formatted table links=false -regex="commit" +regex=".*" print_help() { echo "Usage: query_testsuite [-c|--commit ] [-l|--links] [-h|--help]" @@ -52,31 +52,29 @@ until [[ "$*" == "" ]]; do done query_testsuite() { - (echo "| Host | Configuration | Commit | Build errors | Build warnings | Failing tests | Passing tests | |"; - echo -n "| - | - | - | :-: | :-: | :-: | :-:"; - curl -s "${BASE_URL}/index.php?project=deal.II" | - grep -P -B 10 -A 43 "${regex}" | - grep -P "(only(failed|passed)|BuildError|commit|platform|site)" | - grep -v "onlydelta" | - sed -e "s#\\([0-9]*\\)#[\\2](${BASE_URL}\\1)#" \ - -e "s#\\(.*\\) #[\\2](\\1)#" \ - -e "s#.*\\(buildSummary.php?buildid=[0-9]*\\)\"[^>]*>\\([^<]*\\).*#[\\2](${BASE_URL}\\1)#" \ - -e 's###g' \ - -e 's#.*>##g' | - awk '{printf (NR%7==1) ? " |\n| " $0 : " | " $0}' | - sed -e "s#\\(.*buildid=\\([0-9]*\\).*\\)#\\2 \\1#" | - sort -n -k 1 | - sed -e "s#[0-9 ]*\\(.*\\)#\\1#" | - if $links; then - cat - else - sed -e 's#\[\([^]]*\)\]([^)]*)#\1#g' - fi) | - sed -e 's#\[\(0*\)\]([^)]*)#\1#g' \ - -e 's#\[\([^]]*\)\]([^)]*onlypassed[^)]*)#\1#g' \ - -e 's#\[\([0-9]*\)\]#[\1]#g' \ - -e 's#[ ]\+# #g' | - column -t --separator "|" --output-separator " | " + + echo "| Host | Configuration | Commit | Build errors | Build warnings | Failing tests | Passing tests |" + echo "| - | - | - | :-: | :-: | :-: | :-: |" + + curl -s "${BASE_URL}/api/v1/index.php?project=deal.II" | + jq -r ".buildgroups | .[] | .builds | .[] | .id , .site , .buildname, .update.files, .compilation.error, .compilation.warning, .test.fail, .test.pass" | + paste -d ' ' - - - - - - - - | + sort -nr | + if $links; then + awk "{ print \$2, + \"[\" \$3 \"](${BASE_URL}/buildSummary.php?buildid=\" \$1 \")\", \ + \"[\" \$4 \"](${BASE_URL}/viewUpdate.php?buildid=\" \$1 \")\", \ + \"[\" \$5 \"](${BASE_URL}/viewBuildError.php?buildid=\" \$1 \")\", \ + \"[\" \$6 \"](${BASE_URL}/viewBuildError.php?type=1&buildid=\" \$1 \")\", \ + \"[\" \$7 \"](${BASE_URL}/viewTest.php?onlyfailed&buildid=\" \$1 \")\", \ + \"[\" \$8 \"](${BASE_URL}/viewTest.php?onlypassed&buildid=\" \$1 \")\" + }" + else + awk '{$1=""; print $0}' + fi | + sed -e 's#^ ##' -e 's# # | #g' -e 's#^#| #' -e 's#$# |#' | + grep -P "${regex}" | + cat } query_testsuite -- 2.39.5