HBASE-24045 Support setting `-Dhadoop.profile` in adhoc_run_tests.sh ADDENDUM

* Correctly handle the hadoop2 profile.
* Create the output directory if it doesn't exist
This commit is contained in:
Nick Dimiduk 2020-03-25 17:19:15 -07:00 committed by Nick Dimiduk
parent d7ff742ce8
commit d05fccfc24
1 changed files with 16 additions and 11 deletions

View File

@ -35,7 +35,7 @@ declare fork_count="0.5C"
declare -i attempts=1 declare -i attempts=1
declare maven_repo="${HOME}/.m2/repository" declare maven_repo="${HOME}/.m2/repository"
declare output="." declare output="."
declare hadoop_profile='2.0' declare hadoop_profile
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case "$1" in case "$1" in
@ -84,25 +84,30 @@ for test in "${@}"; do
for module in $(find_modules "${test}"); do for module in $(find_modules "${test}"); do
if [[ ! "${modules[*]}" =~ ${module} ]]; then if [[ ! "${modules[*]}" =~ ${module} ]]; then
echo "adding module '${module}' to set." echo "adding module '${module}' to set."
modules+=(${module}) modules+=("${module}")
fi fi
done done
done done
declare -a mvn_module_arg declare -a mvn_module_arg
for module in "${modules[@]}"; do for module in "${modules[@]}"; do
mvn_module_arg+=(-pl "${module}") mvn_module_arg+=(-pl "${module}")
done done
declare tests="${*}" declare tests="${*}"
declare -a maven_args=('--batch-mode' "-Dmaven.repo.local=${maven_repo}" "-Dtest=${tests// /,}"
'-Dsurefire.rerunFailingTestsCount=0' "-Dsurefire.parallel.forcedTimeout=${force_timeout}"
'-Dsurefire.shutdown=kill' '-DtrimStackTrace=false' '-am' "${mvn_module_arg[@]}"
"-DforkCount=${fork_count}" test)
if [[ -n "${hadoop_profile}" ]] ; then
maven_args+=("-Dhadoop.profile=${hadoop_profile}")
fi
if [[ ! -d "${output}" ]] ; then
mkdir -p "${output}"
fi
for attempt in $(seq "${attempts}"); do for attempt in $(seq "${attempts}"); do
echo "Attempt ${attempt}" >&2 echo "Attempt ${attempt}" >&2
echo_run_redirect "${output}/mvn_test.log" mvn --batch-mode \ echo_run_redirect "${output}/mvn_test.log" mvn "${maven_args[@]}"
-Dhadoop.profile="${hadoop_profile}" \
-Dmaven.repo.local="${maven_repo}" \
-Dtest="${tests// /,}" \
-Dsurefire.rerunFailingTestsCount=0 -Dsurefire.parallel.forcedTimeout="${force_timeout}" \
-Dsurefire.shutdown=kill -DtrimStackTrace=false -am "${mvn_module_arg[@]}" \
-DforkCount="${fork_count}" \
test
done done