asdf

Форк
0
/
test.bash 
39 строк · 1.0 Кб
1
#!/usr/bin/env bash
2

3
set -euo pipefail
4
IFS=$'\n\t'
5

6
print.info() {
7
  printf '[INFO] %s\n' "$1"
8
}
9

10
print.error() {
11
  printf '[ERROR] %s\n' "$1" >&2
12
}
13

14
{
15
  repo_dir=$(git rev-parse --show-toplevel)
16
  current_dir=$(pwd -P)
17
  if [ "$repo_dir" != "$current_dir" ]; then
18
    print.error "This scripts requires execution from the repository root directory."
19
    printf "\t%s\t%s\n" "Repo root dir:" "$repo_dir"
20
    printf "\t%s\t%s\n\n" "Current dir:" "$current_dir"
21
    exit 1
22
  fi
23
}
24

25
test_directory="./test"
26
bats_options=(--timing --print-output-on-failure)
27

28
if command -v parallel >/dev/null; then
29
  # Enable parallel jobs
30
  bats_options+=(--jobs 2 --no-parallelize-within-files)
31
elif [[ -n "${CI-}" ]]; then
32
  print.error "GNU parallel should be installed in the CI environment. Please install and rerun the test suite."
33
  exit 1
34
else
35
  print.info "For faster test execution, install GNU parallel."
36
fi
37

38
print.info "Running Bats in directory '${test_directory}' with options:" "${bats_options[@]}"
39
bats "${bats_options[@]}" "${test_directory}"
40

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.