Skip to content
Snippets Groups Projects

Enhance error handling

Open Vivek Dutta requested to merge merge_pipeline into devel
2 unresolved threads
2 files
+ 43
15
Compare changes
  • Side-by-side
  • Inline
Files
2
#!/bin/bash
set -eo pipefail
log()
{
@@ -106,7 +107,7 @@ run_cpd_check()
exec_cmd /usr/local/pmd/bin/run.sh cpd --language c --exclude ./test/ ${CPD_OPTIONS} --files ${SOURCE_FOLDER}
}
main()
validate_c_code()
{
log "SOURCE_FOLDER: ${SOURCE_FOLDER}"
log "COMPILATION_FIXUP: ${COMPILATION_FIXUP}"
@@ -126,6 +127,11 @@ main()
fi
fi
if [ "${SOURCE_FOLDER}" == "SKIP" ]; then
log "Skipping C code analysis"
exit 0
fi
# Install pre-req if present/defined
if [ -f "./gitlab-ci/install-dependencies.sh" ]; then
log "Installing prerequisites for compilation"
@@ -147,10 +153,40 @@ main()
run_cppcheck_validation
# Run clang analysis
run_cppcheck_clang_validation
# run_cppcheck_clang_validation
# Run infer analysis
run_infer_analysis
}
main "$@"
validate_shell_script()
{
log "Running optional tests"
if [ -z "${SHELL_SRC}" ]; then
log "Skipping ShellCheck path not defined"
exit 0
fi
if [ "${SHELL_SRC}" == "SKIP" ]; then
log "Skipping ShellChecks ..."
exit 0
fi
log "Running shellcheck ${SHELLCHECK_OPTIONS} ${SHELL_SRC}"
exec_cmd shellcheck ${SHELLCHECK_OPTIONS} ${SHELL_SRC}
}
validation_type="${1}"
case "${validation_type}" in
c_code)
validate_c_code "${@}"
;;
shell_script)
validate_shell_script "${@}"
;;
*)
echo "Unsupported validation type: ${validation_type}"
exit 1
;;
esac
Loading