From 7ad81c4d09527b7605d4d6db6d55a967d313cb15 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 7 Sep 2021 11:16:10 +0300 Subject: [PATCH] [#249] Add update tests result script Signed-off-by: Denis Kirillov --- docs/s3_test_results.md | 5 +++++ updateTestsResult.sh | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 updateTestsResult.sh diff --git a/docs/s3_test_results.md b/docs/s3_test_results.md index 42097787..dbbbdbaa 100644 --- a/docs/s3_test_results.md +++ b/docs/s3_test_results.md @@ -1,5 +1,10 @@ # S3 compatibility test results +To update this file using tests result run: +```sh +./updateTestsResult.sh ceph_tests_result.txt +``` + ## CopyObject Compatibility: 14/17/17 diff --git a/updateTestsResult.sh b/updateTestsResult.sh new file mode 100755 index 00000000..e7c9336b --- /dev/null +++ b/updateTestsResult.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +INPUT_FILE=$1 +RESULT_FILE=docs/s3_test_results.md + +while read -r line; +do + RES_LINE=$(echo "$line" | sed -nE '/^s3tests_boto3/p') + if [ -n "$RES_LINE" ] + then + TEST=$(echo "$RES_LINE" | sed -e 's/[[:space:]]*\.\.\..*//') + RESULT=$(echo "$RES_LINE" | sed -e 's/^.*\.\.\.[[:space:]]*//') + + # beautify trailing spaces + OLD_RESULT=$(sed -n "s/^.*${TEST}[[:space:]]*|[[:space:]]\(.*\)[[:space:]]|.*|$/\1/p" "$RESULT_FILE") + OLD_RESULT_LEN=${#OLD_RESULT} + RESULT_LEN=${#RESULT} + ADDITIONAL_SPACES=$((OLD_RESULT_LEN - RESULT_LEN)) + ADJUSTED_RESULT=$(printf "%s%*s" "$RESULT" $ADDITIONAL_SPACES '') + + sed -i "/UNSUPPORTED/! s/^\(.*${TEST}[[:space:]]*\)|[[:space:]].*[[:space:]]|\(.*|\)$/\1| ${ADJUSTED_RESULT} |\2/" "$RESULT_FILE" + fi +done < "$INPUT_FILE"