diff --git a/tools/tox-log-command.sh b/tools/tox-log-command.sh new file mode 100755 index 0000000000..b3269f30d2 --- /dev/null +++ b/tools/tox-log-command.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Thin wrapper around list-changes to write a log file in addition to +# writing to stdout. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +cmd="$1" +shift + +if [ -z "$LOGDIR" ]; then + echo "LOGDIR variable not set." + exit 1 +fi + +logfile="$LOGDIR/$cmd-results.log" + +echo "Logging $cmd output to $logfile" + +$cmd "$@" 2>&1 | tee "$logfile" diff --git a/tox.ini b/tox.ini index 87abf44273..72a963a87a 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,9 @@ commands = [testenv:list-changes] setenv = PYTHONUNBUFFERED=1 -commands = list-changes {posargs} + LOGDIR={envdir}/log +commands = + {toxinidir}/tools/tox-log-command.sh list-changes {posargs} [testenv:pep8] deps = flake8>=2.2.4,<=2.4.1