3 ## This program is free software; you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; version 3 or later of the License.
7 ## This program is distributed in the hope that it will be useful,
8 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
9 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 ## GNU General Public License for more details.
12 ## SPDX-License-Identifier: GPL-3.0-or-later
13 ## <https://spdx.org/licenses/GPL-3.0-or-later.html>
20 dependencies
=(cut git readlink
)
21 for dependency
in "${dependencies[@]}"; do
22 if ! command -v "${dependency}" 1>/dev
/null
; then
23 echo "missing ${dependency}, test skipped" >&2
29 function clone_submodules
() {
33 modules_dir
="$(readlink --canonicalize-missing \
34 "$
(git rev-parse
--git-dir)/modules
")"
36 git submodule init
1>>"${log_dir}/clone.log" 2>&1
37 for submodule
in $
(git config
--get-regexp "submodule\..*\.url" \
38 | cut
--delimiter=.
--fields=2); do
39 git config
"submodule.${submodule}.url" \
40 "${modules_dir}/${submodule}"
42 git submodule update
1>>"${log_dir}/clone.log" 2>&1
45 function check_exit_code
() {
48 # either "positive" or "negative"
52 # exit code 124 is special as per `timeout` manpage
53 if [ "${polarity}" == "positive" ] && [ ${err} -eq 124 ]; then
57 if [ "${polarity}" == "positive" ] && [ ${err} -ne 0 ]; then
58 echo "bad exit code: expected 0, actually ${err}"
59 echo "for details, refer to log file \"${log_file}\""
61 elif [ "${polarity}" == "negative" ] && [ ${err} -eq 0 ]; then
62 echo "bad exit code: expected non-zero, actually 0"
63 echo "for details, refer to log file \"${log_file}\""