File: run-test.sh

package info (click to toggle)
groonga-normalizer-mysql 1.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,140 kB
  • sloc: ansic: 60,749; ruby: 1,188; sh: 217; makefile: 7
file content (89 lines) | stat: -rwxr-xr-x 2,235 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
#
# Copyright (C) 2013-2024  Sutou Kouhei <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

set -e

SOURCE_TEST_DIR="$(dirname $0)"
if [ -z "${BUILD_DIR}" ]; then
  BUILD_DIR="$(cd "${SOURCE_TEST_DIR}/.." && pwd)"
fi

if [ -f "${BUILD_DIR}/CMakeCache.txt" ]; then
  cmake --build "${BUILD_DIR}"
fi

GRN_PLUGINS_DIR="${BUILD_DIR}"
export GRN_PLUGINS_DIR

case $(uname) in
  Darwin)
    DYLD_LIBRARY_PATH="${BUILD_DIR}/lib/:${DYLD_LIBRARY_PATH}"
    export DYLD_LIBRARY_PATH
    ;;
  *)
    :
    ;;
esac

if ! type grntest > /dev/null; then
  gem install grntest
fi

have_targets="false"
use_gdb="false"
next_argument_is_long_option_value="false"
for argument in "$@"; do
  case "$argument" in
    --*=*)
    ;;
    --keep-database|--no-*|--version|--help)
    # no argument options
    ;;
    --gdb)
      # no argument options
      use_gdb="true"
      ;;
    --*)
      next_argument_is_long_option_value="true"
      continue
      ;;
    -*)
      ;;
    *)
      if test "$next_argument_is_long_option_value" != "true"; then
	have_targets="true"
      fi
      ;;
  esac
  next_argument_is_long_option_value="false"
done

grntest_options=("$@")
if [ "${use_gdb}" == "true" ]; then
  grntest_options=("--n-workers" "1" "${grntest_options[@]}")
fi
if [ "${CI}" = "true" ]; then
  grntest_options=("--reporter" "mark" "${grntest_options[@]}")
fi
if [ "${have_targets}" != "true" ]; then
  grntest_options+=("${SOURCE_TEST_DIR}/suite")
fi

grntest \
  --base-directory "${SOURCE_TEST_DIR}" \
  "${grntest_options[@]}"