linux-gen: pktio: handle exit if ipc app was killed

Message ID 1473281436-32284-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Sept. 7, 2016, 8:50 p.m.
In test script let master process finish his work and
don't try to kill him if killing can be avoided. If
kill invoked than do not dequeue from empty rings. Also it
looks like there is some race exist on defining which
app will be master and which will be slave if they run
at the same time. After long run following script I
do not see fails anymore:
while true; do ./test/linux-generic/pktio_ipc/pktio_ipc_run.sh || exit 1; done
https://bugs.linaro.org/show_bug.cgi?id=2505

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

---
 test/linux-generic/pktio_ipc/pktio_ipc_run.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

-- 
2.7.1.250.gff4ea60

Comments

Maxim Uvarov Sept. 15, 2016, 12:29 p.m. | #1
ping, this patch has to fix bunch of fails which we sometimes see in CI.

Maxim.

On 09/07/16 23:50, Maxim Uvarov wrote:
> In test script let master process finish his work and

> don't try to kill him if killing can be avoided. If

> kill invoked than do not dequeue from empty rings. Also it

> looks like there is some race exist on defining which

> app will be master and which will be slave if they run

> at the same time. After long run following script I

> do not see fails anymore:

> while true; do ./test/linux-generic/pktio_ipc/pktio_ipc_run.sh || exit 1; done

> https://bugs.linaro.org/show_bug.cgi?id=2505

>

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

> ---

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

>   1 file changed, 9 insertions(+), 4 deletions(-)

>

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

> index bd64baf..86b7c82 100755

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

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

> @@ -30,8 +30,9 @@ run()

>   	rm -rf /dev/shm/odp-${IPC_NS}* 2>&1 > /dev/null

>   

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

> -	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 30 &

> +	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 20 &

>   	IPC_PID=$!

> +	sleep 1

>   

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

>   	ret=$?

> @@ -57,12 +58,16 @@ run()

>   	IPC_NS=`expr $IPC_NS - 1`

>   	echo "Using ns ${IPC_NS}"

>   

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

> +	pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 20 &

>   	IPC_PID=$!

> +	sleep 1

>   

> -	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 20

> +	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 10

>   	ret=$?

> -	(kill ${IPC_PID} 2>&1 > /dev/null) > /dev/null || true

> +	kill ${IPC_PID} 2>&1 > /dev/null

> +	if [ $? -eq 0 ]; then

> +		rm -rf /dev/shm/odp-${IPC_NS}* 2>&1 > /dev/null

> +	fi

>   

>   	if [ $ret -ne 0 ]; then

>   		echo "!!! FAILED !!!"
Maxim Uvarov Oct. 4, 2016, 3:59 p.m. | #2
ping,  please review (after this patch ipc pktio test passes on odp-check).

Maxim.

On 09/07/16 23:50, Maxim Uvarov wrote:
> In test script let master process finish his work and

> don't try to kill him if killing can be avoided. If

> kill invoked than do not dequeue from empty rings. Also it

> looks like there is some race exist on defining which

> app will be master and which will be slave if they run

> at the same time. After long run following script I

> do not see fails anymore:

> while true; do ./test/linux-generic/pktio_ipc/pktio_ipc_run.sh || exit 1; done

> https://bugs.linaro.org/show_bug.cgi?id=2505

>

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

> ---

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

>   1 file changed, 9 insertions(+), 4 deletions(-)

>

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

> index bd64baf..86b7c82 100755

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

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

> @@ -30,8 +30,9 @@ run()

>   	rm -rf /dev/shm/odp-${IPC_NS}* 2>&1 > /dev/null

>   

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

> -	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 30 &

> +	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 20 &

>   	IPC_PID=$!

> +	sleep 1

>   

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

>   	ret=$?

> @@ -57,12 +58,16 @@ run()

>   	IPC_NS=`expr $IPC_NS - 1`

>   	echo "Using ns ${IPC_NS}"

>   

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

> +	pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 20 &

>   	IPC_PID=$!

> +	sleep 1

>   

> -	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 20

> +	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 10

>   	ret=$?

> -	(kill ${IPC_PID} 2>&1 > /dev/null) > /dev/null || true

> +	kill ${IPC_PID} 2>&1 > /dev/null

> +	if [ $? -eq 0 ]; then

> +		rm -rf /dev/shm/odp-${IPC_NS}* 2>&1 > /dev/null

> +	fi

>   

>   	if [ $ret -ne 0 ]; then

>   		echo "!!! FAILED !!!"

Patch

diff --git a/test/linux-generic/pktio_ipc/pktio_ipc_run.sh b/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
index bd64baf..86b7c82 100755
--- a/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
+++ b/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
@@ -30,8 +30,9 @@  run()
 	rm -rf /dev/shm/odp-${IPC_NS}* 2>&1 > /dev/null
 
 	echo "==== run pktio_ipc1 then pktio_ipc2 ===="
-	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 30 &
+	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 20 &
 	IPC_PID=$!
+	sleep 1
 
 	pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 10
 	ret=$?
@@ -57,12 +58,16 @@  run()
 	IPC_NS=`expr $IPC_NS - 1`
 	echo "Using ns ${IPC_NS}"
 
-	pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 10 &
+	pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 20 &
 	IPC_PID=$!
+	sleep 1
 
-	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 20
+	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 10
 	ret=$?
-	(kill ${IPC_PID} 2>&1 > /dev/null) > /dev/null || true
+	kill ${IPC_PID} 2>&1 > /dev/null
+	if [ $? -eq 0 ]; then
+		rm -rf /dev/shm/odp-${IPC_NS}* 2>&1 > /dev/null
+	fi
 
 	if [ $ret -ne 0 ]; then
 		echo "!!! FAILED !!!"