diff mbox series

[PATCHv2,1/2] test: tm: add paths to find tm binary

Message ID 20170427142643.6616-1-maxim.uvarov@linaro.org
State Accepted
Commit cf4a8144d8a8fcbbc3a9d6d43cbaa479f5e2dbfb
Headers show
Series [PATCHv2,1/2] test: tm: add paths to find tm binary | expand

Commit Message

Maxim Uvarov April 27, 2017, 2:26 p.m. UTC
Use the same algorithm as pktio_run.sh to find paths in
different cases (in tree build, out of tree build, distcheck
and etc).
Fixes:
https://bugs.linaro.org/show_bug.cgi?id=2969

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
 v2: fix Matias comments

 .../validation/api/traffic_mngr/traffic_mngr.sh    | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

-- 
2.11.0.295.gd7dffce
diff mbox series

Patch

diff --git a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.sh b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.sh
index a7d54162..4db7ea38 100755
--- a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.sh
+++ b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.sh
@@ -6,13 +6,29 @@ 
 # SPDX-License-Identifier:	BSD-3-Clause
 #
 
-# directory where test binaries have been built
-TEST_DIR="${TEST_DIR:-$(dirname $0)}"
+# directories where traffic_mngr_main binary can be found:
+# -in the validation dir when running make check (intree or out of tree)
+# -in the script directory, when running after 'make install', or
+# -in the validation when running standalone (./traffic_mngr) intree.
+# -in the current directory.
+# running stand alone out of tree requires setting PATH
+PATH=${TEST_DIR}/api/traffic_mngr:$PATH
+PATH=$(dirname $0)/../../../../common_plat/validation/api/traffic_mngr:$PATH
+PATH=$(dirname $0):$PATH
+PATH=`pwd`:$PATH
+
+traffic_mngr_main_path=$(which traffic_mngr_main${EXEEXT})
+if [ -x "$traffic_mngr_main_path" ] ; then
+	echo "running with traffic_mngr_main: $traffic_mngr_run_path"
+else
+	echo "cannot find traffic_mngr_main: please set you PATH for it."
+	exit 1
+fi
 
 # exit codes expected by automake for skipped tests
 TEST_SKIPPED=77
 
-${TEST_DIR}/traffic_mngr_main${EXEEXT}
+traffic_mngr_main${EXEEXT}
 ret=$?
 
 SIGSEGV=139