diff mbox series

[v1,1/1] example: generator move to platform tests

Message ID 1518721207-25354-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/1] example: generator move to platform tests | expand

Commit Message

Github ODP bot Feb. 15, 2018, 7 p.m. UTC
From: Maxim Uvarov <maxim.uvarov@linaro.org>


run generator example with null pktio from linux-generic test directory.
Null pktio might not be implemented on other odp implementations.

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

---
/** Email created from pull request 485 (muvarov:devel/master_example_null)
 ** https://github.com/Linaro/odp/pull/485
 ** Patch: https://github.com/Linaro/odp/pull/485.patch
 ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847
 ** Merge commit sha: 80a8e790983238f55c99f58abd669c44b0f69a89
 **/
 example/generator/Makefile.am                      |  5 ---
 example/generator/generator_run.sh                 | 17 --------
 platform/linux-generic/m4/configure.m4             |  2 +
 platform/linux-generic/test/Makefile.am            |  4 ++
 platform/linux-generic/test/example/Makefile.am    |  1 +
 .../test/example/generator/Makefile.am             |  4 ++
 .../test/example/generator/generator_run.sh        | 45 ++++++++++++++++++++++
 7 files changed, 56 insertions(+), 22 deletions(-)
 delete mode 100755 example/generator/generator_run.sh
 create mode 100644 platform/linux-generic/test/example/Makefile.am
 create mode 100644 platform/linux-generic/test/example/generator/Makefile.am
 create mode 100755 platform/linux-generic/test/example/generator/generator_run.sh
diff mbox series

Patch

diff --git a/example/generator/Makefile.am b/example/generator/Makefile.am
index 63f4ae608..7deeef406 100644
--- a/example/generator/Makefile.am
+++ b/example/generator/Makefile.am
@@ -3,8 +3,3 @@  include $(top_srcdir)/example/Makefile.inc
 bin_PROGRAMS = odp_generator
 
 odp_generator_SOURCES = odp_generator.c
-
-if test_example
-TESTS = generator_run.sh
-endif
-EXTRA_DIST = generator_run.sh
diff --git a/example/generator/generator_run.sh b/example/generator/generator_run.sh
deleted file mode 100755
index 2d741a8d1..000000000
--- a/example/generator/generator_run.sh
+++ /dev/null
@@ -1,17 +0,0 @@ 
-#!/bin/bash
-#
-# Copyright (c) 2018, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier:     BSD-3-Clause
-#
-
-./odp_generator${EXEEXT} -w 1 -n 1 -I null:0 -m u
-STATUS=$?
-
-if [ "$STATUS" -ne 0 ]; then
-  echo "Error: status was: $STATUS, expected 0"
-  exit 1
-fi
-
-exit 0
diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4
index 7fa3652e2..935894b8c 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -19,6 +19,8 @@  AM_CONDITIONAL([PLATFORM_IS_LINUX_GENERIC],
 AC_CONFIG_FILES([platform/linux-generic/Makefile
 		 platform/linux-generic/libodp-linux.pc
 		 platform/linux-generic/test/Makefile
+		 platform/linux-generic/test/example/Makefile
+		 platform/linux-generic/test/example/generator/Makefile
 		 platform/linux-generic/test/validation/api/shmem/Makefile
 		 platform/linux-generic/test/validation/api/pktio/Makefile
 		 platform/linux-generic/test/mmap_vlan_ins/Makefile
diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am
index 99934099a..e317ff736 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -3,6 +3,10 @@  TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
 
 SUBDIRS = performance
 
+if test_example
+SUBDIRS += example
+endif
+
 if test_vald
 TESTS = validation/api/pktio/pktio_run.sh \
 	validation/api/pktio/pktio_run_tap.sh \
diff --git a/platform/linux-generic/test/example/Makefile.am b/platform/linux-generic/test/example/Makefile.am
new file mode 100644
index 000000000..41d287522
--- /dev/null
+++ b/platform/linux-generic/test/example/Makefile.am
@@ -0,0 +1 @@ 
+SUBDIRS = generator
diff --git a/platform/linux-generic/test/example/generator/Makefile.am b/platform/linux-generic/test/example/generator/Makefile.am
new file mode 100644
index 000000000..3bdfdc69c
--- /dev/null
+++ b/platform/linux-generic/test/example/generator/Makefile.am
@@ -0,0 +1,4 @@ 
+TESTS_ENVIRONMENT = EXAMPLE_DIR=${top_builddir}/example/generator
+
+TESTS = generator_run.sh
+EXTRA_DIST = generator_run.sh
diff --git a/platform/linux-generic/test/example/generator/generator_run.sh b/platform/linux-generic/test/example/generator/generator_run.sh
new file mode 100755
index 000000000..3e7fabfe7
--- /dev/null
+++ b/platform/linux-generic/test/example/generator/generator_run.sh
@@ -0,0 +1,45 @@ 
+#!/bin/bash
+#
+# Copyright (c) 2018, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier:     BSD-3-Clause
+#
+
+# directory where platform test sources are, including scripts
+TEST_SRC_DIR=$(dirname $0)
+
+# exit codes expected by automake for skipped tests
+TEST_SKIPPED=77
+
+# directories where 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="${EXAMPLE_DIR}/:$PATH"
+PATH="`pwd`/example/generator/:$PATH"
+PATH="$(dirname $0)/../../../../../example/generator:$PATH"
+PATH=".:$PATH"
+
+bin_path=$(which odp_generator${EXEEXT})
+if [ -x "$bin_path" ] ; then
+	echo "running with odp_generator: $bin_path"
+else
+	echo "cannot odp_generator: please set you PATH for it."
+	pwd
+	echo $PATH
+	exit 1
+fi
+
+
+odp_generator${EXEEXT} -w 1 -n 1 -I null:0 -m u
+STATUS=$?
+
+if [ "$STATUS" -ne 0 ]; then
+  echo "Error: status was: $STATUS, expected 0"
+  exit 1
+fi
+
+exit 0