|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +REQUIRED_TESTS_COUNT=2 |
| 4 | + |
| 5 | +get_ref_tests_number() { |
| 6 | + # shellcheck disable=SC2155 |
| 7 | + local dir_number=$(find "$1" -maxdepth 1 -type d | wc -l) |
| 8 | + # shellcheck disable=SC2004 |
| 9 | + local task_number=$(($dir_number-1)) |
| 10 | + # shellcheck disable=SC2004 |
| 11 | + local tests_coeff=$(($REQUIRED_TESTS_COUNT+1)) |
| 12 | + # shellcheck disable=SC2004 |
| 13 | + local ref_tests_number=$(($task_number * $tests_coeff)) |
| 14 | + echo "$ref_tests_number" |
| 15 | +} |
| 16 | + |
| 17 | +get_current_tests_number() { |
| 18 | + # shellcheck disable=SC2155 |
| 19 | + local ref_tests_number="$("$1" --gtest_list_tests | wc -l)" |
| 20 | + # shellcheck disable=SC2004 |
| 21 | + ref_tests_number=$(($ref_tests_number+0)) |
| 22 | + echo "$ref_tests_number" |
| 23 | +} |
| 24 | + |
| 25 | +get_error_msg() { |
| 26 | + echo "Count of perf tests in $1 != $REQUIRED_TESTS_COUNT" |
| 27 | +} |
| 28 | + |
| 29 | +run_check() { |
| 30 | + # shellcheck disable=SC2155 |
| 31 | + # shellcheck disable=SC2004 |
| 32 | + local ref_num="$(get_ref_tests_number "tasks/$1" $(($REQUIRED_TESTS_COUNT+1)))" |
| 33 | + # shellcheck disable=SC2155 |
| 34 | + local curr_num="$(get_current_tests_number "./build/bin/$1_perf_tests")" |
| 35 | + |
| 36 | + if [[ ref_num -ne curr_num ]]; then |
| 37 | + # shellcheck disable=SC2005 |
| 38 | + echo "$(get_error_msg "$1")" |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | +} |
| 42 | + |
| 43 | +run_check "mpi" |
| 44 | +run_check "omp" |
| 45 | +run_check "seq" |
| 46 | +run_check "stl" |
| 47 | +run_check "tbb" |
| 48 | + |
| 49 | +echo "Success - perf count tests" |
0 commit comments