提交 881985a1 编写于 作者: oldratlee's avatar oldratlee 🔥

strict bash mode: add `set -u` option

上级 d7121220
......@@ -2,14 +2,12 @@
# Java API Compliance Checker (JAPICC),
# a tool for checking backward binary and source-level compatibility of a Java library API.
# https://github.com/lvc/japi-compliance-checker
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
export TTL_CI_TEST_MODE=true
source ./common_build.sh skipClean
set -u
ttl_jar_path="$(readlink -f "$(getTtlJarPath)")"
JCC="$(readlink -f "$(which japi-compliance-checker.pl)")"
......@@ -22,7 +20,7 @@ for base_version in 2.5.0 2.6.0 2.7.0 2.10.2; do
url="https://repo1.maven.org/maven2/com/alibaba/transmittable-thread-local/$base_version/transmittable-thread-local-$base_version.jar"
base_jar="transmittable-thread-local-$base_version.jar"
if [ ! -f "$base_jar" ]; then
wget "$url"
runCmd wget --quiet "$url"
fi
"$JCC" -show-packages -check-annotations -skip-internal-packages '\.(javassist|utils?|internal)\.?' \
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
source ./common_build.sh
......
......@@ -3,7 +3,16 @@
_source_mark_of_common=true
set -eEo pipefail
set -eEuo pipefail
################################################################################
# constants
################################################################################
# NOTE: $'foo' is the escape sequence syntax of bash
readonly nl=$'\n' # new line
readonly ec=$'\033' # escape char
readonly eend=$'\033[0m' # escape end
################################################################################
# trap error setting
......@@ -18,28 +27,23 @@ set -eEo pipefail
# https://shapeshed.com/unix-exit-codes/#how-to-suppress-exit-statuses
# https://stackoverflow.com/questions/30078281/raise-error-in-a-bash-script/50265513#50265513
__error_trapper() {
local parent_lineno="$1"
local file_line_info="$1"
local code="$2"
local commands="$3"
echo "error exit status $code, at file ${BASH_SOURCE[*]} on or near line $parent_lineno: $commands"
echo "Trap error! Exit status: $code${nl}File/(near) line info:$nl $file_line_info${nl}Error code line:$nl $commands"
}
trap '__error_trapper "${LINENO}/${BASH_LINENO}" "$?" "$BASH_COMMAND"' ERR
trap '__error_trapper "${BASH_SOURCE[*]} / $LINENO ${BASH_LINENO[*]}" "$?" "$BASH_COMMAND"' ERR
################################################################################
# util functions
################################################################################
# NOTE: $'foo' is the escape sequence syntax of bash
readonly nl=$'\n' # new line
readonly ec=$'\033' # escape char
readonly eend=$'\033[0m' # escape end
colorEcho() {
local color=$1
shift
# if stdout is console, turn on color output.
# if stdout is the console, turn on color output.
[ -t 1 ] && echo "${ec}[1;${color}m$*${eend}" || echo "$@"
}
......
......@@ -122,6 +122,6 @@ getJUnitTestCases() {
# maven actions
#################################################################################
if [ "$1" != "skipClean" ]; then
if [ "${1:-}" != "skipClean" ]; then
mvnClean
fi
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"/..
sed '
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
export TTL_CI_TEST_MODE=true
source ./prepare-jdk.sh
source ./common_build.sh "$1"
source ./common_build.sh "${1:-}"
# default jdk 11, do build and test
switch_to_jdk 11
headInfo "test with Java 11: $JAVA_HOME"
# run junit test in run-agent-test.sh
runCmd ./scripts/run-agent-test.sh "$1"
runCmd ./scripts/run-agent-test.sh "${1:-}"
java_home_var_names=(
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
source ../common_build.sh
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
source ../common_build.sh
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
source ../common_build.sh
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
source ../common_build.sh
......
#!/bin/bash
# SDKMAN! with Travis
# https://objectcomputing.com/news/2019/01/07/sdkman-travis
set -eEo pipefail
set -eEuo pipefail
[ -z "${_source_mark_of_prepare_jdk:+dummy}" ] || return 0
export _source_mark_of_prepare_jdk=true
......@@ -16,9 +16,10 @@ if [ ! -f "$HOME/.sdkman/bin/sdkman-init.sh" ]; then
curl -s get.sdkman.io | bash || exit 2
echo sdkman_auto_answer=true > "$HOME/.sdkman/etc/config"
fi
set +u
# shellcheck disable=SC1090
source "$HOME/.sdkman/bin/sdkman-init.sh"
set -u
jdks_install_by_sdkman=(
7.0.262-zulu
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
readonly BASE="$(pwd)"
. ./common_build.sh
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
source ./common_build.sh
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
[ -z "$1" ] && die "need class name argument!"
[ -z "${1:-}" ] && die "need class name argument!"
readonly run_class_name="$1"
shift 1
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
export TTL_CI_TEST_MODE=true
......
#!/bin/bash
set -eEo pipefail
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"
export TTL_CI_TEST_MODE=true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册