diff mbox

[1/2] linux-generic: test: improve locating pktio_env

Message ID 1462928831-21055-1-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes May 11, 2016, 1:07 a.m. UTC
Rather than limit pktio_env to the current directory, find it on the
path just as is done with pktio_main

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/test/pktio/pktio_run | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Maxim Uvarov May 11, 2016, 2:50 p.m. UTC | #1
On 05/11/16 04:07, Mike Holmes wrote:
> Rather than limit pktio_env to the current directory, find it on the
> path just as is done with pktio_main
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   platform/linux-generic/test/pktio/pktio_run | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/platform/linux-generic/test/pktio/pktio_run b/platform/linux-generic/test/pktio/pktio_run
> index 7029ab2..774a616 100755
> --- a/platform/linux-generic/test/pktio/pktio_run
> +++ b/platform/linux-generic/test/pktio/pktio_run
> @@ -31,13 +31,16 @@ TEST_SRC_DIR=$(dirname $0)
>   TEST_SKIPPED=77
>   
>   # Use installed pktio env or for make check take it from platform directory
> -if [ -f "./pktio_env" ]; then
> -	. ./pktio_env
> +
> +PKTIO_ENV="$(which pktio_env)"
> +
'which' probably should not find this due to right place for it not 
/usr/bin,
it has to be somewhere /usr/share/odp-linux/validation/ dir or similar.

Maxim.
> +if [ -f "${PKTIO_ENV}" ]; then
> +	. ${PKTIO_ENV}
>   elif [ -f ${TEST_SRC_DIR}/pktio_env ]; then
>   	. ${TEST_SRC_DIR}/pktio_env
>   else
>   	echo "BUG: unable to find pktio_env!"
> -	echo "pktio_env has to be in current directory or in platform/\$ODP_PLATFORM/test."
> +	echo "pktio_env has to be in current path or in platform/\$ODP_PLATFORM/test"
>   	echo "ODP_PLATFORM=\"$ODP_PLATFORM\""
>   	exit 1
>   fi
Mike Holmes May 11, 2016, 4:04 p.m. UTC | #2
On 11 May 2016 at 10:50, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 05/11/16 04:07, Mike Holmes wrote:

>

>> Rather than limit pktio_env to the current directory, find it on the

>> path just as is done with pktio_main

>>

>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>

>> ---

>>   platform/linux-generic/test/pktio/pktio_run | 9 ++++++---

>>   1 file changed, 6 insertions(+), 3 deletions(-)

>>

>> diff --git a/platform/linux-generic/test/pktio/pktio_run

>> b/platform/linux-generic/test/pktio/pktio_run

>> index 7029ab2..774a616 100755

>> --- a/platform/linux-generic/test/pktio/pktio_run

>> +++ b/platform/linux-generic/test/pktio/pktio_run

>> @@ -31,13 +31,16 @@ TEST_SRC_DIR=$(dirname $0)

>>   TEST_SKIPPED=77

>>     # Use installed pktio env or for make check take it from platform

>> directory

>> -if [ -f "./pktio_env" ]; then

>> -       . ./pktio_env

>> +

>> +PKTIO_ENV="$(which pktio_env)"

>> +

>>

> 'which' probably should not find this due to right place for it not

> /usr/bin,

> it has to be somewhere /usr/share/odp-linux/validation/ dir or similar.

>


It is installed  when you run make distcheck.
I spent a long time trying to manually add paths and since which is used in
this same file to find an installed script/executable I think it is a nice
simplification. that is in comparison to adding more clauses to the logic
for the special cases of where the code exists, that list is also at the
top on this file.


> Maxim.

>

>> +if [ -f "${PKTIO_ENV}" ]; then

>> +       . ${PKTIO_ENV}

>>   elif [ -f ${TEST_SRC_DIR}/pktio_env ]; then

>>         . ${TEST_SRC_DIR}/pktio_env

>>   else

>>         echo "BUG: unable to find pktio_env!"

>> -       echo "pktio_env has to be in current directory or in

>> platform/\$ODP_PLATFORM/test."

>> +       echo "pktio_env has to be in current path or in

>> platform/\$ODP_PLATFORM/test"

>>         echo "ODP_PLATFORM=\"$ODP_PLATFORM\""

>>         exit 1

>>   fi

>>

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
diff mbox

Patch

diff --git a/platform/linux-generic/test/pktio/pktio_run b/platform/linux-generic/test/pktio/pktio_run
index 7029ab2..774a616 100755
--- a/platform/linux-generic/test/pktio/pktio_run
+++ b/platform/linux-generic/test/pktio/pktio_run
@@ -31,13 +31,16 @@  TEST_SRC_DIR=$(dirname $0)
 TEST_SKIPPED=77
 
 # Use installed pktio env or for make check take it from platform directory
-if [ -f "./pktio_env" ]; then
-	. ./pktio_env
+
+PKTIO_ENV="$(which pktio_env)"
+
+if [ -f "${PKTIO_ENV}" ]; then
+	. ${PKTIO_ENV}
 elif [ -f ${TEST_SRC_DIR}/pktio_env ]; then
 	. ${TEST_SRC_DIR}/pktio_env
 else
 	echo "BUG: unable to find pktio_env!"
-	echo "pktio_env has to be in current directory or in platform/\$ODP_PLATFORM/test."
+	echo "pktio_env has to be in current path or in platform/\$ODP_PLATFORM/test"
 	echo "ODP_PLATFORM=\"$ODP_PLATFORM\""
 	exit 1
 fi