Repository: yetus Updated Branches: refs/heads/YETUS-156 ce914e458 -> 2575dc8bb
YETUS-348. add ability to write console report to a file Signed-off-by: Allen Wittenauer <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/2575dc8b Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/2575dc8b Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/2575dc8b Branch: refs/heads/YETUS-156 Commit: 2575dc8bb69b61cd61ff1ad2e0c2be596367c260 Parents: ce914e4 Author: Allen Wittenauer <[email protected]> Authored: Tue Mar 29 15:23:33 2016 -0700 Committer: Allen Wittenauer <[email protected]> Committed: Tue Mar 29 15:48:46 2016 -0700 ---------------------------------------------------------------------- precommit/core.d/00-yetuslib.sh | 2 +- precommit/core.d/builtin-bugsystem.sh | 10 ++++++++++ precommit/core.d/docker.sh | 5 +++++ .../test-patch-docker/launch-test-patch.sh | 4 ++++ precommit/test-patch.sh | 20 +++++++++++++++++--- 5 files changed, 37 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/2575dc8b/precommit/core.d/00-yetuslib.sh ---------------------------------------------------------------------- diff --git a/precommit/core.d/00-yetuslib.sh b/precommit/core.d/00-yetuslib.sh index 1bd63b7..4105641 100755 --- a/precommit/core.d/00-yetuslib.sh +++ b/precommit/core.d/00-yetuslib.sh @@ -101,7 +101,7 @@ function yetus_run_and_redirect ## @description Given a filename or dir, return the absolute version of it ## @audience public ## @stability stable -## @param directory +## @param fsobj ## @replaceable no ## @return 0 success ## @return 1 failure http://git-wip-us.apache.org/repos/asf/yetus/blob/2575dc8b/precommit/core.d/builtin-bugsystem.sh ---------------------------------------------------------------------- diff --git a/precommit/core.d/builtin-bugsystem.sh b/precommit/core.d/builtin-bugsystem.sh index f83e7c9..c7d9a6c 100755 --- a/precommit/core.d/builtin-bugsystem.sh +++ b/precommit/core.d/builtin-bugsystem.sh @@ -45,6 +45,11 @@ function console_finalreport declare seccoladj=0 declare spcfx=${PATCH_DIR}/spcl.txt + if [[ -n "${CONSOLE_REPORT_FILE}" ]]; then + exec 6>&1 + exec >"${CONSOLE_REPORT_FILE}" + fi + if [[ ${result} == 0 ]]; then if [[ ${ROBOT} == false ]]; then if declare -f ${PROJECT_NAME}_console_success >/dev/null; then @@ -154,4 +159,9 @@ function console_finalreport printf "%s\n" "${comment}" ((i=i+1)) done + + if [[ -n "${CONSOLE_REPORT_FILE}" ]]; then + exec 1>&6 6>&- + cat "${CONSOLE_REPORT_FILE}" + fi } http://git-wip-us.apache.org/repos/asf/yetus/blob/2575dc8b/precommit/core.d/docker.sh ---------------------------------------------------------------------- diff --git a/precommit/core.d/docker.sh b/precommit/core.d/docker.sh index 2d7f550..062c8c1 100755 --- a/precommit/core.d/docker.sh +++ b/precommit/core.d/docker.sh @@ -570,6 +570,11 @@ PatchSpecificDocker DOCKER_EXTRAARGS=("--privileged" "${DOCKER_EXTRAARGS[@]}") fi + if [[ -n "${CONSOLE_REPORT_FILE}" ]]; then + touch "${CONSOLE_REPORT_FILE}" + DOCKER_EXTRAARGS=("${DOCKER_EXTRAARGS[@]}" "-v" "${CONSOLE_REPORT_FILE}:/testptch/console.txt") + fi + client=$(docker_version Client) server=$(docker_version Server) http://git-wip-us.apache.org/repos/asf/yetus/blob/2575dc8b/precommit/test-patch-docker/launch-test-patch.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch-docker/launch-test-patch.sh b/precommit/test-patch-docker/launch-test-patch.sh index a7b040c..d54c502 100755 --- a/precommit/test-patch-docker/launch-test-patch.sh +++ b/precommit/test-patch-docker/launch-test-patch.sh @@ -57,6 +57,10 @@ if [[ "${PATCH_SYSTEM}" = generic ]]; then OVERWRITEARGS=("${OVERWRITEARGS[@]}" "/testptch/extras/patch") fi +if [[ -f /testptch/console.txt ]]; then + OVERWRITEARGS=("${OVERWRITEARGS[@]}" "--console-report-file=/testptch/console.txt") +fi + cd "${PATCH_DIR}/precommit/" #shellcheck disable=SC2086 "${PATCH_DIR}/precommit/test-patch.sh" \ http://git-wip-us.apache.org/repos/asf/yetus/blob/2575dc8b/precommit/test-patch.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh index 53ef2f2..5c7e61f 100755 --- a/precommit/test-patch.sh +++ b/precommit/test-patch.sh @@ -646,7 +646,6 @@ function relative_dir ## @replaceable no function yetus_usage { - declare bugsys declare jdktlist @@ -720,6 +719,7 @@ function yetus_usage yetus_add_option "--build-url=<url>" "Set the build location web page (Default: '${BUILD_URL}')" yetus_add_option "--build-url-console=<location>" "Location relative to --build-url of the console (Default: '${BUILD_URL_CONSOLE}')" yetus_add_option "--build-url-patchdir=<location>" "Location relative to --build-url of the --patch-dir (Default: '${BUILD_URL_ARTIFACTS}')" + yetus_add_option "--console-report-file=<file>" "Save the final console-based report to a file in addition to the screen" yetus_add_option "--console-urls" "Use the build URL instead of path on the console report" yetus_add_option "--instance=<string>" "Parallel execution identifier string" yetus_add_option "--jenkins" "Enable Jenkins-specifc handling (auto: --robot)" @@ -784,6 +784,9 @@ function parse_args # shellcheck disable=SC2034 BUILD_URL_CONSOLE=${i#*=} ;; + --console-report-file=*) + CONSOLE_REPORT_FILE=${i#*=} + ;; --console-urls) # shellcheck disable=SC2034 CONSOLE_USE_BUILD_URL=true @@ -935,6 +938,7 @@ function parse_args PATCH_DIR="${USER_PATCH_DIR}" fi + # we need absolute dir for PATCH_DIR cd "${STARTINGDIR}" if [[ ! -d ${PATCH_DIR} ]]; then mkdir -p "${PATCH_DIR}" @@ -945,10 +949,20 @@ function parse_args cleanup_and_exit 1 fi fi - - # we need absolute dir for PATCH_DIR PATCH_DIR=$(yetus_abs "${PATCH_DIR}") + # we need absolute dir for ${CONSOLE_REPORT_FILE} + if [[ -n "${CONSOLE_REPORT_FILE}" ]]; then + touch "${CONSOLE_REPORT_FILE}" + if [[ $? != 0 ]]; then + yetus_error "ERROR: cannot write to ${CONSOLE_REPORT_FILE}. Disabling console report file." + unset CONSOLE_REPORT_FILE + else + j="${CONSOLE_REPORT_FILE}" + CONSOLE_REPORT_FILE=$(yetus_abs "${j}") + fi + fi + if [[ ${RESETREPO} == "true" ]] ; then yetus_add_entry EXEC_MODES ResetRepo fi
