-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/VisionSystemsInc/vsi_common …
…into new_just_pip_tools
- Loading branch information
Showing
8 changed files
with
420 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env false bash | ||
|
||
if [[ ${-} != *i* ]]; then | ||
source_once &> /dev/null && return 0 | ||
fi | ||
|
||
#*# just/plugins/just_troubleshooter_functions | ||
|
||
#** | ||
# .. default-domain:: bash | ||
# | ||
# ================================= | ||
# J.U.S.T. Troubleshooter Functions | ||
# ================================= | ||
# | ||
# .. file:: just_troubleshooter_functions.bsh | ||
# | ||
# Support plugin for running troubleshooting tests | ||
# | ||
#** | ||
|
||
JUST_DEFAULTIFY_FUNCTIONS+=(troubleshoot_defaultify) | ||
JUST_HELP_FILES+=("${BASH_SOURCE[0]}") | ||
|
||
function troubleshoot_defaultify() | ||
{ | ||
local id_project_cwd="${JUST_PROJECT_PREFIX}_CWD" | ||
local docs_dir="${JUST_PROJECT_PREFIX}_SPHINX_DIR" | ||
docs_dir="${!docs_dir:-${!id_project_cwd}/docs}" | ||
|
||
arg="${1}" | ||
shift 1 | ||
case ${arg} in | ||
troubleshoot) | ||
"${VSI_COMMON_DIR}/linux/troubleshoot" ${@+"${@}"} | ||
extra_args=${#} | ||
;; | ||
*) | ||
plugin_not_found=1 | ||
;; | ||
esac | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ ${-} != *i* ]]; then | ||
source_once &> /dev/null && return 0 | ||
fi | ||
|
||
set -eu | ||
|
||
if [ -z "${VSI_COMMON_DIR+set}" ]; then | ||
VSI_COMMON_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)" | ||
fi | ||
|
||
source "${VSI_COMMON_DIR}/tests/testlib.bsh" | ||
source "${VSI_COMMON_DIR}/linux/colors.bsh" | ||
|
||
function run_troubleshoot_file() | ||
{ | ||
if [ -r "${1}" ]; then | ||
( | ||
source "${1}" | ||
for test_name in $(compgen -A function troubleshoot_); do | ||
begin_test "${test_name}" | ||
xtrace=/dev/null | ||
( | ||
setup_test | ||
"${test_name}" | ||
) | ||
end_test | ||
if [ "${test_status}" != "0" ]; then | ||
error_name=error_${test_name#troubleshoot_} | ||
"${error_name}" | ||
fi | ||
done | ||
TESTLIB_TEST_FILENAME=$(basename "${1}") atexit | ||
) || : | ||
else | ||
echo "Skipping ${1}, cannot read" | ||
fi | ||
} | ||
|
||
function run_troubleshooter() | ||
{ | ||
files=() | ||
|
||
if [ -r ".troubleshoot" ]; then | ||
while IFS=$'\n' read -r file || [ -n "${file}" ]; do | ||
files+=("${file}") | ||
done < ".troubleshoot" | ||
fi | ||
|
||
if [ -d ".troubleshoot.d" ]; then | ||
set_optflag nullglob | ||
files+=(".troubleshoot.d"/*) | ||
reset_optflag nullglob | ||
fi | ||
|
||
if (( ${#} )); then | ||
all_files=(${files[@]+"${files[@]}"}) | ||
files=() | ||
while (( ${#} )); do | ||
for file in ${all_files[@]+"${all_files[@]}"}; do | ||
if [ "$(basename "${file}")" == "${1}" ]; then | ||
files+=("${file}") | ||
fi | ||
done | ||
shift 1 | ||
done | ||
fi | ||
|
||
for file in ${files+"${files[@]}"}; do | ||
run_troubleshoot_file "${file}" | ||
done | ||
|
||
trap -- exit | ||
} | ||
|
||
if [ "${BASH_SOURCE[0]}" = "${0}" ] || [ "$(basename "${BASH_SOURCE[0]}")" = "${0}" ]; then | ||
run_troubleshooter ${@+"${@}"} | ||
fi |
Oops, something went wrong.