Repository: yetus Updated Branches: refs/heads/master a32a65138 -> 12f4fe040
YETUS-657. volumes on non-existent files creates a directory Signed-off-by: Sean Busbey <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/12f4fe04 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/12f4fe04 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/12f4fe04 Branch: refs/heads/master Commit: 12f4fe04088fd01da2f4375cabeea855ab9b3921 Parents: a32a651 Author: Allen Wittenauer <[email protected]> Authored: Tue Aug 14 14:44:28 2018 -0700 Committer: Allen Wittenauer <[email protected]> Committed: Sun Aug 19 21:37:51 2018 -0700 ---------------------------------------------------------------------- precommit/core.d/builtin-bugsystem.sh | 12 +++++++++ precommit/core.d/docker.sh | 5 ---- precommit/it/it-tp.sh | 2 +- .../test-patch-docker/launch-test-patch.sh | 8 ++++++ precommit/test-patch.d/briefreport.sh | 28 ++++++++++---------- precommit/test-patch.d/htmlout.sh | 10 +++---- precommit/test-patch.sh | 14 +++++----- 7 files changed, 48 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/12f4fe04/precommit/core.d/builtin-bugsystem.sh ---------------------------------------------------------------------- diff --git a/precommit/core.d/builtin-bugsystem.sh b/precommit/core.d/builtin-bugsystem.sh index 23c5d02..0aeddf1 100755 --- a/precommit/core.d/builtin-bugsystem.sh +++ b/precommit/core.d/builtin-bugsystem.sh @@ -171,3 +171,15 @@ function console_finalreport cat "${CONSOLE_REPORT_FILE}" fi } + + +## @description Give access to the brief report file in docker mode +## @audience private +## @stability evolving +## @replaceable no +function console_docker_support +{ + if [[ -n "${CONSOLE_REPORT_FILE}" ]]; then + DOCKER_EXTRAARGS+=("-v" "${CONSOLE_REPORT_FILE}:/testptch/console.txt") + fi +} http://git-wip-us.apache.org/repos/asf/yetus/blob/12f4fe04/precommit/core.d/docker.sh ---------------------------------------------------------------------- diff --git a/precommit/core.d/docker.sh b/precommit/core.d/docker.sh index 50bf432..83efc3b 100755 --- a/precommit/core.d/docker.sh +++ b/precommit/core.d/docker.sh @@ -584,11 +584,6 @@ PatchSpecificDocker DOCKER_EXTRAARGS+=("--privileged") fi - if [[ -n "${CONSOLE_REPORT_FILE}" ]]; then - touch "${CONSOLE_REPORT_FILE}" - DOCKER_EXTRAARGS+=("-v" "${CONSOLE_REPORT_FILE}:/testptch/console.txt") - fi - if [[ -n "${DOCKER_MEMORY}" ]]; then DOCKER_EXTRAARGS+=("-m" "${DOCKER_MEMORY}") fi http://git-wip-us.apache.org/repos/asf/yetus/blob/12f4fe04/precommit/it/it-tp.sh ---------------------------------------------------------------------- diff --git a/precommit/it/it-tp.sh b/precommit/it/it-tp.sh index c8a51e1..0e275f4 100755 --- a/precommit/it/it-tp.sh +++ b/precommit/it/it-tp.sh @@ -81,7 +81,7 @@ YETUS_ARGS+=("--java-home=/usr/lib/jvm/java-8-openjdk-amd64") YETUS_ARGS+=("--patch-dir=${PATCHDIR}") # plugins to enable. modify as necessary based upon what is being tested -YETUS_ARGS+=("--plugins=jira,maven,brieftext,htmlout") +YETUS_ARGS+=("--plugins=jira,maven,briefreport,htmlout") # Many projects need a high process limit YETUS_ARGS+=("--proclimit=5000") http://git-wip-us.apache.org/repos/asf/yetus/blob/12f4fe04/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 f15dbf8..ea3395a 100755 --- a/precommit/test-patch-docker/launch-test-patch.sh +++ b/precommit/test-patch-docker/launch-test-patch.sh @@ -62,6 +62,14 @@ if [[ -f /testptch/console.txt ]]; then OVERWRITEARGS=("${OVERWRITEARGS[@]}" "--console-report-file=/testptch/console.txt") fi +if [[ -f /testptch/brief.txt ]]; then + OVERWRITEARGS=("${OVERWRITEARGS[@]}" "--brief-report-file=/testptch/brief.txt") +fi + +if [[ -f /testptch/report.htm ]]; then + OVERWRITEARGS=("${OVERWRITEARGS[@]}" "--html-report-file=/testptch/report.htm") +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/12f4fe04/precommit/test-patch.d/briefreport.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/briefreport.sh b/precommit/test-patch.d/briefreport.sh index 9285641..e536b97 100755 --- a/precommit/test-patch.d/briefreport.sh +++ b/precommit/test-patch.d/briefreport.sh @@ -17,26 +17,26 @@ # there are no public APIs here # SHELLDOC-IGNORE -add_bugsystem brieftext +add_bugsystem briefreport BRIEFOUT_LONGRUNNING=3600 -## @description Usage info for brieftext plugin +## @description Usage info for briefreport plugin ## @audience private ## @stability evolving ## @replaceable no -function brieftext_usage +function briefreport_usage { yetus_add_option "--brief-report-file=<file>" "Save a very brief, plain text report to a file" yetus_add_option "--brief-report-long=<seconds>" "Time in seconds to use as long running subsystem threshold (Default: ${BRIEFOUT_LONGRUNNING})" } -## @description Option parsing for brieftext plugin +## @description Option parsing for briefreport plugin ## @audience private ## @stability evolving ## @replaceable no -function brieftext_parse_args +function briefreport_parse_args { declare i declare fn @@ -53,23 +53,23 @@ function brieftext_parse_args done if [[ -n "${fn}" ]]; then - touch "${fn}" 2>/dev/null - if [[ $? != 0 ]]; then - yetus_error "WARNING: cannot create ${fn}. Ignoring." + if : > "${fn}"; then + BRIEFOUT_REPORTFILE_ORIG="${fn}" + BRIEFOUT_REPORTFILE=$(yetus_abs "${BRIEFOUT_REPORTFILE_ORIG}") else - BRIEFOUT_REPORTFILE=$(yetus_abs "${fn}") + yetus_error "WARNING: cannot create brief text report file ${fn}. Ignoring." fi fi } -## @description Give access to the brief report file in docker mode +## @description Give access to the brief text report file in docker mode ## @audience private ## @stability evolving ## @replaceable no -function brieftext_docker_support +function briefreport_docker_support { if [[ -n ${BRIEFOUT_REPORTFILE} ]]; then - DOCKER_EXTRAARGS=("${DOCKER_EXTRAARGS[@]}" "-v" "${BRIEFOUT_REPORTFILE}:${BRIEFOUT_REPORTFILE}") + DOCKER_EXTRAARGS=("${DOCKER_EXTRAARGS[@]}" "-v" "${BRIEFOUT_REPORTFILE}:/testptch/brief.txt") fi } @@ -80,7 +80,7 @@ function brieftext_docker_support ## @param runresult ## @return 0 on success ## @return 1 on failure -function brieftext_finalreport +function briefreport_finalreport { declare result=$1 shift @@ -101,7 +101,7 @@ function brieftext_finalreport return fi - big_console_header "Writing Brief Report to ${BRIEFOUT_REPORTFILE}" + big_console_header "Writing Brief Text Report to ${BRIEFOUT_REPORTFILE}" if [[ ${result} == 0 ]]; then http://git-wip-us.apache.org/repos/asf/yetus/blob/12f4fe04/precommit/test-patch.d/htmlout.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/htmlout.sh b/precommit/test-patch.d/htmlout.sh index 1279134..f637d1a 100755 --- a/precommit/test-patch.d/htmlout.sh +++ b/precommit/test-patch.d/htmlout.sh @@ -43,11 +43,11 @@ function htmlout_parse_args done if [[ -n "${fn}" ]]; then - touch "${fn}" 2>/dev/null - if [[ $? != 0 ]]; then - yetus_error "WARNING: cannot create ${fn}. Ignoring." + if : > "${fn}"; then + HTMLOUT_REPORTFILE_ORIG="${fn}" + HTMLOUT_REPORTFILE=$(yetus_abs "${HTMLOUT_REPORTFILE_ORIG}") else - HTMLOUT_REPORTFILE=$(yetus_abs "${fn}") + yetus_error "WARNING: cannot create HTML report file ${fn}. Ignoring." fi fi } @@ -59,7 +59,7 @@ function htmlout_parse_args function htmlout_docker_support { if [[ -n ${HTMLOUT_REPORTFILE} ]]; then - DOCKER_EXTRAARGS=("${DOCKER_EXTRAARGS[@]}" "-v" "${HTMLOUT_REPORTFILE}:${HTMLOUT_REPORTFILE}") + DOCKER_EXTRAARGS=("${DOCKER_EXTRAARGS[@]}" "-v" "${HTMLOUT_REPORTFILE}:/testptch/report.htm") fi } http://git-wip-us.apache.org/repos/asf/yetus/blob/12f4fe04/precommit/test-patch.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh index 8a58605..5b375ca 100755 --- a/precommit/test-patch.sh +++ b/precommit/test-patch.sh @@ -1042,13 +1042,12 @@ function parse_args # we need absolute dir for ${CONSOLE_REPORT_FILE} if [[ -n "${CONSOLE_REPORT_FILE}" ]]; then - touch "${CONSOLE_REPORT_FILE}" - if [[ $? != 0 ]]; then + if : > "${CONSOLE_REPORT_FILE}"; then + CONSOLE_REPORT_FILE_ORIG="${CONSOLE_REPORT_FILE}" + CONSOLE_REPORT_FILE=$(yetus_abs "${CONSOLE_REPORT_FILE_ORIG}") + else 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 @@ -1796,8 +1795,11 @@ function check_reexec determine_user + # need to call this explicitly + console_docker_support + for plugin in ${PROJECT_NAME} ${BUILDTOOL} ${BUGSYSTEMS} ${TESTTYPES} ${TESTFORMATS}; do - if declare -f ${plugin}_docker_support >/dev/null; then + if declare -f "${plugin}_docker_support" >/dev/null; then "${plugin}_docker_support" fi done
