diff mbox

test: linux-gen: ipc do not use pid -1 value

Message ID 1471366237-10369-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit e5492930c13b8b17a6333050fd5078c89b305c17
Headers show

Commit Message

Maxim Uvarov Aug. 16, 2016, 4:50 p.m. UTC
In docker $$ (current pid) is 1 for the first launched bash.
0 value in ipc .ns mixed up with NULL and not accepted.
Also .ns value should not overflow signed int type.

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

---
 test/linux-generic/pktio_ipc/pktio_ipc_run.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.7.1.250.gff4ea60

Comments

Bill Fischofer Aug. 17, 2016, 3:13 p.m. UTC | #1
On Tue, Aug 16, 2016 at 11:50 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> In docker $$ (current pid) is 1 for the first launched bash.

> 0 value in ipc .ns mixed up with NULL and not accepted.

> Also .ns value should not overflow signed int type.

>

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

>


Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>


> ---

>  test/linux-generic/pktio_ipc/pktio_ipc_run.sh | 10 +++++++++-

>  1 file changed, 9 insertions(+), 1 deletion(-)

>

> diff --git a/test/linux-generic/pktio_ipc/pktio_ipc_run.sh

> b/test/linux-generic/pktio_ipc/pktio_ipc_run.sh

> index 2f99f32..bd64baf 100755

> --- a/test/linux-generic/pktio_ipc/pktio_ipc_run.sh

> +++ b/test/linux-generic/pktio_ipc/pktio_ipc_run.sh

> @@ -20,7 +20,10 @@ PATH=.:$PATH

>  run()

>  {

>         local ret=0

> -       IPC_NS=$$

> +       IPC_NS=`expr $$ + 5000`

> +       IPC_NS=`expr ${IPC_NS} % 65000`

> +       IPC_NS=`expr ${IPC_NS} + 2`

> +       echo "Using ns ${IPC_NS}"

>

>         #if test was interrupted with CTRL+c than files

>         #might remain in shm. Needed cleanely delete them.

> @@ -43,13 +46,17 @@ run()

>

>         if [ $ret -ne 0 ]; then

>                 echo "!!!First stage  FAILED $ret!!!"

> +               ls -l /dev/shm/

>                 exit $ret

>         else

>                 echo "First stage PASSED"

>         fi

>

> +

>         echo "==== run pktio_ipc2 then pktio_ipc1 ===="

>         IPC_NS=`expr $IPC_NS - 1`

> +       echo "Using ns ${IPC_NS}"

> +

>         pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 10 &

>         IPC_PID=$!

>

> @@ -59,6 +66,7 @@ run()

>

>         if [ $ret -ne 0 ]; then

>                 echo "!!! FAILED !!!"

> +               ls -l /dev/shm/

>                 exit $ret

>         else

>                 echo "Second stage PASSED"

> --

> 2.7.1.250.gff4ea60

>

>
diff mbox

Patch

diff --git a/test/linux-generic/pktio_ipc/pktio_ipc_run.sh b/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
index 2f99f32..bd64baf 100755
--- a/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
+++ b/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
@@ -20,7 +20,10 @@  PATH=.:$PATH
 run()
 {
 	local ret=0
-	IPC_NS=$$
+	IPC_NS=`expr $$ + 5000`
+	IPC_NS=`expr ${IPC_NS} % 65000`
+	IPC_NS=`expr ${IPC_NS} + 2`
+	echo "Using ns ${IPC_NS}"
 
 	#if test was interrupted with CTRL+c than files
 	#might remain in shm. Needed cleanely delete them.
@@ -43,13 +46,17 @@  run()
 
 	if [ $ret -ne 0 ]; then
 		echo "!!!First stage  FAILED $ret!!!"
+		ls -l /dev/shm/
 		exit $ret
 	else
 		echo "First stage PASSED"
 	fi
 
+
 	echo "==== run pktio_ipc2 then pktio_ipc1 ===="
 	IPC_NS=`expr $IPC_NS - 1`
+	echo "Using ns ${IPC_NS}"
+
 	pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 10 &
 	IPC_PID=$!
 
@@ -59,6 +66,7 @@  run()
 
 	if [ $ret -ne 0 ]; then
 		echo "!!! FAILED !!!"
+		ls -l /dev/shm/
 		exit $ret
 	else
 		echo "Second stage PASSED"