Project

General

Profile

Defect #35199 ยป plugin_test_support.sh

Workaround in bash - Martin Cizek, 2021-05-10 21:26

 
1
# Helper functions for testing Redmine core integrity when plugins are in use.
2
# Author: Martin Cizek, Orchitech
3

    
4
# https://www.redmine.org/issues/35199
5
PLUGIN_BREAKING_TESTS=(
6
  test/{unit,integration}/lib/redmine/hook_test.rb
7
)
8
TEST_HIDE_SUFFIX=.exclude
9

    
10
_rename_plugin_breaking_tests()
11
{
12
  local src_suffix=$1
13
  local dest_suffix=$2
14
  local t
15

    
16
  for t in "${PLUGIN_BREAKING_TESTS[@]}"; do
17
    if [[ -f "${t}${src_suffix}" ]]; then
18
      mv "${t}${src_suffix}" "${t}${dest_suffix}"
19
    elif ! [[ -f "${t}${dest_suffix}" ]]; then
20
      echo "Plugin-breaking test '$t' not found." >&2
21
      echo "Please inspect PLUGIN_BREAKING_TESTS." >&2
22
      exit 2
23
    fi
24
  done
25
}
26

    
27
hide_plugin_breaking_tests()
28
{
29
  _rename_plugin_breaking_tests '' "$TEST_HIDE_SUFFIX"
30
}
31

    
32
reveal_plugin_breaking_tests()
33
{
34
  _rename_plugin_breaking_tests "$TEST_HIDE_SUFFIX" ''
35
}
    (1-1/1)