Re: [lng-odp] [buggyPATCH] linux-generic: add vlan insertion test

2016-09-14 Thread Maxim Uvarov

ping,

there was question about autotools inside the patch.
Can somebody replay please?

Thank you,
Maxim.

On 07/05/16 11:01, Maxim Uvarov wrote:

Use vlan tagged traffic for example validation test
to add code coverage for pkt_mmap_vlan_insert() internal
function.

Signed-off-by: Maxim Uvarov 
---
  In general this patch work and tests internal function. But there
  is one small issue related to autotools which I don't know how to
  fix better:
  make; make check works, but make check after clean fails 
example/packet/odp_pktio
  binary is not yet build while tests going to be executed. The only thing which
  cames to my mind is to reorder root directory Makefile.am and add "-" between 
tests
  and examples. In that case examples should be compiled before any test 
compilation/execution.
  Is that a right way to do?

  Thanks,
  Maxim.

  test/platform/linux-generic/Makefile.am|   6 ++-
  test/platform/linux-generic/pktio/.gitignore   |   1 +
  test/platform/linux-generic/pktio/Makefile.am  |   1 +
  .../platform/linux-generic/pktio/pktio_run_vlan.sh |  46 +
  test/platform/linux-generic/pktio/vlan.pcap| Bin 0 -> 9728 bytes
  5 files changed, 53 insertions(+), 1 deletion(-)
  create mode 100755 test/platform/linux-generic/pktio/pktio_run_vlan.sh
  create mode 100644 test/platform/linux-generic/pktio/vlan.pcap

diff --git a/test/platform/linux-generic/Makefile.am 
b/test/platform/linux-generic/Makefile.am
index 2d58c57..597a1c1 100644
--- a/test/platform/linux-generic/Makefile.am
+++ b/test/platform/linux-generic/Makefile.am
@@ -39,6 +39,9 @@ SUBDIRS = $(ODP_MODULES)
  
  if HAVE_PCAP

  TESTS += pktio/pktio_run_pcap.sh
+if test_example
+TESTS += pktio/pktio_run_vlan.sh
+endif
  endif
  if PKTIO_IPC
  TESTS += pktio_ipc/pktio_ipc_run.sh
@@ -54,7 +57,8 @@ endif
  
  TEST_EXTENSIONS = .sh
  
-dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)

+dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER) \
+pktio/vlan.pcap
  
  test_SCRIPTS = $(dist_check_SCRIPTS)
  
diff --git a/test/platform/linux-generic/pktio/.gitignore b/test/platform/linux-generic/pktio/.gitignore

index 7e563b8..5f75e14 100644
--- a/test/platform/linux-generic/pktio/.gitignore
+++ b/test/platform/linux-generic/pktio/.gitignore
@@ -1,2 +1,3 @@
  *.log
  *.trs
+*.pcap
diff --git a/test/platform/linux-generic/pktio/Makefile.am 
b/test/platform/linux-generic/pktio/Makefile.am
index 4a14343..094a222 100644
--- a/test/platform/linux-generic/pktio/Makefile.am
+++ b/test/platform/linux-generic/pktio/Makefile.am
@@ -4,6 +4,7 @@ dist_check_SCRIPTS = pktio_env \
  
  if HAVE_PCAP

  dist_check_SCRIPTS += pktio_run_pcap.sh
+dist_check_SCRIPTS += pktio_run_vlan.sh
  endif
  if netmap_support
  dist_check_SCRIPTS += pktio_run_netmap.sh
diff --git a/test/platform/linux-generic/pktio/pktio_run_vlan.sh 
b/test/platform/linux-generic/pktio/pktio_run_vlan.sh
new file mode 100755
index 000..b58aacb
--- /dev/null
+++ b/test/platform/linux-generic/pktio/pktio_run_vlan.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+#
+# This test is intend to test pkt_mmap_vlan_insert() feature for
+# linux-generic packet mmap pktio.
+#
+#
+
+# any parameter passed as arguments to this script is passed unchanged to
+# the test itself (pktio_main)
+
+# directories where pktio_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 intree.
+# -in the current directory.
+# running stand alone out of tree requires setting PATH
+PATH=${TEST_DIR}/pktio:$PATH
+PATH=$(dirname $0):$PATH
+PATH=../../../example/packet:$PATH
+PATH=../../../../_inst/bin:$PATH
+PATH=.:$PATH
+
+odp_pktio_path=$(which odp_pktio${EXEEXT})
+if [ -x "$odp_pktio_path" ] ; then
+   echo "running with $odp_pktio_path"
+else
+   pwd
+   echo $PATH
+   echo "cannot find odp_pktio${EXEEXT}: please set you PATH for it."
+   exit 1
+fi
+
+PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name vlan.pcap -print -quit`
+echo "using PCAP_IN = ${PCAP_IN}"
+PCAP_OUT=vlan_out.pcap
+odp_pktio${EXEEXT} -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 1 -m 0
+ret=$?
+rm -f ${PCAP_OUT}
+exit $ret
diff --git a/test/platform/linux-generic/pktio/vlan.pcap 
b/test/platform/linux-generic/pktio/vlan.pcap
new file mode 100644
index 
..106ccb682e51495b4025337518a0bce63c2c7681
GIT binary patch
literal 9728
zcmeHNeQXrR6@Rikyh3QAN~9xK+}$
z4T)^-QnlAgC4W>Yk*X>mRlo92km}Nw!c|oiNTn)LBLcyK0BKSYLZiA0xI}f|@6FEc
z&CT8}Zu4i?dS2hYnK$pf`MuxF&iVB}9(>lN6zOYfipb#)S3BqRK6jeva#{)P%KZ4H
z2`Z!uf1f`})Rm#nP-l2Nx8d?iyv8ohr8v56pV)=ly+yzZvNmzS?$(tvQ({
zN`3H(bKv=xSCLCcs6x0O=6jaXv{mjz%{=NyEc#gk|LwB0u=KHqz1)uIAM9Usn@mg_
zk2Z3jR&?;MUcTp8vTSb+>k8B@8d$;SEO~No<@;@ZpT?k%M|X%lk9

[lng-odp] [buggyPATCH] linux-generic: add vlan insertion test

2016-07-05 Thread Maxim Uvarov
Use vlan tagged traffic for example validation test
to add code coverage for pkt_mmap_vlan_insert() internal
function.

Signed-off-by: Maxim Uvarov 
---
 In general this patch work and tests internal function. But there
 is one small issue related to autotools which I don't know how to
 fix better:
 make; make check works, but make check after clean fails 
example/packet/odp_pktio
 binary is not yet build while tests going to be executed. The only thing which
 cames to my mind is to reorder root directory Makefile.am and add "-" between 
tests
 and examples. In that case examples should be compiled before any test 
compilation/execution.
 Is that a right way to do?

 Thanks,
 Maxim.

 test/platform/linux-generic/Makefile.am|   6 ++-
 test/platform/linux-generic/pktio/.gitignore   |   1 +
 test/platform/linux-generic/pktio/Makefile.am  |   1 +
 .../platform/linux-generic/pktio/pktio_run_vlan.sh |  46 +
 test/platform/linux-generic/pktio/vlan.pcap| Bin 0 -> 9728 bytes
 5 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100755 test/platform/linux-generic/pktio/pktio_run_vlan.sh
 create mode 100644 test/platform/linux-generic/pktio/vlan.pcap

diff --git a/test/platform/linux-generic/Makefile.am 
b/test/platform/linux-generic/Makefile.am
index 2d58c57..597a1c1 100644
--- a/test/platform/linux-generic/Makefile.am
+++ b/test/platform/linux-generic/Makefile.am
@@ -39,6 +39,9 @@ SUBDIRS = $(ODP_MODULES)
 
 if HAVE_PCAP
 TESTS += pktio/pktio_run_pcap.sh
+if test_example
+TESTS += pktio/pktio_run_vlan.sh
+endif
 endif
 if PKTIO_IPC
 TESTS += pktio_ipc/pktio_ipc_run.sh
@@ -54,7 +57,8 @@ endif
 
 TEST_EXTENSIONS = .sh
 
-dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)
+dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER) \
+pktio/vlan.pcap
 
 test_SCRIPTS = $(dist_check_SCRIPTS)
 
diff --git a/test/platform/linux-generic/pktio/.gitignore 
b/test/platform/linux-generic/pktio/.gitignore
index 7e563b8..5f75e14 100644
--- a/test/platform/linux-generic/pktio/.gitignore
+++ b/test/platform/linux-generic/pktio/.gitignore
@@ -1,2 +1,3 @@
 *.log
 *.trs
+*.pcap
diff --git a/test/platform/linux-generic/pktio/Makefile.am 
b/test/platform/linux-generic/pktio/Makefile.am
index 4a14343..094a222 100644
--- a/test/platform/linux-generic/pktio/Makefile.am
+++ b/test/platform/linux-generic/pktio/Makefile.am
@@ -4,6 +4,7 @@ dist_check_SCRIPTS = pktio_env \
 
 if HAVE_PCAP
 dist_check_SCRIPTS += pktio_run_pcap.sh
+dist_check_SCRIPTS += pktio_run_vlan.sh
 endif
 if netmap_support
 dist_check_SCRIPTS += pktio_run_netmap.sh
diff --git a/test/platform/linux-generic/pktio/pktio_run_vlan.sh 
b/test/platform/linux-generic/pktio/pktio_run_vlan.sh
new file mode 100755
index 000..b58aacb
--- /dev/null
+++ b/test/platform/linux-generic/pktio/pktio_run_vlan.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+#
+# This test is intend to test pkt_mmap_vlan_insert() feature for
+# linux-generic packet mmap pktio.
+#
+#
+
+# any parameter passed as arguments to this script is passed unchanged to
+# the test itself (pktio_main)
+
+# directories where pktio_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 intree.
+# -in the current directory.
+# running stand alone out of tree requires setting PATH
+PATH=${TEST_DIR}/pktio:$PATH
+PATH=$(dirname $0):$PATH
+PATH=../../../example/packet:$PATH
+PATH=../../../../_inst/bin:$PATH
+PATH=.:$PATH
+
+odp_pktio_path=$(which odp_pktio${EXEEXT})
+if [ -x "$odp_pktio_path" ] ; then
+   echo "running with $odp_pktio_path"
+else
+   pwd
+   echo $PATH
+   echo "cannot find odp_pktio${EXEEXT}: please set you PATH for it."
+   exit 1
+fi
+
+PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name vlan.pcap -print -quit`
+echo "using PCAP_IN = ${PCAP_IN}"
+PCAP_OUT=vlan_out.pcap
+odp_pktio${EXEEXT} -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 1 -m 0
+ret=$?
+rm -f ${PCAP_OUT}
+exit $ret
diff --git a/test/platform/linux-generic/pktio/vlan.pcap 
b/test/platform/linux-generic/pktio/vlan.pcap
new file mode 100644
index 
..106ccb682e51495b4025337518a0bce63c2c7681
GIT binary patch
literal 9728
zcmeHNeQXrR6@Rikyh3QAN~9xK+}$
z4T)^-QnlAgC4W>Yk*X>mRlo92km}Nw!c|oiNTn)LBLcyK0BKSYLZiA0xI}f|@6FEc
z&CT8}Zu4i?dS2hYnK$pf`MuxF&iVB}9(>lN6zOYfipb#)S3BqRK6jeva#{)P%KZ4H
z2`Z!uf1f`})Rm#nP-l2Nx8d?iyv8ohr8v56pV)=ly+yzZvNmzS?$(tvQ({
zN`3H(bKv=xSCLCcs6x0O=6jaXv{mjz%{=NyEc#gk|LwB0u=KHqz1)uIAM9Usn@mg_
zk2Z3jR&?;MUcTp8vTSb+>k8B@8d$;SEO~No<@;@ZpT?k%M|X%lk9|?s`aqYWyx8+Z
z0ekoid$_k!Cq3-uoBL#iIo(6N4XHj>S(MG
zeb3ib&#l6WQUqAxJ_;+1G%sQ<6jmy<(AQPlQ&u6q?Ejk-3sTiy%
zJLqU*1*lbZW@5#)vBLROyi$q5N@&mI6<4qV_HQ01DswYP6#Khh&#x#j`~T|OCi|bb
zN3;J^@0;w82*T>sY!!z