]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
pretty_tox.sh: Portablity improvement
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Tue, 2 Dec 2014 04:18:48 +0000 (13:18 +0900)
committerYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Tue, 2 Dec 2014 04:27:46 +0000 (13:27 +0900)
A recent change (commit 0d5a11d9c722870f9c5e31a993219c7e240b4e19)
introduced bash dependency.  It broke my environment, where bash
is not available.  This change aims to restore it.

As far as I undestand, the change in question requires bash for
the "pipefail" feature.  Fortunately there's a more portable
well-known trick for the purpose.

Closes-Bug: #1398266
Change-Id: Id3561d81462923d20ad39584ba4cf8e1a294a8a8

tools/pretty_tox.sh
tox.ini

index 55dd14042917af477cb3be97644312005dd29849..e1bc9acfcb4cc07581df78f51f0082a5fafe102c 100755 (executable)
@@ -1,6 +1,6 @@
-#!/usr/bin/env bash
-
-set -o pipefail
+#! /bin/sh
 
 TESTRARGS=$1
-python -m neutron.openstack.common.lockutils python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | $(dirname $0)/subunit-trace.py -f
+
+exec 3>&1
+status=$(exec 4>&1 >&3; ( python -m neutron.openstack.common.lockutils python setup.py testr --slowest --testr-args="--subunit $TESTRARGS"; echo $? >&4 ) | $(dirname $0)/subunit-trace.py -f) && exit $status
diff --git a/tox.ini b/tox.ini
index 78abf20d61c2f5759929cc1c444dafb84bb792ef..2e7d2e48d57c2789c3fb3aa40fa346bf9cc25799 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -12,9 +12,9 @@ usedevelop = True
 install_command = pip install -U {opts} {packages}
 deps = -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
-whitelist_externals = bash
+whitelist_externals = sh
 commands =
-  bash tools/pretty_tox.sh '{posargs}'
+  sh tools/pretty_tox.sh '{posargs}'
 # there is also secret magic in pretty_tox.sh which lets you run in a fail only
 # mode. To do this define the TRACE_FAILONLY environmental variable.