You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@yetus.apache.org by aw...@apache.org on 2016/04/22 22:25:24 UTC
[06/22] yetus git commit: YETUS-348. add ability to write console
report to a file
YETUS-348. add ability to write console report to a file
Signed-off-by: Allen Wittenauer <aw...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/b0dcaf35
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/b0dcaf35
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/b0dcaf35
Branch: refs/heads/YETUS-156
Commit: b0dcaf35c1c106705fbf87fa1a524646e8fa1a62
Parents: 5bd344c
Author: Allen Wittenauer <aw...@apache.org>
Authored: Tue Mar 29 15:23:33 2016 -0700
Committer: Allen Wittenauer <aw...@apache.org>
Committed: Fri Apr 22 13:24:06 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/b0dcaf35/precommit/core.d/00-yetuslib.sh
----------------------------------------------------------------------
diff --git a/precommit/core.d/00-yetuslib.sh b/precommit/core.d/00-yetuslib.sh
index 90ffa16..25118cb 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/b0dcaf35/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/b0dcaf35/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/b0dcaf35/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 a99f149..f15dbf8 100755
--- a/precommit/test-patch-docker/launch-test-patch.sh
+++ b/precommit/test-patch-docker/launch-test-patch.sh
@@ -58,6 +58,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/" || exit 1
#shellcheck disable=SC2086
"${PATCH_DIR}/precommit/test-patch.sh" \
http://git-wip-us.apache.org/repos/asf/yetus/blob/b0dcaf35/precommit/test-patch.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh
index 0260c59..a55bb05 100755
--- a/precommit/test-patch.sh
+++ b/precommit/test-patch.sh
@@ -651,7 +651,6 @@ function relative_dir
## @replaceable no
function yetus_usage
{
-
declare bugsys
declare jdktlist
@@ -725,6 +724,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)"
@@ -789,6 +789,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
@@ -940,6 +943,7 @@ function parse_args
PATCH_DIR="${USER_PATCH_DIR}"
fi
+ # we need absolute dir for PATCH_DIR
cd "${STARTINGDIR}" || cleanup_and_exit 1
if [[ ! -d ${PATCH_DIR} ]]; then
mkdir -p "${PATCH_DIR}"
@@ -950,10 +954,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