diff mbox

test: linux-gen: add pcap playback test

Message ID 1467986348-30968-1-git-send-email-maxim.uvarov@linaro.org
State Superseded
Headers show

Commit Message

Maxim Uvarov July 8, 2016, 1:59 p.m. UTC
add pcap play back test which takes 2 arguments: 1 - pcap file,
2 - packet mask to match. Intend is to test odp with different
input traffic to check internal implementation functions. In
current case it's test for vlan tag instertion for packet mmap:
pkt_mmap_vlan_insert().

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

---
 test/platform/linux-generic/.gitignore       |   1 +
 test/platform/linux-generic/Makefile.am      |  12 +-
 test/platform/linux-generic/cls/.gitignore   |   3 +
 test/platform/linux-generic/cls/Makefile.am  |  13 +
 test/platform/linux-generic/cls/cls.c        | 349 +++++++++++++++++++++++++++
 test/platform/linux-generic/cls/cls_main.c   |  12 +
 test/platform/linux-generic/cls/cls_suites.h |   1 +
 test/platform/linux-generic/cls/vlan.pcap    | Bin 0 -> 9728 bytes
 test/platform/linux-generic/cls/vlan_run.sh  |  49 ++++
 test/platform/linux-generic/m4/configure.m4  |   1 +
 10 files changed, 436 insertions(+), 5 deletions(-)
 create mode 100644 test/platform/linux-generic/cls/.gitignore
 create mode 100644 test/platform/linux-generic/cls/Makefile.am
 create mode 100644 test/platform/linux-generic/cls/cls.c
 create mode 100644 test/platform/linux-generic/cls/cls_main.c
 create mode 100644 test/platform/linux-generic/cls/cls_suites.h
 create mode 100644 test/platform/linux-generic/cls/vlan.pcap
 create mode 100755 test/platform/linux-generic/cls/vlan_run.sh

-- 
2.7.1.250.gff4ea60

Comments

Maxim Uvarov July 12, 2016, 1:13 p.m. UTC | #1
ping

On 07/08/16 16:59, Maxim Uvarov wrote:
> add pcap play back test which takes 2 arguments: 1 - pcap file,

> 2 - packet mask to match. Intend is to test odp with different

> input traffic to check internal implementation functions. In

> current case it's test for vlan tag instertion for packet mmap:

> pkt_mmap_vlan_insert().

>

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

> ---

>   test/platform/linux-generic/.gitignore       |   1 +

>   test/platform/linux-generic/Makefile.am      |  12 +-

>   test/platform/linux-generic/cls/.gitignore   |   3 +

>   test/platform/linux-generic/cls/Makefile.am  |  13 +

>   test/platform/linux-generic/cls/cls.c        | 349 +++++++++++++++++++++++++++

>   test/platform/linux-generic/cls/cls_main.c   |  12 +

>   test/platform/linux-generic/cls/cls_suites.h |   1 +

>   test/platform/linux-generic/cls/vlan.pcap    | Bin 0 -> 9728 bytes

>   test/platform/linux-generic/cls/vlan_run.sh  |  49 ++++

>   test/platform/linux-generic/m4/configure.m4  |   1 +

>   10 files changed, 436 insertions(+), 5 deletions(-)

>   create mode 100644 test/platform/linux-generic/cls/.gitignore

>   create mode 100644 test/platform/linux-generic/cls/Makefile.am

>   create mode 100644 test/platform/linux-generic/cls/cls.c

>   create mode 100644 test/platform/linux-generic/cls/cls_main.c

>   create mode 100644 test/platform/linux-generic/cls/cls_suites.h

>   create mode 100644 test/platform/linux-generic/cls/vlan.pcap

>   create mode 100755 test/platform/linux-generic/cls/vlan_run.sh

>

> diff --git a/test/platform/linux-generic/.gitignore b/test/platform/linux-generic/.gitignore

> index 5dabf91..f65c7c1 100644

> --- a/test/platform/linux-generic/.gitignore

> +++ b/test/platform/linux-generic/.gitignore

> @@ -1,3 +1,4 @@

>   *.log

>   *.trs

>   tests-validation.env

> +test_out.pcap

> diff --git a/test/platform/linux-generic/Makefile.am b/test/platform/linux-generic/Makefile.am

> index 2d58c57..df6e950 100644

> --- a/test/platform/linux-generic/Makefile.am

> +++ b/test/platform/linux-generic/Makefile.am

> @@ -1,7 +1,9 @@

>   include $(top_srcdir)/test/Makefile.inc

>   TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation

> +TEST_EXTENSIONS = .sh

>   

> -ODP_MODULES = pktio \

> +ODP_MODULES = cls \

> +	      pktio \

>   	      ring \

>   	      shmem

>   

> @@ -37,7 +39,11 @@ TESTS = pktio/pktio_run.sh \

>   

>   SUBDIRS = $(ODP_MODULES)

>   

> +dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)

> +

>   if HAVE_PCAP

> +TESTS += cls/vlan_run.sh

> +dist_check_SCRIPTS += cls/vlan_run.sh cls/vlan.pcap

>   TESTS += pktio/pktio_run_pcap.sh

>   endif

>   if PKTIO_IPC

> @@ -52,10 +58,6 @@ TESTS += pktio/pktio_run_dpdk.sh

>   endif

>   endif

>   

> -TEST_EXTENSIONS = .sh

> -

> -dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)

> -

>   test_SCRIPTS = $(dist_check_SCRIPTS)

>   

>   tests-validation.env:

> diff --git a/test/platform/linux-generic/cls/.gitignore b/test/platform/linux-generic/cls/.gitignore

> new file mode 100644

> index 0000000..9447625

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/.gitignore

> @@ -0,0 +1,3 @@

> +cls_main

> +*.log

> +*.trs

> diff --git a/test/platform/linux-generic/cls/Makefile.am b/test/platform/linux-generic/cls/Makefile.am

> new file mode 100644

> index 0000000..43fb0bc

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/Makefile.am

> @@ -0,0 +1,13 @@

> +include ../Makefile.inc

> +

> +noinst_LTLIBRARIES = libtestcls.la

> +libtestcls_la_SOURCES = cls.c

> +libtestcls_la_CFLAGS = $(AM_CFLAGS) $(INCCUNIT_COMMON) $(INCODP)

> +

> +test_PROGRAMS = cls_main$(EXEEXT)

> +dist_cls_main_SOURCES = cls_main.c

> +

> +cls_main_LDFLAGS = $(AM_LDFLAGS)

> +cls_main_LDADD = libtestcls.la $(LIBCUNIT_COMMON) $(LIBODP)

> +

> +noinst_HEADERS = cls_suites.h

> diff --git a/test/platform/linux-generic/cls/cls.c b/test/platform/linux-generic/cls/cls.c

> new file mode 100644

> index 0000000..d527ec8

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/cls.c

> @@ -0,0 +1,349 @@

> +/* Copyright (c) 2016, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdlib.h>

> +#include <string.h>

> +#include <getopt.h>

> +#include <unistd.h>

> +#include <inttypes.h>

> +

> +#include <test_debug.h>

> +

> +#include <odp_api.h>

> +#include <odp/helper/linux.h>

> +#include <odp/helper/eth.h>

> +#include <odp/helper/ip.h>

> +

> +#include <odp_packet_internal.h>

> +

> +#include "cls_suites.h"

> +

> +/** Get rid of path in filename - only for unix-type paths using '/' */

> +#define NO_PATH(file_name) (strrchr((file_name), '/') ? \

> +			    strrchr((file_name), '/') + 1 : (file_name))

> +

> +/**

> + * Print usage information

> + */

> +static void usage(char *progname)

> +{

> +	printf("\n"

> +	       "This is test application to verify that linux-generic classifier\n"

> +	       "correctly classifies packets on input. Main intend is add more code\n"

> +	       "coverage for internal functions playing different traffic recorded to\n"

> +	       "pcap files."

> +	       "\n"

> +	       "Usage: %s OPTIONS\n"

> +	       "  E.g. %s -i pcap_file -e expected_bitmask\n"

> +	       "\n"

> +	       "Mandatory OPTIONS:\n"

> +	       "  -i, pcap file name\n"

> +	       "  -e, expected packet bitmask\n"

> +	       "\n", NO_PATH(progname), NO_PATH(progname)

> +	    );

> +}

> +

> +/** @def SHM_PKT_POOL_SIZE

> + * @brief Size of the shared memory block

> + */

> +#define SHM_PKT_POOL_SIZE      512

> +

> +/** @def SHM_PKT_POOL_BUF_SIZE

> + * @brief Buffer size of the packet pool buffer

> + */

> +#define SHM_PKT_POOL_BUF_SIZE  1856

> +

> +/**

> + * Parsed command line application arguments

> + */

> +typedef struct {

> +	char *file_name;     /**< File name for pcap pktio */

> +	odp_pktio_t pktio;  /**< Pktio dev */

> +	input_flags_t expected_bits; /**< Expected bits from test run */

> +} appl_args_t;

> +

> +/**

> + * Grouping of both parsed CL args and thread specific args - alloc together

> + */

> +typedef struct {

> +	/** Application (parsed) arguments */

> +	appl_args_t appl;

> +} args_t;

> +

> +/** Global pointer to args */

> +static args_t *args;

> +/** Fill this bit struct to check which packet fields were classified */

> +static input_flags_t packet_flags;

> +

> +/**

> + * Parse and store the command line arguments

> + *

> + * @param argc       argument count

> + * @param argv[]     argument vector

> + * @param appl_args  Store application arguments here

> + */

> +static void parse_args(int argc, char *argv[], appl_args_t *appl_args)

> +{

> +	int opt;

> +	int long_index;

> +	static const struct option longopts[] = {

> +		{"interface", required_argument, NULL, 'i'},	/* return 'i' */

> +		{"extected", required_argument, NULL, 'e'},	/* return 'e' */

> +		{"help", no_argument, NULL, 'h'},		/* return 'h' */

> +		{NULL, 0, NULL, 0}

> +	};

> +

> +	static const char *shortopts = ":i:e:h";

> +

> +	/* let helper collect its own arguments (e.g. --odph_proc) */

> +	odph_parse_options(argc, argv, shortopts, longopts);

> +

> +	appl_args->file_name = NULL;

> +	opterr = 0; /* do not issue errors on helper options */

> +	appl_args->expected_bits.all = 0;

> +

> +	while (1) {

> +		opt = getopt_long(argc, argv, shortopts, longopts, &long_index);

> +

> +		if (opt == -1)

> +			break;	/* No more options */

> +

> +		switch (opt) {

> +		case 'i':

> +			appl_args->file_name =  optarg;

> +			break;

> +		case 'e':

> +			appl_args->expected_bits.all = atoll(optarg);

> +			break;

> +

> +		case 'h':

> +			usage(argv[0]);

> +			exit(EXIT_SUCCESS);

> +			break;

> +		default:

> +			break;

> +		}

> +	}

> +

> +	if (!appl_args->file_name) {

> +		usage(argv[0]);

> +		exit(EXIT_SUCCESS);

> +	}

> +

> +	optind = 1;		/* reset 'extern optind' from the getopt lib */

> +}

> +

> +/**

> + * Create a pktio handle, optionally associating a default input queue.

> + *

> + * @param dev Name of device to open

> + * @param pool Pool to associate with device for packet RX/TX

> + * @param mode Packet processing mode for this device (BURST or QUEUE)

> + *

> + * @return The handle of the created pktio object.

> + * @retval ODP_PKTIO_INVALID if the create fails.

> + */

> +static odp_pktio_t create_pktio(const char *fname, odp_pool_t pool)

> +{

> +	odp_pktio_t pktio;

> +	int ret;

> +	odp_pktio_param_t pktio_param;

> +	odp_pktin_queue_param_t pktin_param;

> +	char dev[255];

> +

> +	odp_pktio_param_init(&pktio_param);

> +	pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;

> +

> +	memset(dev, 0, 255);

> +	sprintf(dev, "pcap:in=%s:out=test_out.pcap",  fname);

> +

> +	/* Open a packet IO instance */

> +	pktio = odp_pktio_open(dev, pool, &pktio_param);

> +	if (pktio == ODP_PKTIO_INVALID)

> +		LOG_ABORT("Error: pktio create failed for %s\n", dev);

> +

> +	odp_pktin_queue_param_init(&pktin_param);

> +

> +	pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;

> +

> +	if (odp_pktin_queue_config(pktio, &pktin_param))

> +		LOG_ABORT("Error: pktin config failed for %s\n", dev);

> +

> +	if (odp_pktout_queue_config(pktio, NULL))

> +		LOG_ABORT("Error: pktout config failed for %s\n", dev);

> +

> +	ret = odp_pktio_start(pktio);

> +	if (ret != 0)

> +		LOG_ABORT("Error: unable to start %s\n", dev);

> +

> +	printf("  created pktio:%02" PRIu64

> +	       ", dev:%s, queue mode (ATOMIC queues)\n"

> +	       "  \tdefault pktio%02" PRIu64 "\n",

> +	       odp_pktio_to_u64(pktio), dev,

> +	       odp_pktio_to_u64(pktio));

> +

> +	return pktio;

> +}

> +

> +/**

> + * Packet IO loopback worker thread using ODP queues

> + *

> + * @param arg  thread arguments of type 'thread_args_t *'

> + */

> +static int pktio_queue_thread(void *arg ODP_UNUSED)

> +{

> +	int thr = odp_thread_id();

> +	odp_pktout_queue_t pktout;

> +	odp_packet_t pkt;

> +	odp_event_t ev;

> +	uint64_t sched_wait = odp_schedule_wait_time(ODP_TIME_MSEC_IN_NS * 100);

> +

> +	packet_flags.all = 0;

> +

> +	/* Loop packets */

> +	while (1) {

> +		odp_pktio_t pktio_tmp;

> +

> +		ev = odp_schedule(NULL, sched_wait);

> +		if (ev == ODP_EVENT_INVALID)

> +			break;

> +

> +		pkt = odp_packet_from_event(ev);

> +		if (!odp_packet_is_valid(pkt))

> +			continue;

> +

> +		pktio_tmp = odp_packet_input(pkt);

> +

> +		if (odp_pktout_queue(pktio_tmp, &pktout, 1) != 1) {

> +			LOG_ERR("  [%02i] Error: no pktout queue\n", thr);

> +			return -1;

> +		}

> +

> +		/* Extend bits here for more additional tests */

> +		if (odp_packet_has_l2(pkt))

> +			packet_flags.parsed_l2 = 1;

> +		if (odp_packet_has_vlan(pkt))

> +			packet_flags.vlan = 1;

> +

> +		/* Enqueue the packet for output */

> +		if (odp_pktout_send(pktout, &pkt, 1) != 1) {

> +			LOG_ERR("  [%i] Packet send failed.\n", thr);

> +			odp_packet_free(pkt);

> +			continue;

> +		}

> +	}

> +

> +	return 0;

> +}

> +

> +int cls_main(int argc, char *argv[])

> +{

> +	odph_odpthread_t thread_tbl[1];

> +	odp_pool_t pool;

> +	int num_workers;

> +	int i;

> +	int cpu;

> +	odp_cpumask_t cpumask;

> +	char cpumaskstr[ODP_CPUMASK_STR_SIZE];

> +	odp_pool_param_t params;

> +	odp_instance_t instance;

> +	odph_odpthread_params_t thr_params;

> +

> +	args = calloc(1, sizeof(args_t));

> +	if (args == NULL) {

> +		LOG_ERR("Error: args mem alloc failed.\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

> +	parse_args(argc, argv, &args->appl);

> +

> +	/* Init ODP before calling anything else */

> +	if (odp_init_global(&instance, NULL, NULL)) {

> +		LOG_ERR("Error: ODP global init failed.\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

> +	/* Init this thread */

> +	if (odp_init_local(instance, ODP_THREAD_CONTROL)) {

> +		LOG_ERR("Error: ODP local init failed.\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

> +	num_workers = odp_cpumask_default_worker(&cpumask, 1);

> +	(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));

> +

> +	/* Create packet pool */

> +	odp_pool_param_init(&params);

> +	params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;

> +	params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;

> +	params.pkt.num     = SHM_PKT_POOL_SIZE;

> +	params.type        = ODP_POOL_PACKET;

> +

> +	pool = odp_pool_create("packet_pool", &params);

> +	if (pool == ODP_POOL_INVALID) {

> +		LOG_ERR("Error: packet pool create failed.\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

> +	args->appl.pktio = create_pktio(args->appl.file_name, pool);

> +

> +	/* Create and init worker threads */

> +	memset(thread_tbl, 0, sizeof(thread_tbl));

> +

> +	memset(&thr_params, 0, sizeof(thr_params));

> +	thr_params.thr_type = ODP_THREAD_WORKER;

> +	thr_params.instance = instance;

> +

> +	cpu = odp_cpumask_first(&cpumask);

> +	for (i = 0; i < num_workers; ++i) {

> +		odp_cpumask_t thd_mask;

> +		int (*thr_run_func)(void *);

> +

> +		thr_run_func = pktio_queue_thread;

> +		/*

> +		 * Create threads one-by-one instead of all-at-once,

> +		 * because each thread might get different arguments.

> +		 * Calls odp_thread_create(cpu) for each thread

> +		 */

> +		odp_cpumask_zero(&thd_mask);

> +		odp_cpumask_set(&thd_mask, cpu);

> +

> +		thr_params.start = thr_run_func;

> +		thr_params.arg   = &args;

> +

> +		odph_odpthreads_create(&thread_tbl[i], &thd_mask, &thr_params);

> +		cpu = odp_cpumask_next(&cpumask, cpu);

> +	}

> +

> +	/* Master thread waits for other threads to exit */

> +	for (i = 0; i < num_workers; ++i)

> +		odph_odpthreads_join(&thread_tbl[i]);

> +

> +	odp_pktio_stop(args->appl.pktio);

> +	odp_pktio_close(args->appl.pktio);

> +

> +	while (1) {

> +		odp_event_t ev;

> +

> +		ev = odp_schedule(NULL, 0);

> +		if (ev == ODP_EVENT_INVALID)

> +			break;

> +	}

> +

> +	odp_pool_destroy(pool);

> +	odp_term_local();

> +	odp_term_global(instance);

> +

> +	if (packet_flags.all != args->appl.expected_bits.all) {

> +		LOG_ERR("Flags %" PRIu64 " expected %" PRIu64 "\n",

> +			packet_flags.all, args->appl.expected_bits.all);

> +		free(args);

> +		return -1;

> +	}

> +

> +	free(args);

> +	return 0;

> +}

> diff --git a/test/platform/linux-generic/cls/cls_main.c b/test/platform/linux-generic/cls/cls_main.c

> new file mode 100644

> index 0000000..40179b9

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/cls_main.c

> @@ -0,0 +1,12 @@

> +/* Copyright (c) 2016, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include "cls_suites.h"

> +

> +int main(int argc, char *argv[])

> +{

> +	return cls_main(argc, argv);

> +}

> diff --git a/test/platform/linux-generic/cls/cls_suites.h b/test/platform/linux-generic/cls/cls_suites.h

> new file mode 100644

> index 0000000..94c9b55

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/cls_suites.h

> @@ -0,0 +1 @@

> +int cls_main(int argc, char *argv[]);

> diff --git a/test/platform/linux-generic/cls/vlan.pcap b/test/platform/linux-generic/cls/vlan.pcap

> new file mode 100644

> index 0000000000000000000000000000000000000000..106ccb682e51495b4025337518a0bce63c2c7681

> GIT binary patch

> literal 9728

> zcmeHNeQXrR6@R<F^Iq)3b|{=(C16{8IUt}71RM^-2~wIU*pOl>ikyh3QAN~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<lLnYk>-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-<X$<;!oI~ik=uuzyOrT5ATGkaPBO2JlXV}BNmHltQH1XBQqGIxB

> zljw+U^mWzt`dC-+XBzhK8TN2Tj(!$l@3W%oreFHHd@xpu)``6eKOy$gmCxBdp4?km

> zcOk;wono&-@A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platform/linux-generic/cls/vlan_run.sh b/test/platform/linux-generic/cls/vlan_run.sh

> new file mode 100755

> index 0000000..9849abf

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/vlan_run.sh

> @@ -0,0 +1,49 @@

> +#!/bin/sh

> +#

> +# Copyright (c) 2016, Linaro Limited

> +# All rights reserved.

> +#

> +# SPDX-License-Identifier:      BSD-3-Clause

> +#

> +

> +# 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 _build directory, when running after 'make distcheck',

> +# -in the current directory.

> +# running stand alone out of tree requires setting PATH

> +PATH=${TEST_DIR}/pktio:$PATH

> +PATH=$(dirname $0):$PATH

> +PATH=$(dirname $0)/../../../../test/platform/linux-generic/cls:$PATH

> +PATH=$(dirname $0)/../../../../_build/test/platform/linux-generic/cls:$PATH

> +PATH=.:$PATH

> +

> +bin_path=$(which cls_main${EXEEXT})

> +if [ -x "$bin_path" ] ; then

> +	echo "Running with $bin_path"

> +else

> +	echo "Cannot find cls_main${EXEEXT}"

> +	echo "Please set you PATH for it. PATH=$PATH"

> +fi

> +

> +# Test1: find vlan packets in pcap file and test internal pkt_mmap_vlan_insert()

> +#	 function. Load packets from vlan.pcap file and check that classifier

> +#	 set vlan bits fisible with odp_packet_has_vlan().

> +

> +PCAP=`find . ${TEST_DIR} $(dirname $0) -name vlan.pcap -print -quit`

> +

> +cls_main -i $PCAP -e 4097

> +ret=$?

> +

> +PCAP_IN_SIZE=`stat -c %s $PCAP`

> +PCAP_OUT_SIZE=`stat -c %s test_out.pcap`

> +

> +rm -f test_out.pcap

> +

> +if [ ${ret} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then

> +	echo "Error: status ${ret}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"

> +	exit 3

> +fi

> +

> +echo "PASS: test 1 passed"

> diff --git a/test/platform/linux-generic/m4/configure.m4 b/test/platform/linux-generic/m4/configure.m4

> index 8c3db21..eb50756 100644

> --- a/test/platform/linux-generic/m4/configure.m4

> +++ b/test/platform/linux-generic/m4/configure.m4

> @@ -1,4 +1,5 @@

>   AC_CONFIG_FILES([test/platform/linux-generic/Makefile

> +		 test/platform/linux-generic/cls/Makefile

>   		 test/platform/linux-generic/shmem/Makefile

>   		 test/platform/linux-generic/pktio/Makefile

>   		 test/platform/linux-generic/pktio_ipc/Makefile
Mike Holmes July 12, 2016, 5:53 p.m. UTC | #2
Bala

I think this approach solves the various classifier use cases also doesn't
it ?

On 12 July 2016 at 09:13, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> ping

>

>

> On 07/08/16 16:59, Maxim Uvarov wrote:

>

>> add pcap play back test which takes 2 arguments: 1 - pcap file,

>> 2 - packet mask to match. Intend is to test odp with different

>> input traffic to check internal implementation functions. In

>> current case it's test for vlan tag instertion for packet mmap:

>> pkt_mmap_vlan_insert().

>>

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

>> ---

>>   test/platform/linux-generic/.gitignore       |   1 +

>>   test/platform/linux-generic/Makefile.am      |  12 +-

>>   test/platform/linux-generic/cls/.gitignore   |   3 +

>>   test/platform/linux-generic/cls/Makefile.am  |  13 +

>>   test/platform/linux-generic/cls/cls.c        | 349

>> +++++++++++++++++++++++++++

>>   test/platform/linux-generic/cls/cls_main.c   |  12 +

>>   test/platform/linux-generic/cls/cls_suites.h |   1 +

>>   test/platform/linux-generic/cls/vlan.pcap    | Bin 0 -> 9728 bytes

>>   test/platform/linux-generic/cls/vlan_run.sh  |  49 ++++

>>   test/platform/linux-generic/m4/configure.m4  |   1 +

>>   10 files changed, 436 insertions(+), 5 deletions(-)

>>   create mode 100644 test/platform/linux-generic/cls/.gitignore

>>   create mode 100644 test/platform/linux-generic/cls/Makefile.am

>>   create mode 100644 test/platform/linux-generic/cls/cls.c

>>   create mode 100644 test/platform/linux-generic/cls/cls_main.c

>>   create mode 100644 test/platform/linux-generic/cls/cls_suites.h

>>   create mode 100644 test/platform/linux-generic/cls/vlan.pcap

>>   create mode 100755 test/platform/linux-generic/cls/vlan_run.sh

>>

>> diff --git a/test/platform/linux-generic/.gitignore

>> b/test/platform/linux-generic/.gitignore

>> index 5dabf91..f65c7c1 100644

>> --- a/test/platform/linux-generic/.gitignore

>> +++ b/test/platform/linux-generic/.gitignore

>> @@ -1,3 +1,4 @@

>>   *.log

>>   *.trs

>>   tests-validation.env

>> +test_out.pcap

>> diff --git a/test/platform/linux-generic/Makefile.am

>> b/test/platform/linux-generic/Makefile.am

>> index 2d58c57..df6e950 100644

>> --- a/test/platform/linux-generic/Makefile.am

>> +++ b/test/platform/linux-generic/Makefile.am

>> @@ -1,7 +1,9 @@

>>   include $(top_srcdir)/test/Makefile.inc

>>   TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation

>> +TEST_EXTENSIONS = .sh

>>   -ODP_MODULES = pktio \

>> +ODP_MODULES = cls \

>> +             pktio \

>>               ring \

>>               shmem

>>   @@ -37,7 +39,11 @@ TESTS = pktio/pktio_run.sh \

>>     SUBDIRS = $(ODP_MODULES)

>>   +dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)

>> +

>>   if HAVE_PCAP

>> +TESTS += cls/vlan_run.sh

>> +dist_check_SCRIPTS += cls/vlan_run.sh cls/vlan.pcap

>>   TESTS += pktio/pktio_run_pcap.sh

>>   endif

>>   if PKTIO_IPC

>> @@ -52,10 +58,6 @@ TESTS += pktio/pktio_run_dpdk.sh

>>   endif

>>   endif

>>   -TEST_EXTENSIONS = .sh

>> -

>> -dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)

>> -

>>   test_SCRIPTS = $(dist_check_SCRIPTS)

>>     tests-validation.env:

>> diff --git a/test/platform/linux-generic/cls/.gitignore

>> b/test/platform/linux-generic/cls/.gitignore

>> new file mode 100644

>> index 0000000..9447625

>> --- /dev/null

>> +++ b/test/platform/linux-generic/cls/.gitignore

>> @@ -0,0 +1,3 @@

>> +cls_main

>> +*.log

>> +*.trs

>> diff --git a/test/platform/linux-generic/cls/Makefile.am

>> b/test/platform/linux-generic/cls/Makefile.am

>> new file mode 100644

>> index 0000000..43fb0bc

>> --- /dev/null

>> +++ b/test/platform/linux-generic/cls/Makefile.am

>> @@ -0,0 +1,13 @@

>> +include ../Makefile.inc

>> +

>> +noinst_LTLIBRARIES = libtestcls.la

>> +libtestcls_la_SOURCES = cls.c

>> +libtestcls_la_CFLAGS = $(AM_CFLAGS) $(INCCUNIT_COMMON) $(INCODP)

>> +

>> +test_PROGRAMS = cls_main$(EXEEXT)

>> +dist_cls_main_SOURCES = cls_main.c

>> +

>> +cls_main_LDFLAGS = $(AM_LDFLAGS)

>> +cls_main_LDADD = libtestcls.la $(LIBCUNIT_COMMON) $(LIBODP)

>> +

>> +noinst_HEADERS = cls_suites.h

>> diff --git a/test/platform/linux-generic/cls/cls.c

>> b/test/platform/linux-generic/cls/cls.c

>> new file mode 100644

>> index 0000000..d527ec8

>> --- /dev/null

>> +++ b/test/platform/linux-generic/cls/cls.c

>> @@ -0,0 +1,349 @@

>> +/* Copyright (c) 2016, Linaro Limited

>> + * All rights reserved.

>> + *

>> + * SPDX-License-Identifier:     BSD-3-Clause

>> + */

>> +

>> +#include <stdlib.h>

>> +#include <string.h>

>> +#include <getopt.h>

>> +#include <unistd.h>

>> +#include <inttypes.h>

>> +

>> +#include <test_debug.h>

>> +

>> +#include <odp_api.h>

>> +#include <odp/helper/linux.h>

>> +#include <odp/helper/eth.h>

>> +#include <odp/helper/ip.h>

>> +

>> +#include <odp_packet_internal.h>

>> +

>> +#include "cls_suites.h"

>> +

>> +/** Get rid of path in filename - only for unix-type paths using '/' */

>> +#define NO_PATH(file_name) (strrchr((file_name), '/') ? \

>> +                           strrchr((file_name), '/') + 1 : (file_name))

>> +

>> +/**

>> + * Print usage information

>> + */

>> +static void usage(char *progname)

>> +{

>> +       printf("\n"

>> +              "This is test application to verify that linux-generic

>> classifier\n"

>> +              "correctly classifies packets on input. Main intend is add

>> more code\n"

>> +              "coverage for internal functions playing different traffic

>> recorded to\n"

>> +              "pcap files."

>> +              "\n"

>> +              "Usage: %s OPTIONS\n"

>> +              "  E.g. %s -i pcap_file -e expected_bitmask\n"

>> +              "\n"

>> +              "Mandatory OPTIONS:\n"

>> +              "  -i, pcap file name\n"

>> +              "  -e, expected packet bitmask\n"

>> +              "\n", NO_PATH(progname), NO_PATH(progname)

>> +           );

>> +}

>> +

>> +/** @def SHM_PKT_POOL_SIZE

>> + * @brief Size of the shared memory block

>> + */

>> +#define SHM_PKT_POOL_SIZE      512

>> +

>> +/** @def SHM_PKT_POOL_BUF_SIZE

>> + * @brief Buffer size of the packet pool buffer

>> + */

>> +#define SHM_PKT_POOL_BUF_SIZE  1856

>> +

>> +/**

>> + * Parsed command line application arguments

>> + */

>> +typedef struct {

>> +       char *file_name;     /**< File name for pcap pktio */

>> +       odp_pktio_t pktio;  /**< Pktio dev */

>> +       input_flags_t expected_bits; /**< Expected bits from test run */

>> +} appl_args_t;

>> +

>> +/**

>> + * Grouping of both parsed CL args and thread specific args - alloc

>> together

>> + */

>> +typedef struct {

>> +       /** Application (parsed) arguments */

>> +       appl_args_t appl;

>> +} args_t;

>> +

>> +/** Global pointer to args */

>> +static args_t *args;

>> +/** Fill this bit struct to check which packet fields were classified */

>> +static input_flags_t packet_flags;

>> +

>> +/**

>> + * Parse and store the command line arguments

>> + *

>> + * @param argc       argument count

>> + * @param argv[]     argument vector

>> + * @param appl_args  Store application arguments here

>> + */

>> +static void parse_args(int argc, char *argv[], appl_args_t *appl_args)

>> +{

>> +       int opt;

>> +       int long_index;

>> +       static const struct option longopts[] = {

>> +               {"interface", required_argument, NULL, 'i'},    /* return

>> 'i' */

>> +               {"extected", required_argument, NULL, 'e'},     /* return

>> 'e' */

>> +               {"help", no_argument, NULL, 'h'},               /* return

>> 'h' */

>> +               {NULL, 0, NULL, 0}

>> +       };

>> +

>> +       static const char *shortopts = ":i:e:h";

>> +

>> +       /* let helper collect its own arguments (e.g. --odph_proc) */

>> +       odph_parse_options(argc, argv, shortopts, longopts);

>> +

>> +       appl_args->file_name = NULL;

>> +       opterr = 0; /* do not issue errors on helper options */

>> +       appl_args->expected_bits.all = 0;

>> +

>> +       while (1) {

>> +               opt = getopt_long(argc, argv, shortopts, longopts,

>> &long_index);

>> +

>> +               if (opt == -1)

>> +                       break;  /* No more options */

>> +

>> +               switch (opt) {

>> +               case 'i':

>> +                       appl_args->file_name =  optarg;

>> +                       break;

>> +               case 'e':

>> +                       appl_args->expected_bits.all = atoll(optarg);

>> +                       break;

>> +

>> +               case 'h':

>> +                       usage(argv[0]);

>> +                       exit(EXIT_SUCCESS);

>> +                       break;

>> +               default:

>> +                       break;

>> +               }

>> +       }

>> +

>> +       if (!appl_args->file_name) {

>> +               usage(argv[0]);

>> +               exit(EXIT_SUCCESS);

>> +       }

>> +

>> +       optind = 1;             /* reset 'extern optind' from the getopt

>> lib */

>> +}

>> +

>> +/**

>> + * Create a pktio handle, optionally associating a default input queue.

>> + *

>> + * @param dev Name of device to open

>> + * @param pool Pool to associate with device for packet RX/TX

>> + * @param mode Packet processing mode for this device (BURST or QUEUE)

>> + *

>> + * @return The handle of the created pktio object.

>> + * @retval ODP_PKTIO_INVALID if the create fails.

>> + */

>> +static odp_pktio_t create_pktio(const char *fname, odp_pool_t pool)

>> +{

>> +       odp_pktio_t pktio;

>> +       int ret;

>> +       odp_pktio_param_t pktio_param;

>> +       odp_pktin_queue_param_t pktin_param;

>> +       char dev[255];

>> +

>> +       odp_pktio_param_init(&pktio_param);

>> +       pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;

>> +

>> +       memset(dev, 0, 255);

>> +       sprintf(dev, "pcap:in=%s:out=test_out.pcap",  fname);

>> +

>> +       /* Open a packet IO instance */

>> +       pktio = odp_pktio_open(dev, pool, &pktio_param);

>> +       if (pktio == ODP_PKTIO_INVALID)

>> +               LOG_ABORT("Error: pktio create failed for %s\n", dev);

>> +

>> +       odp_pktin_queue_param_init(&pktin_param);

>> +

>> +       pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;

>> +

>> +       if (odp_pktin_queue_config(pktio, &pktin_param))

>> +               LOG_ABORT("Error: pktin config failed for %s\n", dev);

>> +

>> +       if (odp_pktout_queue_config(pktio, NULL))

>> +               LOG_ABORT("Error: pktout config failed for %s\n", dev);

>> +

>> +       ret = odp_pktio_start(pktio);

>> +       if (ret != 0)

>> +               LOG_ABORT("Error: unable to start %s\n", dev);

>> +

>> +       printf("  created pktio:%02" PRIu64

>> +              ", dev:%s, queue mode (ATOMIC queues)\n"

>> +              "  \tdefault pktio%02" PRIu64 "\n",

>> +              odp_pktio_to_u64(pktio), dev,

>> +              odp_pktio_to_u64(pktio));

>> +

>> +       return pktio;

>> +}

>> +

>> +/**

>> + * Packet IO loopback worker thread using ODP queues

>> + *

>> + * @param arg  thread arguments of type 'thread_args_t *'

>> + */

>> +static int pktio_queue_thread(void *arg ODP_UNUSED)

>> +{

>> +       int thr = odp_thread_id();

>> +       odp_pktout_queue_t pktout;

>> +       odp_packet_t pkt;

>> +       odp_event_t ev;

>> +       uint64_t sched_wait = odp_schedule_wait_time(ODP_TIME_MSEC_IN_NS

>> * 100);

>> +

>> +       packet_flags.all = 0;

>> +

>> +       /* Loop packets */

>> +       while (1) {

>> +               odp_pktio_t pktio_tmp;

>> +

>> +               ev = odp_schedule(NULL, sched_wait);

>> +               if (ev == ODP_EVENT_INVALID)

>> +                       break;

>> +

>> +               pkt = odp_packet_from_event(ev);

>> +               if (!odp_packet_is_valid(pkt))

>> +                       continue;

>> +

>> +               pktio_tmp = odp_packet_input(pkt);

>> +

>> +               if (odp_pktout_queue(pktio_tmp, &pktout, 1) != 1) {

>> +                       LOG_ERR("  [%02i] Error: no pktout queue\n", thr);

>> +                       return -1;

>> +               }

>> +

>> +               /* Extend bits here for more additional tests */

>> +               if (odp_packet_has_l2(pkt))

>> +                       packet_flags.parsed_l2 = 1;

>> +               if (odp_packet_has_vlan(pkt))

>> +                       packet_flags.vlan = 1;

>> +

>> +               /* Enqueue the packet for output */

>> +               if (odp_pktout_send(pktout, &pkt, 1) != 1) {

>> +                       LOG_ERR("  [%i] Packet send failed.\n", thr);

>> +                       odp_packet_free(pkt);

>> +                       continue;

>> +               }

>> +       }

>> +

>> +       return 0;

>> +}

>> +

>> +int cls_main(int argc, char *argv[])

>> +{

>> +       odph_odpthread_t thread_tbl[1];

>> +       odp_pool_t pool;

>> +       int num_workers;

>> +       int i;

>> +       int cpu;

>> +       odp_cpumask_t cpumask;

>> +       char cpumaskstr[ODP_CPUMASK_STR_SIZE];

>> +       odp_pool_param_t params;

>> +       odp_instance_t instance;

>> +       odph_odpthread_params_t thr_params;

>> +

>> +       args = calloc(1, sizeof(args_t));

>> +       if (args == NULL) {

>> +               LOG_ERR("Error: args mem alloc failed.\n");

>> +               exit(EXIT_FAILURE);

>> +       }

>> +

>> +       parse_args(argc, argv, &args->appl);

>> +

>> +       /* Init ODP before calling anything else */

>> +       if (odp_init_global(&instance, NULL, NULL)) {

>> +               LOG_ERR("Error: ODP global init failed.\n");

>> +               exit(EXIT_FAILURE);

>> +       }

>> +

>> +       /* Init this thread */

>> +       if (odp_init_local(instance, ODP_THREAD_CONTROL)) {

>> +               LOG_ERR("Error: ODP local init failed.\n");

>> +               exit(EXIT_FAILURE);

>> +       }

>> +

>> +       num_workers = odp_cpumask_default_worker(&cpumask, 1);

>> +       (void)odp_cpumask_to_str(&cpumask, cpumaskstr,

>> sizeof(cpumaskstr));

>> +

>> +       /* Create packet pool */

>> +       odp_pool_param_init(&params);

>> +       params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;

>> +       params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;

>> +       params.pkt.num     = SHM_PKT_POOL_SIZE;

>> +       params.type        = ODP_POOL_PACKET;

>> +

>> +       pool = odp_pool_create("packet_pool", &params);

>> +       if (pool == ODP_POOL_INVALID) {

>> +               LOG_ERR("Error: packet pool create failed.\n");

>> +               exit(EXIT_FAILURE);

>> +       }

>> +

>> +       args->appl.pktio = create_pktio(args->appl.file_name, pool);

>> +

>> +       /* Create and init worker threads */

>> +       memset(thread_tbl, 0, sizeof(thread_tbl));

>> +

>> +       memset(&thr_params, 0, sizeof(thr_params));

>> +       thr_params.thr_type = ODP_THREAD_WORKER;

>> +       thr_params.instance = instance;

>> +

>> +       cpu = odp_cpumask_first(&cpumask);

>> +       for (i = 0; i < num_workers; ++i) {

>> +               odp_cpumask_t thd_mask;

>> +               int (*thr_run_func)(void *);

>> +

>> +               thr_run_func = pktio_queue_thread;

>> +               /*

>> +                * Create threads one-by-one instead of all-at-once,

>> +                * because each thread might get different arguments.

>> +                * Calls odp_thread_create(cpu) for each thread

>> +                */

>> +               odp_cpumask_zero(&thd_mask);

>> +               odp_cpumask_set(&thd_mask, cpu);

>> +

>> +               thr_params.start = thr_run_func;

>> +               thr_params.arg   = &args;

>> +

>> +               odph_odpthreads_create(&thread_tbl[i], &thd_mask,

>> &thr_params);

>> +               cpu = odp_cpumask_next(&cpumask, cpu);

>> +       }

>> +

>> +       /* Master thread waits for other threads to exit */

>> +       for (i = 0; i < num_workers; ++i)

>> +               odph_odpthreads_join(&thread_tbl[i]);

>> +

>> +       odp_pktio_stop(args->appl.pktio);

>> +       odp_pktio_close(args->appl.pktio);

>> +

>> +       while (1) {

>> +               odp_event_t ev;

>> +

>> +               ev = odp_schedule(NULL, 0);

>> +               if (ev == ODP_EVENT_INVALID)

>> +                       break;

>> +       }

>> +

>> +       odp_pool_destroy(pool);

>> +       odp_term_local();

>> +       odp_term_global(instance);

>> +

>> +       if (packet_flags.all != args->appl.expected_bits.all) {

>> +               LOG_ERR("Flags %" PRIu64 " expected %" PRIu64 "\n",

>> +                       packet_flags.all, args->appl.expected_bits.all);

>> +               free(args);

>> +               return -1;

>> +       }

>> +

>> +       free(args);

>> +       return 0;

>> +}

>> diff --git a/test/platform/linux-generic/cls/cls_main.c

>> b/test/platform/linux-generic/cls/cls_main.c

>> new file mode 100644

>> index 0000000..40179b9

>> --- /dev/null

>> +++ b/test/platform/linux-generic/cls/cls_main.c

>> @@ -0,0 +1,12 @@

>> +/* Copyright (c) 2016, Linaro Limited

>> + * All rights reserved.

>> + *

>> + * SPDX-License-Identifier:     BSD-3-Clause

>> + */

>> +

>> +#include "cls_suites.h"

>> +

>> +int main(int argc, char *argv[])

>> +{

>> +       return cls_main(argc, argv);

>> +}

>> diff --git a/test/platform/linux-generic/cls/cls_suites.h

>> b/test/platform/linux-generic/cls/cls_suites.h

>> new file mode 100644

>> index 0000000..94c9b55

>> --- /dev/null

>> +++ b/test/platform/linux-generic/cls/cls_suites.h

>> @@ -0,0 +1 @@

>> +int cls_main(int argc, char *argv[]);

>> diff --git a/test/platform/linux-generic/cls/vlan.pcap

>> b/test/platform/linux-generic/cls/vlan.pcap

>> new file mode 100644

>> index

>> 0000000000000000000000000000000000000000..106ccb682e51495b4025337518a0bce63c2c7681

>> GIT binary patch

>> literal 9728

>> zcmeHNeQXrR6@R<F^Iq)3b|{=(C16{8IUt}71RM^-2~wIU*pOl>ikyh3QAN~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<lLnYk>-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-<X$<;!oI~ik=uuzyOrT5ATGkaPBO2JlXV}BNmHltQH1XBQqGIxB

>> zljw+U^mWzt`dC-+XBzhK8TN2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J^yz0(2S+l^`1m3)&VifIih&fKFqf!Wckb+_euHkKzNjM0<@#!v|j%=L2j_

>> H$A|v_$relS

>>

>> literal 0

>> HcmV?d00001

>>

>> diff --git a/test/platform/linux-generic/cls/vlan_run.sh

>> b/test/platform/linux-generic/cls/vlan_run.sh

>> new file mode 100755

>> index 0000000..9849abf

>> --- /dev/null

>> +++ b/test/platform/linux-generic/cls/vlan_run.sh

>> @@ -0,0 +1,49 @@

>> +#!/bin/sh

>> +#

>> +# Copyright (c) 2016, Linaro Limited

>> +# All rights reserved.

>> +#

>> +# SPDX-License-Identifier:      BSD-3-Clause

>> +#

>> +

>> +# 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 _build directory, when running after 'make distcheck',

>> +# -in the current directory.

>> +# running stand alone out of tree requires setting PATH

>> +PATH=${TEST_DIR}/pktio:$PATH

>> +PATH=$(dirname $0):$PATH

>> +PATH=$(dirname $0)/../../../../test/platform/linux-generic/cls:$PATH

>> +PATH=$(dirname

>> $0)/../../../../_build/test/platform/linux-generic/cls:$PATH

>> +PATH=.:$PATH

>> +

>> +bin_path=$(which cls_main${EXEEXT})

>> +if [ -x "$bin_path" ] ; then

>> +       echo "Running with $bin_path"

>> +else

>> +       echo "Cannot find cls_main${EXEEXT}"

>> +       echo "Please set you PATH for it. PATH=$PATH"

>> +fi

>> +

>> +# Test1: find vlan packets in pcap file and test internal

>> pkt_mmap_vlan_insert()

>> +#       function. Load packets from vlan.pcap file and check that

>> classifier

>> +#       set vlan bits fisible with odp_packet_has_vlan().

>> +

>> +PCAP=`find . ${TEST_DIR} $(dirname $0) -name vlan.pcap -print -quit`

>> +

>> +cls_main -i $PCAP -e 4097

>> +ret=$?

>> +

>> +PCAP_IN_SIZE=`stat -c %s $PCAP`

>> +PCAP_OUT_SIZE=`stat -c %s test_out.pcap`

>> +

>> +rm -f test_out.pcap

>> +

>> +if [ ${ret} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then

>> +       echo "Error: status ${ret}, in:${PCAP_IN_SIZE}

>> out:${PCAP_OUT_SIZE}"

>> +       exit 3

>> +fi

>> +

>> +echo "PASS: test 1 passed"

>> diff --git a/test/platform/linux-generic/m4/configure.m4

>> b/test/platform/linux-generic/m4/configure.m4

>> index 8c3db21..eb50756 100644

>> --- a/test/platform/linux-generic/m4/configure.m4

>> +++ b/test/platform/linux-generic/m4/configure.m4

>> @@ -1,4 +1,5 @@

>>   AC_CONFIG_FILES([test/platform/linux-generic/Makefile

>> +                test/platform/linux-generic/cls/Makefile

>>                  test/platform/linux-generic/shmem/Makefile

>>                  test/platform/linux-generic/pktio/Makefile

>>                  test/platform/linux-generic/pktio_ipc/Makefile

>>

>

>



-- 
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"
Bill Fischofer July 13, 2016, 7:32 p.m. UTC | #3
This applies and compiles fine, but I'm not sure how I'm supposed to run
it.  Does this require sudo?  Neither with or without seems to work for me:

bill@Ubuntu15:~/linaro/maxim/test/platform/linux-generic/cls$ echo $TEST_DIR
/home/bill/linaro/maxim/test/platform/linux-generic/cls
bill@Ubuntu15:~/linaro/maxim/test/platform/linux-generic/cls$ ./vlan_run.sh
Running with ./cls_main
pktio/socket_mmap.c:76:mmap_pkt_socket():socket(SOCK_RAW): Operation not
permitted
pktio/socket.c:507:sock_setup_pkt():socket(): Operation not permitted
odp_packet_io.c:224:setup_pktio_entry():Unable to init any I/O type.
cls.c:166:create_pktio(): Error: pktio create failed for
pcap:in=./vlan.pcap:out=test_out.pcap
Aborted (core dumped)
stat: cannot stat 'test_out.pcap': No such file or directory
Error: status 134, in:9728 out:

bill@Ubuntu15:~/linaro/maxim/test/platform/linux-generic/cls$ sudo
./vlan_run.shRunning with ./cls_main
pktio/socket.c:112:mac_addr_get_fd():ioctl(SIOCGIFHWADDR): No such device:
"pcap:in=./vlan.".
pktio/socket.c:519:sock_setup_pkt():ioctl(SIOCGIFINDEX): No such device:
"pcap:in=./vlan.".
odp_packet_io.c:224:setup_pktio_entry():Unable to init any I/O type.
cls.c:166:create_pktio(): Error: pktio create failed for
pcap:in=./vlan.pcap:out=test_out.pcap
Aborted (core dumped)
stat: cannot stat 'test_out.pcap': No such file or directory
Error: status 134, in:9728 out:
bill@Ubuntu15:~/linaro/maxim/test/platform/linux-generic/cl

On Fri, Jul 8, 2016 at 8:59 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> add pcap play back test which takes 2 arguments: 1 - pcap file,

> 2 - packet mask to match. Intend is to test odp with different

> input traffic to check internal implementation functions. In

> current case it's test for vlan tag instertion for packet mmap:

> pkt_mmap_vlan_insert().

>

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

> ---

>  test/platform/linux-generic/.gitignore       |   1 +

>  test/platform/linux-generic/Makefile.am      |  12 +-

>  test/platform/linux-generic/cls/.gitignore   |   3 +

>  test/platform/linux-generic/cls/Makefile.am  |  13 +

>  test/platform/linux-generic/cls/cls.c        | 349

> +++++++++++++++++++++++++++

>  test/platform/linux-generic/cls/cls_main.c   |  12 +

>  test/platform/linux-generic/cls/cls_suites.h |   1 +

>  test/platform/linux-generic/cls/vlan.pcap    | Bin 0 -> 9728 bytes

>  test/platform/linux-generic/cls/vlan_run.sh  |  49 ++++

>  test/platform/linux-generic/m4/configure.m4  |   1 +

>  10 files changed, 436 insertions(+), 5 deletions(-)

>  create mode 100644 test/platform/linux-generic/cls/.gitignore

>  create mode 100644 test/platform/linux-generic/cls/Makefile.am

>  create mode 100644 test/platform/linux-generic/cls/cls.c

>  create mode 100644 test/platform/linux-generic/cls/cls_main.c

>  create mode 100644 test/platform/linux-generic/cls/cls_suites.h

>  create mode 100644 test/platform/linux-generic/cls/vlan.pcap

>  create mode 100755 test/platform/linux-generic/cls/vlan_run.sh

>

> diff --git a/test/platform/linux-generic/.gitignore

> b/test/platform/linux-generic/.gitignore

> index 5dabf91..f65c7c1 100644

> --- a/test/platform/linux-generic/.gitignore

> +++ b/test/platform/linux-generic/.gitignore

> @@ -1,3 +1,4 @@

>  *.log

>  *.trs

>  tests-validation.env

> +test_out.pcap

> diff --git a/test/platform/linux-generic/Makefile.am

> b/test/platform/linux-generic/Makefile.am

> index 2d58c57..df6e950 100644

> --- a/test/platform/linux-generic/Makefile.am

> +++ b/test/platform/linux-generic/Makefile.am

> @@ -1,7 +1,9 @@

>  include $(top_srcdir)/test/Makefile.inc

>  TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation

> +TEST_EXTENSIONS = .sh

>

> -ODP_MODULES = pktio \

> +ODP_MODULES = cls \

> +             pktio \

>               ring \

>               shmem

>

> @@ -37,7 +39,11 @@ TESTS = pktio/pktio_run.sh \

>

>  SUBDIRS = $(ODP_MODULES)

>

> +dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)

> +

>  if HAVE_PCAP

> +TESTS += cls/vlan_run.sh

> +dist_check_SCRIPTS += cls/vlan_run.sh cls/vlan.pcap

>  TESTS += pktio/pktio_run_pcap.sh

>  endif

>  if PKTIO_IPC

> @@ -52,10 +58,6 @@ TESTS += pktio/pktio_run_dpdk.sh

>  endif

>  endif

>

> -TEST_EXTENSIONS = .sh

> -

> -dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)

> -

>  test_SCRIPTS = $(dist_check_SCRIPTS)

>

>  tests-validation.env:

> diff --git a/test/platform/linux-generic/cls/.gitignore

> b/test/platform/linux-generic/cls/.gitignore

> new file mode 100644

> index 0000000..9447625

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/.gitignore

> @@ -0,0 +1,3 @@

> +cls_main

> +*.log

> +*.trs

> diff --git a/test/platform/linux-generic/cls/Makefile.am

> b/test/platform/linux-generic/cls/Makefile.am

> new file mode 100644

> index 0000000..43fb0bc

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/Makefile.am

> @@ -0,0 +1,13 @@

> +include ../Makefile.inc

> +

> +noinst_LTLIBRARIES = libtestcls.la

> +libtestcls_la_SOURCES = cls.c

> +libtestcls_la_CFLAGS = $(AM_CFLAGS) $(INCCUNIT_COMMON) $(INCODP)

> +

> +test_PROGRAMS = cls_main$(EXEEXT)

> +dist_cls_main_SOURCES = cls_main.c

> +

> +cls_main_LDFLAGS = $(AM_LDFLAGS)

> +cls_main_LDADD = libtestcls.la $(LIBCUNIT_COMMON) $(LIBODP)

> +

> +noinst_HEADERS = cls_suites.h

> diff --git a/test/platform/linux-generic/cls/cls.c

> b/test/platform/linux-generic/cls/cls.c

> new file mode 100644

> index 0000000..d527ec8

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/cls.c

> @@ -0,0 +1,349 @@

> +/* Copyright (c) 2016, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdlib.h>

> +#include <string.h>

> +#include <getopt.h>

> +#include <unistd.h>

> +#include <inttypes.h>

> +

> +#include <test_debug.h>

> +

> +#include <odp_api.h>

> +#include <odp/helper/linux.h>

> +#include <odp/helper/eth.h>

> +#include <odp/helper/ip.h>

> +

> +#include <odp_packet_internal.h>

> +

> +#include "cls_suites.h"

> +

> +/** Get rid of path in filename - only for unix-type paths using '/' */

> +#define NO_PATH(file_name) (strrchr((file_name), '/') ? \

> +                           strrchr((file_name), '/') + 1 : (file_name))

> +

> +/**

> + * Print usage information

> + */

> +static void usage(char *progname)

> +{

> +       printf("\n"

> +              "This is test application to verify that linux-generic

> classifier\n"

> +              "correctly classifies packets on input. Main intend is add

> more code\n"

> +              "coverage for internal functions playing different traffic

> recorded to\n"

> +              "pcap files."

> +              "\n"

> +              "Usage: %s OPTIONS\n"

> +              "  E.g. %s -i pcap_file -e expected_bitmask\n"

> +              "\n"

> +              "Mandatory OPTIONS:\n"

> +              "  -i, pcap file name\n"

> +              "  -e, expected packet bitmask\n"

> +              "\n", NO_PATH(progname), NO_PATH(progname)

> +           );

> +}

> +

> +/** @def SHM_PKT_POOL_SIZE

> + * @brief Size of the shared memory block

> + */

> +#define SHM_PKT_POOL_SIZE      512

> +

> +/** @def SHM_PKT_POOL_BUF_SIZE

> + * @brief Buffer size of the packet pool buffer

> + */

> +#define SHM_PKT_POOL_BUF_SIZE  1856

> +

> +/**

> + * Parsed command line application arguments

> + */

> +typedef struct {

> +       char *file_name;     /**< File name for pcap pktio */

> +       odp_pktio_t pktio;  /**< Pktio dev */

> +       input_flags_t expected_bits; /**< Expected bits from test run */

> +} appl_args_t;

> +

> +/**

> + * Grouping of both parsed CL args and thread specific args - alloc

> together

> + */

> +typedef struct {

> +       /** Application (parsed) arguments */

> +       appl_args_t appl;

> +} args_t;

> +

> +/** Global pointer to args */

> +static args_t *args;

> +/** Fill this bit struct to check which packet fields were classified */

> +static input_flags_t packet_flags;

> +

> +/**

> + * Parse and store the command line arguments

> + *

> + * @param argc       argument count

> + * @param argv[]     argument vector

> + * @param appl_args  Store application arguments here

> + */

> +static void parse_args(int argc, char *argv[], appl_args_t *appl_args)

> +{

> +       int opt;

> +       int long_index;

> +       static const struct option longopts[] = {

> +               {"interface", required_argument, NULL, 'i'},    /* return

> 'i' */

> +               {"extected", required_argument, NULL, 'e'},     /* return

> 'e' */

> +               {"help", no_argument, NULL, 'h'},               /* return

> 'h' */

> +               {NULL, 0, NULL, 0}

> +       };

> +

> +       static const char *shortopts = ":i:e:h";

> +

> +       /* let helper collect its own arguments (e.g. --odph_proc) */

> +       odph_parse_options(argc, argv, shortopts, longopts);

> +

> +       appl_args->file_name = NULL;

> +       opterr = 0; /* do not issue errors on helper options */

> +       appl_args->expected_bits.all = 0;

> +

> +       while (1) {

> +               opt = getopt_long(argc, argv, shortopts, longopts,

> &long_index);

> +

> +               if (opt == -1)

> +                       break;  /* No more options */

> +

> +               switch (opt) {

> +               case 'i':

> +                       appl_args->file_name =  optarg;

> +                       break;

> +               case 'e':

> +                       appl_args->expected_bits.all = atoll(optarg);

> +                       break;

> +

> +               case 'h':

> +                       usage(argv[0]);

> +                       exit(EXIT_SUCCESS);

> +                       break;

> +               default:

> +                       break;

> +               }

> +       }

> +

> +       if (!appl_args->file_name) {

> +               usage(argv[0]);

> +               exit(EXIT_SUCCESS);

> +       }

> +

> +       optind = 1;             /* reset 'extern optind' from the getopt

> lib */

> +}

> +

> +/**

> + * Create a pktio handle, optionally associating a default input queue.

> + *

> + * @param dev Name of device to open

> + * @param pool Pool to associate with device for packet RX/TX

> + * @param mode Packet processing mode for this device (BURST or QUEUE)

> + *

> + * @return The handle of the created pktio object.

> + * @retval ODP_PKTIO_INVALID if the create fails.

> + */

> +static odp_pktio_t create_pktio(const char *fname, odp_pool_t pool)

> +{

> +       odp_pktio_t pktio;

> +       int ret;

> +       odp_pktio_param_t pktio_param;

> +       odp_pktin_queue_param_t pktin_param;

> +       char dev[255];

> +

> +       odp_pktio_param_init(&pktio_param);

> +       pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;

> +

> +       memset(dev, 0, 255);

> +       sprintf(dev, "pcap:in=%s:out=test_out.pcap",  fname);

> +

> +       /* Open a packet IO instance */

> +       pktio = odp_pktio_open(dev, pool, &pktio_param);

> +       if (pktio == ODP_PKTIO_INVALID)

> +               LOG_ABORT("Error: pktio create failed for %s\n", dev);

> +

> +       odp_pktin_queue_param_init(&pktin_param);

> +

> +       pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;

> +

> +       if (odp_pktin_queue_config(pktio, &pktin_param))

> +               LOG_ABORT("Error: pktin config failed for %s\n", dev);

> +

> +       if (odp_pktout_queue_config(pktio, NULL))

> +               LOG_ABORT("Error: pktout config failed for %s\n", dev);

> +

> +       ret = odp_pktio_start(pktio);

> +       if (ret != 0)

> +               LOG_ABORT("Error: unable to start %s\n", dev);

> +

> +       printf("  created pktio:%02" PRIu64

> +              ", dev:%s, queue mode (ATOMIC queues)\n"

> +              "  \tdefault pktio%02" PRIu64 "\n",

> +              odp_pktio_to_u64(pktio), dev,

> +              odp_pktio_to_u64(pktio));

> +

> +       return pktio;

> +}

> +

> +/**

> + * Packet IO loopback worker thread using ODP queues

> + *

> + * @param arg  thread arguments of type 'thread_args_t *'

> + */

> +static int pktio_queue_thread(void *arg ODP_UNUSED)

> +{

> +       int thr = odp_thread_id();

> +       odp_pktout_queue_t pktout;

> +       odp_packet_t pkt;

> +       odp_event_t ev;

> +       uint64_t sched_wait = odp_schedule_wait_time(ODP_TIME_MSEC_IN_NS *

> 100);

> +

> +       packet_flags.all = 0;

> +

> +       /* Loop packets */

> +       while (1) {

> +               odp_pktio_t pktio_tmp;

> +

> +               ev = odp_schedule(NULL, sched_wait);

> +               if (ev == ODP_EVENT_INVALID)

> +                       break;

> +

> +               pkt = odp_packet_from_event(ev);

> +               if (!odp_packet_is_valid(pkt))

> +                       continue;

> +

> +               pktio_tmp = odp_packet_input(pkt);

> +

> +               if (odp_pktout_queue(pktio_tmp, &pktout, 1) != 1) {

> +                       LOG_ERR("  [%02i] Error: no pktout queue\n", thr);

> +                       return -1;

> +               }

> +

> +               /* Extend bits here for more additional tests */

> +               if (odp_packet_has_l2(pkt))

> +                       packet_flags.parsed_l2 = 1;

> +               if (odp_packet_has_vlan(pkt))

> +                       packet_flags.vlan = 1;

> +

> +               /* Enqueue the packet for output */

> +               if (odp_pktout_send(pktout, &pkt, 1) != 1) {

> +                       LOG_ERR("  [%i] Packet send failed.\n", thr);

> +                       odp_packet_free(pkt);

> +                       continue;

> +               }

> +       }

> +

> +       return 0;

> +}

> +

> +int cls_main(int argc, char *argv[])

> +{

> +       odph_odpthread_t thread_tbl[1];

> +       odp_pool_t pool;

> +       int num_workers;

> +       int i;

> +       int cpu;

> +       odp_cpumask_t cpumask;

> +       char cpumaskstr[ODP_CPUMASK_STR_SIZE];

> +       odp_pool_param_t params;

> +       odp_instance_t instance;

> +       odph_odpthread_params_t thr_params;

> +

> +       args = calloc(1, sizeof(args_t));

> +       if (args == NULL) {

> +               LOG_ERR("Error: args mem alloc failed.\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

> +       parse_args(argc, argv, &args->appl);

> +

> +       /* Init ODP before calling anything else */

> +       if (odp_init_global(&instance, NULL, NULL)) {

> +               LOG_ERR("Error: ODP global init failed.\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

> +       /* Init this thread */

> +       if (odp_init_local(instance, ODP_THREAD_CONTROL)) {

> +               LOG_ERR("Error: ODP local init failed.\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

> +       num_workers = odp_cpumask_default_worker(&cpumask, 1);

> +       (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));

> +

> +       /* Create packet pool */

> +       odp_pool_param_init(&params);

> +       params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;

> +       params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;

> +       params.pkt.num     = SHM_PKT_POOL_SIZE;

> +       params.type        = ODP_POOL_PACKET;

> +

> +       pool = odp_pool_create("packet_pool", &params);

> +       if (pool == ODP_POOL_INVALID) {

> +               LOG_ERR("Error: packet pool create failed.\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

> +       args->appl.pktio = create_pktio(args->appl.file_name, pool);

> +

> +       /* Create and init worker threads */

> +       memset(thread_tbl, 0, sizeof(thread_tbl));

> +

> +       memset(&thr_params, 0, sizeof(thr_params));

> +       thr_params.thr_type = ODP_THREAD_WORKER;

> +       thr_params.instance = instance;

> +

> +       cpu = odp_cpumask_first(&cpumask);

> +       for (i = 0; i < num_workers; ++i) {

> +               odp_cpumask_t thd_mask;

> +               int (*thr_run_func)(void *);

> +

> +               thr_run_func = pktio_queue_thread;

> +               /*

> +                * Create threads one-by-one instead of all-at-once,

> +                * because each thread might get different arguments.

> +                * Calls odp_thread_create(cpu) for each thread

> +                */

> +               odp_cpumask_zero(&thd_mask);

> +               odp_cpumask_set(&thd_mask, cpu);

> +

> +               thr_params.start = thr_run_func;

> +               thr_params.arg   = &args;

> +

> +               odph_odpthreads_create(&thread_tbl[i], &thd_mask,

> &thr_params);

> +               cpu = odp_cpumask_next(&cpumask, cpu);

> +       }

> +

> +       /* Master thread waits for other threads to exit */

> +       for (i = 0; i < num_workers; ++i)

> +               odph_odpthreads_join(&thread_tbl[i]);

> +

> +       odp_pktio_stop(args->appl.pktio);

> +       odp_pktio_close(args->appl.pktio);

> +

> +       while (1) {

> +               odp_event_t ev;

> +

> +               ev = odp_schedule(NULL, 0);

> +               if (ev == ODP_EVENT_INVALID)

> +                       break;

> +       }

> +

> +       odp_pool_destroy(pool);

> +       odp_term_local();

> +       odp_term_global(instance);

> +

> +       if (packet_flags.all != args->appl.expected_bits.all) {

> +               LOG_ERR("Flags %" PRIu64 " expected %" PRIu64 "\n",

> +                       packet_flags.all, args->appl.expected_bits.all);

> +               free(args);

> +               return -1;

> +       }

> +

> +       free(args);

> +       return 0;

> +}

> diff --git a/test/platform/linux-generic/cls/cls_main.c

> b/test/platform/linux-generic/cls/cls_main.c

> new file mode 100644

> index 0000000..40179b9

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/cls_main.c

> @@ -0,0 +1,12 @@

> +/* Copyright (c) 2016, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include "cls_suites.h"

> +

> +int main(int argc, char *argv[])

> +{

> +       return cls_main(argc, argv);

> +}

> diff --git a/test/platform/linux-generic/cls/cls_suites.h

> b/test/platform/linux-generic/cls/cls_suites.h

> new file mode 100644

> index 0000000..94c9b55

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/cls_suites.h

> @@ -0,0 +1 @@

> +int cls_main(int argc, char *argv[]);

> diff --git a/test/platform/linux-generic/cls/vlan.pcap

> b/test/platform/linux-generic/cls/vlan.pcap

> new file mode 100644

> index

> 0000000000000000000000000000000000000000..106ccb682e51495b4025337518a0bce63c2c7681

> GIT binary patch

> literal 9728

> zcmeHNeQXrR6@R<F^Iq)3b|{=(C16{8IUt}71RM^-2~wIU*p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wI

> zSNQ)QAvgyjv46|5;Cj<-r46np&s0uZI3frlYYB8{@6ZhP9)c)li1)B%M;7X4_~V3;

> zweY?r!UwhjTaiBax{uQbVC0ia6YITCFtX0f?z#7McFRAtvy0s`aDWT^itOSU<``9e

> z*o8Q9*E$t7pW+Ae-z3@9wtyG(Q9m~XI#usY+z*2OO@f;?E}jJRuan5`F(W(w6&+cA

> zwHX;uyoe*XMIvi=PPq_Zq+RM4y2TP<&N=BqfRS9F>k(Zw`a|6ku?bs}H2&4@V19<y

> zID}Ini24?e_AhE5T`)?NmT%$iQtg$F&ri|}c4@KSDc;0y{aiISvdwh*S?0(k1@)&>

> zQ7plIU*=6|dR#J=D<oFhda1NSH5ognGq!{Y*RQl!v7!LwU*O1E{OJDRV*$_b-zLDq

> zQO3ei&J^yz0(2S+l^`1m3)&VifIih&fKFqf!Wckb+_euHkKzNjM0<@#!v|j%=L2j_

> H$A|v_$relS

>

> literal 0

> HcmV?d00001

>

> diff --git a/test/platform/linux-generic/cls/vlan_run.sh

> b/test/platform/linux-generic/cls/vlan_run.sh

> new file mode 100755

> index 0000000..9849abf

> --- /dev/null

> +++ b/test/platform/linux-generic/cls/vlan_run.sh

> @@ -0,0 +1,49 @@

> +#!/bin/sh

> +#

> +# Copyright (c) 2016, Linaro Limited

> +# All rights reserved.

> +#

> +# SPDX-License-Identifier:      BSD-3-Clause

> +#

> +

> +# 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 _build directory, when running after 'make distcheck',

> +# -in the current directory.

> +# running stand alone out of tree requires setting PATH

> +PATH=${TEST_DIR}/pktio:$PATH

> +PATH=$(dirname $0):$PATH

> +PATH=$(dirname $0)/../../../../test/platform/linux-generic/cls:$PATH

> +PATH=$(dirname

> $0)/../../../../_build/test/platform/linux-generic/cls:$PATH

> +PATH=.:$PATH

> +

> +bin_path=$(which cls_main${EXEEXT})

> +if [ -x "$bin_path" ] ; then

> +       echo "Running with $bin_path"

> +else

> +       echo "Cannot find cls_main${EXEEXT}"

> +       echo "Please set you PATH for it. PATH=$PATH"

> +fi

> +

> +# Test1: find vlan packets in pcap file and test internal

> pkt_mmap_vlan_insert()

> +#       function. Load packets from vlan.pcap file and check that

> classifier

> +#       set vlan bits fisible with odp_packet_has_vlan().

> +

> +PCAP=`find . ${TEST_DIR} $(dirname $0) -name vlan.pcap -print -quit`

> +

> +cls_main -i $PCAP -e 4097

> +ret=$?

> +

> +PCAP_IN_SIZE=`stat -c %s $PCAP`

> +PCAP_OUT_SIZE=`stat -c %s test_out.pcap`

> +

> +rm -f test_out.pcap

> +

> +if [ ${ret} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then

> +       echo "Error: status ${ret}, in:${PCAP_IN_SIZE}

> out:${PCAP_OUT_SIZE}"

> +       exit 3

> +fi

> +

> +echo "PASS: test 1 passed"

> diff --git a/test/platform/linux-generic/m4/configure.m4

> b/test/platform/linux-generic/m4/configure.m4

> index 8c3db21..eb50756 100644

> --- a/test/platform/linux-generic/m4/configure.m4

> +++ b/test/platform/linux-generic/m4/configure.m4

> @@ -1,4 +1,5 @@

>  AC_CONFIG_FILES([test/platform/linux-generic/Makefile

> +                test/platform/linux-generic/cls/Makefile

>                  test/platform/linux-generic/shmem/Makefile

>                  test/platform/linux-generic/pktio/Makefile

>                  test/platform/linux-generic/pktio_ipc/Makefile

> --

> 2.7.1.250.gff4ea60

>

>
Maxim Uvarov July 14, 2016, 8:29 a.m. UTC | #4
On 07/13/16 22:32, Bill Fischofer wrote:
> This applies and compiles fine, but I'm not sure how I'm supposed to 

> run it.  Does this require sudo?  Neither with or without seems to 

> work for me:

>

I do not see in your output that pcap pktio was compiled in (no open for 
it). In that case code should be compiled but should not be executed.
apt-get install libpcap-dev
should help.

It does not matter root or not root. Code should work for direct call 
./cls_run or make check / make distcheck targets.

Maxim.
Mike Holmes July 14, 2016, 11:27 a.m. UTC | #5
On 14 July 2016 at 04:29, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 07/13/16 22:32, Bill Fischofer wrote:

>

>> This applies and compiles fine, but I'm not sure how I'm supposed to run

>> it.  Does this require sudo?  Neither with or without seems to work for me:

>>

>> I do not see in your output that pcap pktio was compiled in (no open for

> it). In that case code should be compiled but should not be executed.

> apt-get install libpcap-dev

> should help.

>


do we need to add this note to DEPENDENCIES ?


>

> It does not matter root or not root. Code should work for direct call

> ./cls_run or make check / make distcheck targets.

>

> Maxim.

>




-- 
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"
Bill Fischofer July 14, 2016, 11:50 a.m. UTC | #6
On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> On 07/13/16 22:32, Bill Fischofer wrote:

>

>> This applies and compiles fine, but I'm not sure how I'm supposed to run

>> it.  Does this require sudo?  Neither with or without seems to work for me:

>>

>> I do not see in your output that pcap pktio was compiled in (no open for

> it). In that case code should be compiled but should not be executed.

> apt-get install libpcap-dev

> should help.

>


I installed that library and I get the same output (abort without sudo,
complaint that it can't find test_out.pcap with sudo)


>

> It does not matter root or not root. Code should work for direct call

> ./cls_run or make check / make distcheck targets.



There is no ./cls_run. The executable I see in that directory is named
./vlan_run.sh. Am I missing something?

I ran make, not make distcheck. Is that the issue?


>

>

> Maxim.

>
Maxim Uvarov July 14, 2016, 12:56 p.m. UTC | #7
On 07/14/16 14:50, Bill Fischofer wrote:
>

>

> On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <maxim.uvarov@linaro.org 

> <mailto:maxim.uvarov@linaro.org>> wrote:

>

>     On 07/13/16 22:32, Bill Fischofer wrote:

>

>         This applies and compiles fine, but I'm not sure how I'm

>         supposed to run it.  Does this require sudo? Neither with or

>         without seems to work for me:

>

>     I do not see in your output that pcap pktio was compiled in (no

>     open for it). In that case code should be compiled but should not

>     be executed.

>     apt-get install libpcap-dev

>     should help.

>

>

> I installed that library and I get the same output (abort without 

> sudo, complaint that it can't find test_out.pcap with sudo)

>

>

>     It does not matter root or not root. Code should work for direct

>     call ./cls_run or make check / make distcheck targets.

>

>

> There is no ./cls_run. The executable I see in that directory is named 

> ./vlan_run.sh. Am I missing something?

>

> I ran make, not make distcheck. Is that the issue?


./vlan_run.sh is correct name.

you run make, than make check.

./bootstrap; ./configure  --enable-test-vald  --enable-test-perf 
--enable-test-cpp   --enable-debug  --enable-debug-print 
--enable-user-guides --enable-test-example --enable-test-helper 
--enable-debug


>

>

>     Maxim.

>

>
Bill Fischofer July 14, 2016, 1:08 p.m. UTC | #8
Ok, make followed by make check looks like it works:

make  check-TESTS
make[4]: Entering directory
'/home/bill/linaro/maxim/test/platform/linux-generic'
make[5]: Entering directory
'/home/bill/linaro/maxim/test/platform/linux-generic'
PASS: pktio/pktio_run.sh
SKIP: pktio/pktio_run_tap.sh
PASS: ring/ring_main
PASS: shmem/shmem_linux
PASS: ../../../test/validation/atomic/atomic_main
PASS: ../../../test/validation/barrier/barrier_main
PASS: ../../../test/validation/buffer/buffer_main
PASS: ../../../test/validation/classification/classification_main
PASS: ../../../test/validation/cpumask/cpumask_main
PASS: ../../../test/validation/crypto/crypto_main
PASS: ../../../test/validation/errno/errno_main
PASS: ../../../test/validation/hash/hash_main
PASS: ../../../test/validation/init/init_main_ok
PASS: ../../../test/validation/init/init_main_abort
PASS: ../../../test/validation/init/init_main_log
PASS: ../../../test/validation/lock/lock_main
PASS: ../../../test/validation/packet/packet_main
PASS: ../../../test/validation/pool/pool_main
PASS: ../../../test/validation/queue/queue_main
PASS: ../../../test/validation/random/random_main
PASS: ../../../test/validation/scheduler/scheduler_main
PASS: ../../../test/validation/std_clib/std_clib_main
PASS: ../../../test/validation/thread/thread_main
PASS: ../../../test/validation/time/time_main
PASS: ../../../test/validation/timer/timer_main
PASS: ../../../test/validation/traffic_mngr/traffic_mngr_main
PASS: ../../../test/validation/shmem/shmem_main
PASS: ../../../test/validation/system/system_main
PASS: cls/vlan_run.sh
PASS: pktio/pktio_run_pcap.sh
============================================================================
Testsuite summary for OpenDataPlane 1.10.1.0.git46.gcd0ad6c
============================================================================
# TOTAL: 30
# PASS:  29
# SKIP:  1
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

Is there any reason why I can't run the test manually, however?


On Thu, Jul 14, 2016 at 7:56 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> On 07/14/16 14:50, Bill Fischofer wrote:

>

>>

>>

>> On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <maxim.uvarov@linaro.org

>> <mailto:maxim.uvarov@linaro.org>> wrote:

>>

>>     On 07/13/16 22:32, Bill Fischofer wrote:

>>

>>         This applies and compiles fine, but I'm not sure how I'm

>>         supposed to run it.  Does this require sudo? Neither with or

>>         without seems to work for me:

>>

>>     I do not see in your output that pcap pktio was compiled in (no

>>     open for it). In that case code should be compiled but should not

>>     be executed.

>>     apt-get install libpcap-dev

>>     should help.

>>

>>

>> I installed that library and I get the same output (abort without sudo,

>> complaint that it can't find test_out.pcap with sudo)

>>

>>

>>     It does not matter root or not root. Code should work for direct

>>     call ./cls_run or make check / make distcheck targets.

>>

>>

>> There is no ./cls_run. The executable I see in that directory is named

>> ./vlan_run.sh. Am I missing something?

>>

>> I ran make, not make distcheck. Is that the issue?

>>

>

> ./vlan_run.sh is correct name.

>

> you run make, than make check.

>

> ./bootstrap; ./configure  --enable-test-vald  --enable-test-perf

> --enable-test-cpp   --enable-debug  --enable-debug-print

> --enable-user-guides --enable-test-example --enable-test-helper

> --enable-debug

>

>

>

>>

>>     Maxim.

>>

>>

>>

>
Mike Holmes July 14, 2016, 1:10 p.m. UTC | #9
In many cases it is becasue the scripts do not add the current directory
containing the executables to the path, I just fixed that in crypto
examples and will send when Anders patches make it in

On 14 July 2016 at 09:08, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> Ok, make followed by make check looks like it works:

>

> make  check-TESTS

> make[4]: Entering directory

> '/home/bill/linaro/maxim/test/platform/linux-generic'

> make[5]: Entering directory

> '/home/bill/linaro/maxim/test/platform/linux-generic'

> PASS: pktio/pktio_run.sh

> SKIP: pktio/pktio_run_tap.sh

> PASS: ring/ring_main

> PASS: shmem/shmem_linux

> PASS: ../../../test/validation/atomic/atomic_main

> PASS: ../../../test/validation/barrier/barrier_main

> PASS: ../../../test/validation/buffer/buffer_main

> PASS: ../../../test/validation/classification/classification_main

> PASS: ../../../test/validation/cpumask/cpumask_main

> PASS: ../../../test/validation/crypto/crypto_main

> PASS: ../../../test/validation/errno/errno_main

> PASS: ../../../test/validation/hash/hash_main

> PASS: ../../../test/validation/init/init_main_ok

> PASS: ../../../test/validation/init/init_main_abort

> PASS: ../../../test/validation/init/init_main_log

> PASS: ../../../test/validation/lock/lock_main

> PASS: ../../../test/validation/packet/packet_main

> PASS: ../../../test/validation/pool/pool_main

> PASS: ../../../test/validation/queue/queue_main

> PASS: ../../../test/validation/random/random_main

> PASS: ../../../test/validation/scheduler/scheduler_main

> PASS: ../../../test/validation/std_clib/std_clib_main

> PASS: ../../../test/validation/thread/thread_main

> PASS: ../../../test/validation/time/time_main

> PASS: ../../../test/validation/timer/timer_main

> PASS: ../../../test/validation/traffic_mngr/traffic_mngr_main

> PASS: ../../../test/validation/shmem/shmem_main

> PASS: ../../../test/validation/system/system_main

> PASS: cls/vlan_run.sh

> PASS: pktio/pktio_run_pcap.sh

>

> ============================================================================

> Testsuite summary for OpenDataPlane 1.10.1.0.git46.gcd0ad6c

>

> ============================================================================

> # TOTAL: 30

> # PASS:  29

> # SKIP:  1

> # XFAIL: 0

> # FAIL:  0

> # XPASS: 0

> # ERROR: 0

>

> Is there any reason why I can't run the test manually, however?

>

>

> On Thu, Jul 14, 2016 at 7:56 AM, Maxim Uvarov <maxim.uvarov@linaro.org>

> wrote:

>

> > On 07/14/16 14:50, Bill Fischofer wrote:

> >

> >>

> >>

> >> On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <maxim.uvarov@linaro.org

> >> <mailto:maxim.uvarov@linaro.org>> wrote:

> >>

> >>     On 07/13/16 22:32, Bill Fischofer wrote:

> >>

> >>         This applies and compiles fine, but I'm not sure how I'm

> >>         supposed to run it.  Does this require sudo? Neither with or

> >>         without seems to work for me:

> >>

> >>     I do not see in your output that pcap pktio was compiled in (no

> >>     open for it). In that case code should be compiled but should not

> >>     be executed.

> >>     apt-get install libpcap-dev

> >>     should help.

> >>

> >>

> >> I installed that library and I get the same output (abort without sudo,

> >> complaint that it can't find test_out.pcap with sudo)

> >>

> >>

> >>     It does not matter root or not root. Code should work for direct

> >>     call ./cls_run or make check / make distcheck targets.

> >>

> >>

> >> There is no ./cls_run. The executable I see in that directory is named

> >> ./vlan_run.sh. Am I missing something?

> >>

> >> I ran make, not make distcheck. Is that the issue?

> >>

> >

> > ./vlan_run.sh is correct name.

> >

> > you run make, than make check.

> >

> > ./bootstrap; ./configure  --enable-test-vald  --enable-test-perf

> > --enable-test-cpp   --enable-debug  --enable-debug-print

> > --enable-user-guides --enable-test-example --enable-test-helper

> > --enable-debug

> >

> >

> >

> >>

> >>     Maxim.

> >>

> >>

> >>

> >

>




-- 
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"
Bill Fischofer July 14, 2016, 1:12 p.m. UTC | #10
On Thu, Jul 14, 2016 at 8:10 AM, Mike Holmes <mike.holmes@linaro.org> wrote:

> In many cases it is becasue the scripts do not add the current directory

> containing the executables to the path, I just fixed that in crypto

> examples and will send when Anders patches make it in

>

>

I think that should be fixed. It's good to have scripts that run through
all of these for regression purposes, but each test should be runnable
individually as well.



> On 14 July 2016 at 09:08, Bill Fischofer <bill.fischofer@linaro.org>

> wrote:

>

>> Ok, make followed by make check looks like it works:

>>

>> make  check-TESTS

>> make[4]: Entering directory

>> '/home/bill/linaro/maxim/test/platform/linux-generic'

>> make[5]: Entering directory

>> '/home/bill/linaro/maxim/test/platform/linux-generic'

>> PASS: pktio/pktio_run.sh

>> SKIP: pktio/pktio_run_tap.sh

>> PASS: ring/ring_main

>> PASS: shmem/shmem_linux

>> PASS: ../../../test/validation/atomic/atomic_main

>> PASS: ../../../test/validation/barrier/barrier_main

>> PASS: ../../../test/validation/buffer/buffer_main

>> PASS: ../../../test/validation/classification/classification_main

>> PASS: ../../../test/validation/cpumask/cpumask_main

>> PASS: ../../../test/validation/crypto/crypto_main

>> PASS: ../../../test/validation/errno/errno_main

>> PASS: ../../../test/validation/hash/hash_main

>> PASS: ../../../test/validation/init/init_main_ok

>> PASS: ../../../test/validation/init/init_main_abort

>> PASS: ../../../test/validation/init/init_main_log

>> PASS: ../../../test/validation/lock/lock_main

>> PASS: ../../../test/validation/packet/packet_main

>> PASS: ../../../test/validation/pool/pool_main

>> PASS: ../../../test/validation/queue/queue_main

>> PASS: ../../../test/validation/random/random_main

>> PASS: ../../../test/validation/scheduler/scheduler_main

>> PASS: ../../../test/validation/std_clib/std_clib_main

>> PASS: ../../../test/validation/thread/thread_main

>> PASS: ../../../test/validation/time/time_main

>> PASS: ../../../test/validation/timer/timer_main

>> PASS: ../../../test/validation/traffic_mngr/traffic_mngr_main

>> PASS: ../../../test/validation/shmem/shmem_main

>> PASS: ../../../test/validation/system/system_main

>> PASS: cls/vlan_run.sh

>> PASS: pktio/pktio_run_pcap.sh

>>

>> ============================================================================

>> Testsuite summary for OpenDataPlane 1.10.1.0.git46.gcd0ad6c

>>

>> ============================================================================

>> # TOTAL: 30

>> # PASS:  29

>> # SKIP:  1

>> # XFAIL: 0

>> # FAIL:  0

>> # XPASS: 0

>> # ERROR: 0

>>

>> Is there any reason why I can't run the test manually, however?

>>

>>

>> On Thu, Jul 14, 2016 at 7:56 AM, Maxim Uvarov <maxim.uvarov@linaro.org>

>> wrote:

>>

>> > On 07/14/16 14:50, Bill Fischofer wrote:

>> >

>> >>

>> >>

>> >> On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <maxim.uvarov@linaro.org

>> >> <mailto:maxim.uvarov@linaro.org>> wrote:

>> >>

>> >>     On 07/13/16 22:32, Bill Fischofer wrote:

>> >>

>> >>         This applies and compiles fine, but I'm not sure how I'm

>> >>         supposed to run it.  Does this require sudo? Neither with or

>> >>         without seems to work for me:

>> >>

>> >>     I do not see in your output that pcap pktio was compiled in (no

>> >>     open for it). In that case code should be compiled but should not

>> >>     be executed.

>> >>     apt-get install libpcap-dev

>> >>     should help.

>> >>

>> >>

>> >> I installed that library and I get the same output (abort without sudo,

>> >> complaint that it can't find test_out.pcap with sudo)

>> >>

>> >>

>> >>     It does not matter root or not root. Code should work for direct

>> >>     call ./cls_run or make check / make distcheck targets.

>> >>

>> >>

>> >> There is no ./cls_run. The executable I see in that directory is named

>> >> ./vlan_run.sh. Am I missing something?

>> >>

>> >> I ran make, not make distcheck. Is that the issue?

>> >>

>> >

>> > ./vlan_run.sh is correct name.

>> >

>> > you run make, than make check.

>> >

>> > ./bootstrap; ./configure  --enable-test-vald  --enable-test-perf

>> > --enable-test-cpp   --enable-debug  --enable-debug-print

>> > --enable-user-guides --enable-test-example --enable-test-helper

>> > --enable-debug

>> >

>> >

>> >

>> >>

>> >>     Maxim.

>> >>

>> >>

>> >>

>> >

>>

>

>

>

> --

> 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"

>

>

>
Balasubramanian Manoharan July 14, 2016, 3:56 p.m. UTC | #11
This approach of using a pcap file might be useful to recreate an
error scenario but IMO it will be difficult to maintain different pcap
file for test cases.
Is this method proposed for validation testing or for flow testing?

Regards,
Bala


On 14 July 2016 at 18:42, Bill Fischofer <bill.fischofer@linaro.org> wrote:
> On Thu, Jul 14, 2016 at 8:10 AM, Mike Holmes <mike.holmes@linaro.org> wrote:

>

>> In many cases it is becasue the scripts do not add the current directory

>> containing the executables to the path, I just fixed that in crypto

>> examples and will send when Anders patches make it in

>>

>>

> I think that should be fixed. It's good to have scripts that run through

> all of these for regression purposes, but each test should be runnable

> individually as well.

>

>

>

>> On 14 July 2016 at 09:08, Bill Fischofer <bill.fischofer@linaro.org>

>> wrote:

>>

>>> Ok, make followed by make check looks like it works:

>>>

>>> make  check-TESTS

>>> make[4]: Entering directory

>>> '/home/bill/linaro/maxim/test/platform/linux-generic'

>>> make[5]: Entering directory

>>> '/home/bill/linaro/maxim/test/platform/linux-generic'

>>> PASS: pktio/pktio_run.sh

>>> SKIP: pktio/pktio_run_tap.sh

>>> PASS: ring/ring_main

>>> PASS: shmem/shmem_linux

>>> PASS: ../../../test/validation/atomic/atomic_main

>>> PASS: ../../../test/validation/barrier/barrier_main

>>> PASS: ../../../test/validation/buffer/buffer_main

>>> PASS: ../../../test/validation/classification/classification_main

>>> PASS: ../../../test/validation/cpumask/cpumask_main

>>> PASS: ../../../test/validation/crypto/crypto_main

>>> PASS: ../../../test/validation/errno/errno_main

>>> PASS: ../../../test/validation/hash/hash_main

>>> PASS: ../../../test/validation/init/init_main_ok

>>> PASS: ../../../test/validation/init/init_main_abort

>>> PASS: ../../../test/validation/init/init_main_log

>>> PASS: ../../../test/validation/lock/lock_main

>>> PASS: ../../../test/validation/packet/packet_main

>>> PASS: ../../../test/validation/pool/pool_main

>>> PASS: ../../../test/validation/queue/queue_main

>>> PASS: ../../../test/validation/random/random_main

>>> PASS: ../../../test/validation/scheduler/scheduler_main

>>> PASS: ../../../test/validation/std_clib/std_clib_main

>>> PASS: ../../../test/validation/thread/thread_main

>>> PASS: ../../../test/validation/time/time_main

>>> PASS: ../../../test/validation/timer/timer_main

>>> PASS: ../../../test/validation/traffic_mngr/traffic_mngr_main

>>> PASS: ../../../test/validation/shmem/shmem_main

>>> PASS: ../../../test/validation/system/system_main

>>> PASS: cls/vlan_run.sh

>>> PASS: pktio/pktio_run_pcap.sh

>>>

>>> ============================================================================

>>> Testsuite summary for OpenDataPlane 1.10.1.0.git46.gcd0ad6c

>>>

>>> ============================================================================

>>> # TOTAL: 30

>>> # PASS:  29

>>> # SKIP:  1

>>> # XFAIL: 0

>>> # FAIL:  0

>>> # XPASS: 0

>>> # ERROR: 0

>>>

>>> Is there any reason why I can't run the test manually, however?

>>>

>>>

>>> On Thu, Jul 14, 2016 at 7:56 AM, Maxim Uvarov <maxim.uvarov@linaro.org>

>>> wrote:

>>>

>>> > On 07/14/16 14:50, Bill Fischofer wrote:

>>> >

>>> >>

>>> >>

>>> >> On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <maxim.uvarov@linaro.org

>>> >> <mailto:maxim.uvarov@linaro.org>> wrote:

>>> >>

>>> >>     On 07/13/16 22:32, Bill Fischofer wrote:

>>> >>

>>> >>         This applies and compiles fine, but I'm not sure how I'm

>>> >>         supposed to run it.  Does this require sudo? Neither with or

>>> >>         without seems to work for me:

>>> >>

>>> >>     I do not see in your output that pcap pktio was compiled in (no

>>> >>     open for it). In that case code should be compiled but should not

>>> >>     be executed.

>>> >>     apt-get install libpcap-dev

>>> >>     should help.

>>> >>

>>> >>

>>> >> I installed that library and I get the same output (abort without sudo,

>>> >> complaint that it can't find test_out.pcap with sudo)

>>> >>

>>> >>

>>> >>     It does not matter root or not root. Code should work for direct

>>> >>     call ./cls_run or make check / make distcheck targets.

>>> >>

>>> >>

>>> >> There is no ./cls_run. The executable I see in that directory is named

>>> >> ./vlan_run.sh. Am I missing something?

>>> >>

>>> >> I ran make, not make distcheck. Is that the issue?

>>> >>

>>> >

>>> > ./vlan_run.sh is correct name.

>>> >

>>> > you run make, than make check.

>>> >

>>> > ./bootstrap; ./configure  --enable-test-vald  --enable-test-perf

>>> > --enable-test-cpp   --enable-debug  --enable-debug-print

>>> > --enable-user-guides --enable-test-example --enable-test-helper

>>> > --enable-debug

>>> >

>>> >

>>> >

>>> >>

>>> >>     Maxim.

>>> >>

>>> >>

>>> >>

>>> >

>>>

>>

>>

>>

>> --

>> 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"

>>

>>

>>
Bill Fischofer July 14, 2016, 4:53 p.m. UTC | #12
I think general pcap file support is likely to prove useful in all sorts of
ways. Validation testing (especially for error cases) is certainly one
area. Flow routing should be another since packets may only partially touch
cores so how do we test that an IPSec packet can be input and received by a
core already decrypted?

On Thu, Jul 14, 2016 at 10:56 AM, Bala Manoharan <bala.manoharan@linaro.org>
wrote:

> This approach of using a pcap file might be useful to recreate an

> error scenario but IMO it will be difficult to maintain different pcap

> file for test cases.

> Is this method proposed for validation testing or for flow testing?

>

> Regards,

> Bala

>

>

> On 14 July 2016 at 18:42, Bill Fischofer <bill.fischofer@linaro.org>

> wrote:

> > On Thu, Jul 14, 2016 at 8:10 AM, Mike Holmes <mike.holmes@linaro.org>

> wrote:

> >

> >> In many cases it is becasue the scripts do not add the current directory

> >> containing the executables to the path, I just fixed that in crypto

> >> examples and will send when Anders patches make it in

> >>

> >>

> > I think that should be fixed. It's good to have scripts that run through

> > all of these for regression purposes, but each test should be runnable

> > individually as well.

> >

> >

> >

> >> On 14 July 2016 at 09:08, Bill Fischofer <bill.fischofer@linaro.org>

> >> wrote:

> >>

> >>> Ok, make followed by make check looks like it works:

> >>>

> >>> make  check-TESTS

> >>> make[4]: Entering directory

> >>> '/home/bill/linaro/maxim/test/platform/linux-generic'

> >>> make[5]: Entering directory

> >>> '/home/bill/linaro/maxim/test/platform/linux-generic'

> >>> PASS: pktio/pktio_run.sh

> >>> SKIP: pktio/pktio_run_tap.sh

> >>> PASS: ring/ring_main

> >>> PASS: shmem/shmem_linux

> >>> PASS: ../../../test/validation/atomic/atomic_main

> >>> PASS: ../../../test/validation/barrier/barrier_main

> >>> PASS: ../../../test/validation/buffer/buffer_main

> >>> PASS: ../../../test/validation/classification/classification_main

> >>> PASS: ../../../test/validation/cpumask/cpumask_main

> >>> PASS: ../../../test/validation/crypto/crypto_main

> >>> PASS: ../../../test/validation/errno/errno_main

> >>> PASS: ../../../test/validation/hash/hash_main

> >>> PASS: ../../../test/validation/init/init_main_ok

> >>> PASS: ../../../test/validation/init/init_main_abort

> >>> PASS: ../../../test/validation/init/init_main_log

> >>> PASS: ../../../test/validation/lock/lock_main

> >>> PASS: ../../../test/validation/packet/packet_main

> >>> PASS: ../../../test/validation/pool/pool_main

> >>> PASS: ../../../test/validation/queue/queue_main

> >>> PASS: ../../../test/validation/random/random_main

> >>> PASS: ../../../test/validation/scheduler/scheduler_main

> >>> PASS: ../../../test/validation/std_clib/std_clib_main

> >>> PASS: ../../../test/validation/thread/thread_main

> >>> PASS: ../../../test/validation/time/time_main

> >>> PASS: ../../../test/validation/timer/timer_main

> >>> PASS: ../../../test/validation/traffic_mngr/traffic_mngr_main

> >>> PASS: ../../../test/validation/shmem/shmem_main

> >>> PASS: ../../../test/validation/system/system_main

> >>> PASS: cls/vlan_run.sh

> >>> PASS: pktio/pktio_run_pcap.sh

> >>>

> >>>

> ============================================================================

> >>> Testsuite summary for OpenDataPlane 1.10.1.0.git46.gcd0ad6c

> >>>

> >>>

> ============================================================================

> >>> # TOTAL: 30

> >>> # PASS:  29

> >>> # SKIP:  1

> >>> # XFAIL: 0

> >>> # FAIL:  0

> >>> # XPASS: 0

> >>> # ERROR: 0

> >>>

> >>> Is there any reason why I can't run the test manually, however?

> >>>

> >>>

> >>> On Thu, Jul 14, 2016 at 7:56 AM, Maxim Uvarov <maxim.uvarov@linaro.org

> >

> >>> wrote:

> >>>

> >>> > On 07/14/16 14:50, Bill Fischofer wrote:

> >>> >

> >>> >>

> >>> >>

> >>> >> On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <

> maxim.uvarov@linaro.org

> >>> >> <mailto:maxim.uvarov@linaro.org>> wrote:

> >>> >>

> >>> >>     On 07/13/16 22:32, Bill Fischofer wrote:

> >>> >>

> >>> >>         This applies and compiles fine, but I'm not sure how I'm

> >>> >>         supposed to run it.  Does this require sudo? Neither with or

> >>> >>         without seems to work for me:

> >>> >>

> >>> >>     I do not see in your output that pcap pktio was compiled in (no

> >>> >>     open for it). In that case code should be compiled but should

> not

> >>> >>     be executed.

> >>> >>     apt-get install libpcap-dev

> >>> >>     should help.

> >>> >>

> >>> >>

> >>> >> I installed that library and I get the same output (abort without

> sudo,

> >>> >> complaint that it can't find test_out.pcap with sudo)

> >>> >>

> >>> >>

> >>> >>     It does not matter root or not root. Code should work for direct

> >>> >>     call ./cls_run or make check / make distcheck targets.

> >>> >>

> >>> >>

> >>> >> There is no ./cls_run. The executable I see in that directory is

> named

> >>> >> ./vlan_run.sh. Am I missing something?

> >>> >>

> >>> >> I ran make, not make distcheck. Is that the issue?

> >>> >>

> >>> >

> >>> > ./vlan_run.sh is correct name.

> >>> >

> >>> > you run make, than make check.

> >>> >

> >>> > ./bootstrap; ./configure  --enable-test-vald  --enable-test-perf

> >>> > --enable-test-cpp   --enable-debug  --enable-debug-print

> >>> > --enable-user-guides --enable-test-example --enable-test-helper

> >>> > --enable-debug

> >>> >

> >>> >

> >>> >

> >>> >>

> >>> >>     Maxim.

> >>> >>

> >>> >>

> >>> >>

> >>> >

> >>>

> >>

> >>

> >>

> >> --

> >> 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"

> >>

> >>

> >>

>
Maxim Uvarov July 29, 2016, 2:37 p.m. UTC | #13
as I remember we agreed that this patch can be applied.  Review is 
needed before merging...

Maxim.

On 07/14/16 19:53, Bill Fischofer wrote:
> I think general pcap file support is likely to prove useful in all sorts of

> ways. Validation testing (especially for error cases) is certainly one

> area. Flow routing should be another since packets may only partially touch

> cores so how do we test that an IPSec packet can be input and received by a

> core already decrypted?

>

> On Thu, Jul 14, 2016 at 10:56 AM, Bala Manoharan <bala.manoharan@linaro.org>

> wrote:

>

>> This approach of using a pcap file might be useful to recreate an

>> error scenario but IMO it will be difficult to maintain different pcap

>> file for test cases.

>> Is this method proposed for validation testing or for flow testing?

>>

>> Regards,

>> Bala

>>

>>

>> On 14 July 2016 at 18:42, Bill Fischofer <bill.fischofer@linaro.org>

>> wrote:

>>> On Thu, Jul 14, 2016 at 8:10 AM, Mike Holmes <mike.holmes@linaro.org>

>> wrote:

>>>> In many cases it is becasue the scripts do not add the current directory

>>>> containing the executables to the path, I just fixed that in crypto

>>>> examples and will send when Anders patches make it in

>>>>

>>>>

>>> I think that should be fixed. It's good to have scripts that run through

>>> all of these for regression purposes, but each test should be runnable

>>> individually as well.

>>>

>>>

>>>

>>>> On 14 July 2016 at 09:08, Bill Fischofer <bill.fischofer@linaro.org>

>>>> wrote:

>>>>

>>>>> Ok, make followed by make check looks like it works:

>>>>>

>>>>> make  check-TESTS

>>>>> make[4]: Entering directory

>>>>> '/home/bill/linaro/maxim/test/platform/linux-generic'

>>>>> make[5]: Entering directory

>>>>> '/home/bill/linaro/maxim/test/platform/linux-generic'

>>>>> PASS: pktio/pktio_run.sh

>>>>> SKIP: pktio/pktio_run_tap.sh

>>>>> PASS: ring/ring_main

>>>>> PASS: shmem/shmem_linux

>>>>> PASS: ../../../test/validation/atomic/atomic_main

>>>>> PASS: ../../../test/validation/barrier/barrier_main

>>>>> PASS: ../../../test/validation/buffer/buffer_main

>>>>> PASS: ../../../test/validation/classification/classification_main

>>>>> PASS: ../../../test/validation/cpumask/cpumask_main

>>>>> PASS: ../../../test/validation/crypto/crypto_main

>>>>> PASS: ../../../test/validation/errno/errno_main

>>>>> PASS: ../../../test/validation/hash/hash_main

>>>>> PASS: ../../../test/validation/init/init_main_ok

>>>>> PASS: ../../../test/validation/init/init_main_abort

>>>>> PASS: ../../../test/validation/init/init_main_log

>>>>> PASS: ../../../test/validation/lock/lock_main

>>>>> PASS: ../../../test/validation/packet/packet_main

>>>>> PASS: ../../../test/validation/pool/pool_main

>>>>> PASS: ../../../test/validation/queue/queue_main

>>>>> PASS: ../../../test/validation/random/random_main

>>>>> PASS: ../../../test/validation/scheduler/scheduler_main

>>>>> PASS: ../../../test/validation/std_clib/std_clib_main

>>>>> PASS: ../../../test/validation/thread/thread_main

>>>>> PASS: ../../../test/validation/time/time_main

>>>>> PASS: ../../../test/validation/timer/timer_main

>>>>> PASS: ../../../test/validation/traffic_mngr/traffic_mngr_main

>>>>> PASS: ../../../test/validation/shmem/shmem_main

>>>>> PASS: ../../../test/validation/system/system_main

>>>>> PASS: cls/vlan_run.sh

>>>>> PASS: pktio/pktio_run_pcap.sh

>>>>>

>>>>>

>> ============================================================================

>>>>> Testsuite summary for OpenDataPlane 1.10.1.0.git46.gcd0ad6c

>>>>>

>>>>>

>> ============================================================================

>>>>> # TOTAL: 30

>>>>> # PASS:  29

>>>>> # SKIP:  1

>>>>> # XFAIL: 0

>>>>> # FAIL:  0

>>>>> # XPASS: 0

>>>>> # ERROR: 0

>>>>>

>>>>> Is there any reason why I can't run the test manually, however?

>>>>>

>>>>>

>>>>> On Thu, Jul 14, 2016 at 7:56 AM, Maxim Uvarov <maxim.uvarov@linaro.org

>>>>> wrote:

>>>>>

>>>>>> On 07/14/16 14:50, Bill Fischofer wrote:

>>>>>>

>>>>>>>

>>>>>>> On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <

>> maxim.uvarov@linaro.org

>>>>>>> <mailto:maxim.uvarov@linaro.org>> wrote:

>>>>>>>

>>>>>>>      On 07/13/16 22:32, Bill Fischofer wrote:

>>>>>>>

>>>>>>>          This applies and compiles fine, but I'm not sure how I'm

>>>>>>>          supposed to run it.  Does this require sudo? Neither with or

>>>>>>>          without seems to work for me:

>>>>>>>

>>>>>>>      I do not see in your output that pcap pktio was compiled in (no

>>>>>>>      open for it). In that case code should be compiled but should

>> not

>>>>>>>      be executed.

>>>>>>>      apt-get install libpcap-dev

>>>>>>>      should help.

>>>>>>>

>>>>>>>

>>>>>>> I installed that library and I get the same output (abort without

>> sudo,

>>>>>>> complaint that it can't find test_out.pcap with sudo)

>>>>>>>

>>>>>>>

>>>>>>>      It does not matter root or not root. Code should work for direct

>>>>>>>      call ./cls_run or make check / make distcheck targets.

>>>>>>>

>>>>>>>

>>>>>>> There is no ./cls_run. The executable I see in that directory is

>> named

>>>>>>> ./vlan_run.sh. Am I missing something?

>>>>>>>

>>>>>>> I ran make, not make distcheck. Is that the issue?

>>>>>>>

>>>>>> ./vlan_run.sh is correct name.

>>>>>>

>>>>>> you run make, than make check.

>>>>>>

>>>>>> ./bootstrap; ./configure  --enable-test-vald  --enable-test-perf

>>>>>> --enable-test-cpp   --enable-debug  --enable-debug-print

>>>>>> --enable-user-guides --enable-test-example --enable-test-helper

>>>>>> --enable-debug

>>>>>>

>>>>>>

>>>>>>

>>>>>>>      Maxim.

>>>>>>>

>>>>>>>

>>>>>>>

>>>>

>>>>

>>>> --

>>>> 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"

>>>>

>>>>

>>>>
Bill Fischofer July 29, 2016, 3:12 p.m. UTC | #14
My last comment was that this runs fine with make check but the test
doesn't run stand-alone. Can that be fixed?

On Fri, Jul 29, 2016 at 9:37 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> as I remember we agreed that this patch can be applied.  Review is needed

> before merging...

>

> Maxim.

>

>

> On 07/14/16 19:53, Bill Fischofer wrote:

>

>> I think general pcap file support is likely to prove useful in all sorts

>> of

>> ways. Validation testing (especially for error cases) is certainly one

>> area. Flow routing should be another since packets may only partially

>> touch

>> cores so how do we test that an IPSec packet can be input and received by

>> a

>> core already decrypted?

>>

>> On Thu, Jul 14, 2016 at 10:56 AM, Bala Manoharan <

>> bala.manoharan@linaro.org>

>> wrote:

>>

>> This approach of using a pcap file might be useful to recreate an

>>> error scenario but IMO it will be difficult to maintain different pcap

>>> file for test cases.

>>> Is this method proposed for validation testing or for flow testing?

>>>

>>> Regards,

>>> Bala

>>>

>>>

>>> On 14 July 2016 at 18:42, Bill Fischofer <bill.fischofer@linaro.org>

>>> wrote:

>>>

>>>> On Thu, Jul 14, 2016 at 8:10 AM, Mike Holmes <mike.holmes@linaro.org>

>>>>

>>> wrote:

>>>

>>>> In many cases it is becasue the scripts do not add the current directory

>>>>> containing the executables to the path, I just fixed that in crypto

>>>>> examples and will send when Anders patches make it in

>>>>>

>>>>>

>>>>> I think that should be fixed. It's good to have scripts that run

>>>> through

>>>> all of these for regression purposes, but each test should be runnable

>>>> individually as well.

>>>>

>>>>

>>>>

>>>> On 14 July 2016 at 09:08, Bill Fischofer <bill.fischofer@linaro.org>

>>>>> wrote:

>>>>>

>>>>> Ok, make followed by make check looks like it works:

>>>>>>

>>>>>> make  check-TESTS

>>>>>> make[4]: Entering directory

>>>>>> '/home/bill/linaro/maxim/test/platform/linux-generic'

>>>>>> make[5]: Entering directory

>>>>>> '/home/bill/linaro/maxim/test/platform/linux-generic'

>>>>>> PASS: pktio/pktio_run.sh

>>>>>> SKIP: pktio/pktio_run_tap.sh

>>>>>> PASS: ring/ring_main

>>>>>> PASS: shmem/shmem_linux

>>>>>> PASS: ../../../test/validation/atomic/atomic_main

>>>>>> PASS: ../../../test/validation/barrier/barrier_main

>>>>>> PASS: ../../../test/validation/buffer/buffer_main

>>>>>> PASS: ../../../test/validation/classification/classification_main

>>>>>> PASS: ../../../test/validation/cpumask/cpumask_main

>>>>>> PASS: ../../../test/validation/crypto/crypto_main

>>>>>> PASS: ../../../test/validation/errno/errno_main

>>>>>> PASS: ../../../test/validation/hash/hash_main

>>>>>> PASS: ../../../test/validation/init/init_main_ok

>>>>>> PASS: ../../../test/validation/init/init_main_abort

>>>>>> PASS: ../../../test/validation/init/init_main_log

>>>>>> PASS: ../../../test/validation/lock/lock_main

>>>>>> PASS: ../../../test/validation/packet/packet_main

>>>>>> PASS: ../../../test/validation/pool/pool_main

>>>>>> PASS: ../../../test/validation/queue/queue_main

>>>>>> PASS: ../../../test/validation/random/random_main

>>>>>> PASS: ../../../test/validation/scheduler/scheduler_main

>>>>>> PASS: ../../../test/validation/std_clib/std_clib_main

>>>>>> PASS: ../../../test/validation/thread/thread_main

>>>>>> PASS: ../../../test/validation/time/time_main

>>>>>> PASS: ../../../test/validation/timer/timer_main

>>>>>> PASS: ../../../test/validation/traffic_mngr/traffic_mngr_main

>>>>>> PASS: ../../../test/validation/shmem/shmem_main

>>>>>> PASS: ../../../test/validation/system/system_main

>>>>>> PASS: cls/vlan_run.sh

>>>>>> PASS: pktio/pktio_run_pcap.sh

>>>>>>

>>>>>>

>>>>>>

>>> ============================================================================

>>>

>>>> Testsuite summary for OpenDataPlane 1.10.1.0.git46.gcd0ad6c

>>>>>>

>>>>>>

>>>>>>

>>> ============================================================================

>>>

>>>> # TOTAL: 30

>>>>>> # PASS:  29

>>>>>> # SKIP:  1

>>>>>> # XFAIL: 0

>>>>>> # FAIL:  0

>>>>>> # XPASS: 0

>>>>>> # ERROR: 0

>>>>>>

>>>>>> Is there any reason why I can't run the test manually, however?

>>>>>>

>>>>>>

>>>>>> On Thu, Jul 14, 2016 at 7:56 AM, Maxim Uvarov <

>>>>>> maxim.uvarov@linaro.org

>>>>>> wrote:

>>>>>>

>>>>>> On 07/14/16 14:50, Bill Fischofer wrote:

>>>>>>>

>>>>>>>

>>>>>>>> On Thu, Jul 14, 2016 at 3:29 AM, Maxim Uvarov <

>>>>>>>>

>>>>>>> maxim.uvarov@linaro.org

>>>

>>>> <mailto:maxim.uvarov@linaro.org>> wrote:

>>>>>>>>

>>>>>>>>      On 07/13/16 22:32, Bill Fischofer wrote:

>>>>>>>>

>>>>>>>>          This applies and compiles fine, but I'm not sure how I'm

>>>>>>>>          supposed to run it.  Does this require sudo? Neither with

>>>>>>>> or

>>>>>>>>          without seems to work for me:

>>>>>>>>

>>>>>>>>      I do not see in your output that pcap pktio was compiled in (no

>>>>>>>>      open for it). In that case code should be compiled but should

>>>>>>>>

>>>>>>> not

>>>

>>>>      be executed.

>>>>>>>>      apt-get install libpcap-dev

>>>>>>>>      should help.

>>>>>>>>

>>>>>>>>

>>>>>>>> I installed that library and I get the same output (abort without

>>>>>>>>

>>>>>>> sudo,

>>>

>>>> complaint that it can't find test_out.pcap with sudo)

>>>>>>>>

>>>>>>>>

>>>>>>>>      It does not matter root or not root. Code should work for

>>>>>>>> direct

>>>>>>>>      call ./cls_run or make check / make distcheck targets.

>>>>>>>>

>>>>>>>>

>>>>>>>> There is no ./cls_run. The executable I see in that directory is

>>>>>>>>

>>>>>>> named

>>>

>>>> ./vlan_run.sh. Am I missing something?

>>>>>>>>

>>>>>>>> I ran make, not make distcheck. Is that the issue?

>>>>>>>>

>>>>>>>> ./vlan_run.sh is correct name.

>>>>>>>

>>>>>>> you run make, than make check.

>>>>>>>

>>>>>>> ./bootstrap; ./configure  --enable-test-vald  --enable-test-perf

>>>>>>> --enable-test-cpp   --enable-debug  --enable-debug-print

>>>>>>> --enable-user-guides --enable-test-example --enable-test-helper

>>>>>>> --enable-debug

>>>>>>>

>>>>>>>

>>>>>>>

>>>>>>>      Maxim.

>>>>>>>>

>>>>>>>>

>>>>>>>>

>>>>>>>>

>>>>>

>>>>> --

>>>>> 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"

>>>>>

>>>>>

>>>>>

>>>>>

>
Maxim Uvarov July 29, 2016, 3:40 p.m. UTC | #15
On 07/29/16 18:12, Bill Fischofer wrote:
> My last comment was that this runs fine with make check but the test 

> doesn't run stand-alone. Can that be fixed?

>


yes, sure, will send v2

Maxim.

> On Fri, Jul 29, 2016 at 9:37 AM, Maxim Uvarov <maxim.uvarov@linaro.org 

> <mailto:maxim.uvarov@linaro.org>> wrote:

>

>     as I remember we agreed that this patch can be applied.  Review is

>     needed before merging...

>

>     Maxim.

>

>

>     On 07/14/16 19:53, Bill Fischofer wrote:

>

>         I think general pcap file support is likely to prove useful in

>         all sorts of

>         ways. Validation testing (especially for error cases) is

>         certainly one

>         area. Flow routing should be another since packets may only

>         partially touch

>         cores so how do we test that an IPSec packet can be input and

>         received by a

>         core already decrypted?

>

>         On Thu, Jul 14, 2016 at 10:56 AM, Bala Manoharan

>         <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>>

>         wrote:

>

>             This approach of using a pcap file might be useful to

>             recreate an

>             error scenario but IMO it will be difficult to maintain

>             different pcap

>             file for test cases.

>             Is this method proposed for validation testing or for flow

>             testing?

>

>             Regards,

>             Bala

>

>

>             On 14 July 2016 at 18:42, Bill Fischofer

>             <bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>

>             wrote:

>

>                 On Thu, Jul 14, 2016 at 8:10 AM, Mike Holmes

>                 <mike.holmes@linaro.org <mailto:mike.holmes@linaro.org>>

>

>             wrote:

>

>                     In many cases it is becasue the scripts do not add

>                     the current directory

>                     containing the executables to the path, I just

>                     fixed that in crypto

>                     examples and will send when Anders patches make it in

>

>

>                 I think that should be fixed. It's good to have

>                 scripts that run through

>                 all of these for regression purposes, but each test

>                 should be runnable

>                 individually as well.

>

>

>

>                     On 14 July 2016 at 09:08, Bill Fischofer

>                     <bill.fischofer@linaro.org

>                     <mailto:bill.fischofer@linaro.org>>

>                     wrote:

>

>                         Ok, make followed by make check looks like it

>                         works:

>

>                         make  check-TESTS

>                         make[4]: Entering directory

>                         '/home/bill/linaro/maxim/test/platform/linux-generic'

>                         make[5]: Entering directory

>                         '/home/bill/linaro/maxim/test/platform/linux-generic'

>                         PASS: pktio/pktio_run.sh

>                         SKIP: pktio/pktio_run_tap.sh

>                         PASS: ring/ring_main

>                         PASS: shmem/shmem_linux

>                         PASS: ../../../test/validation/atomic/atomic_main

>                         PASS:

>                         ../../../test/validation/barrier/barrier_main

>                         PASS: ../../../test/validation/buffer/buffer_main

>                         PASS:

>                         ../../../test/validation/classification/classification_main

>                         PASS:

>                         ../../../test/validation/cpumask/cpumask_main

>                         PASS: ../../../test/validation/crypto/crypto_main

>                         PASS: ../../../test/validation/errno/errno_main

>                         PASS: ../../../test/validation/hash/hash_main

>                         PASS: ../../../test/validation/init/init_main_ok

>                         PASS:

>                         ../../../test/validation/init/init_main_abort

>                         PASS: ../../../test/validation/init/init_main_log

>                         PASS: ../../../test/validation/lock/lock_main

>                         PASS: ../../../test/validation/packet/packet_main

>                         PASS: ../../../test/validation/pool/pool_main

>                         PASS: ../../../test/validation/queue/queue_main

>                         PASS: ../../../test/validation/random/random_main

>                         PASS:

>                         ../../../test/validation/scheduler/scheduler_main

>                         PASS:

>                         ../../../test/validation/std_clib/std_clib_main

>                         PASS: ../../../test/validation/thread/thread_main

>                         PASS: ../../../test/validation/time/time_main

>                         PASS: ../../../test/validation/timer/timer_main

>                         PASS:

>                         ../../../test/validation/traffic_mngr/traffic_mngr_main

>                         PASS: ../../../test/validation/shmem/shmem_main

>                         PASS: ../../../test/validation/system/system_main

>                         PASS: cls/vlan_run.sh

>                         PASS: pktio/pktio_run_pcap.sh

>

>

>             ============================================================================

>

>                         Testsuite summary for OpenDataPlane

>                         1.10.1.0.git46.gcd0ad6c

>

>

>             ============================================================================

>

>                         # TOTAL: 30

>                         # PASS:  29

>                         # SKIP:  1

>                         # XFAIL: 0

>                         # FAIL:  0

>                         # XPASS: 0

>                         # ERROR: 0

>

>                         Is there any reason why I can't run the test

>                         manually, however?

>

>

>                         On Thu, Jul 14, 2016 at 7:56 AM, Maxim Uvarov

>                         <maxim.uvarov@linaro.org

>                         <mailto:maxim.uvarov@linaro.org>

>                         wrote:

>

>                             On 07/14/16 14:50, Bill Fischofer wrote:

>

>

>                                 On Thu, Jul 14, 2016 at 3:29 AM, Maxim

>                                 Uvarov <

>

>             maxim.uvarov@linaro.org <mailto:maxim.uvarov@linaro.org>

>

>                                 <mailto:maxim.uvarov@linaro.org

>                                 <mailto:maxim.uvarov@linaro.org>>> wrote:

>

>                                      On 07/13/16 22:32, Bill Fischofer

>                                 wrote:

>

>                                          This applies and compiles

>                                 fine, but I'm not sure how I'm

>                                          supposed to run it.  Does

>                                 this require sudo? Neither with or

>                                          without seems to work for me:

>

>                                      I do not see in your output that

>                                 pcap pktio was compiled in (no

>                                      open for it). In that case code

>                                 should be compiled but should

>

>             not

>

>                                      be executed.

>                                      apt-get install libpcap-dev

>                                      should help.

>

>

>                                 I installed that library and I get the

>                                 same output (abort without

>

>             sudo,

>

>                                 complaint that it can't find

>                                 test_out.pcap with sudo)

>

>

>                                      It does not matter root or not

>                                 root. Code should work for direct

>                                      call ./cls_run or make check /

>                                 make distcheck targets.

>

>

>                                 There is no ./cls_run. The executable

>                                 I see in that directory is

>

>             named

>

>                                 ./vlan_run.sh. Am I missing something?

>

>                                 I ran make, not make distcheck. Is

>                                 that the issue?

>

>                             ./vlan_run.sh is correct name.

>

>                             you run make, than make check.

>

>                             ./bootstrap; ./configure

>                             --enable-test-vald  --enable-test-perf

>                             --enable-test-cpp   --enable-debug

>                             --enable-debug-print

>                             --enable-user-guides --enable-test-example

>                             --enable-test-helper

>                             --enable-debug

>

>

>

>                                      Maxim.

>

>

>

>

>

>                     --

>                     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/test/platform/linux-generic/.gitignore b/test/platform/linux-generic/.gitignore
index 5dabf91..f65c7c1 100644
--- a/test/platform/linux-generic/.gitignore
+++ b/test/platform/linux-generic/.gitignore
@@ -1,3 +1,4 @@ 
 *.log
 *.trs
 tests-validation.env
+test_out.pcap
diff --git a/test/platform/linux-generic/Makefile.am b/test/platform/linux-generic/Makefile.am
index 2d58c57..df6e950 100644
--- a/test/platform/linux-generic/Makefile.am
+++ b/test/platform/linux-generic/Makefile.am
@@ -1,7 +1,9 @@ 
 include $(top_srcdir)/test/Makefile.inc
 TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
+TEST_EXTENSIONS = .sh
 
-ODP_MODULES = pktio \
+ODP_MODULES = cls \
+	      pktio \
 	      ring \
 	      shmem
 
@@ -37,7 +39,11 @@  TESTS = pktio/pktio_run.sh \
 
 SUBDIRS = $(ODP_MODULES)
 
+dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)
+
 if HAVE_PCAP
+TESTS += cls/vlan_run.sh
+dist_check_SCRIPTS += cls/vlan_run.sh cls/vlan.pcap
 TESTS += pktio/pktio_run_pcap.sh
 endif
 if PKTIO_IPC
@@ -52,10 +58,6 @@  TESTS += pktio/pktio_run_dpdk.sh
 endif
 endif
 
-TEST_EXTENSIONS = .sh
-
-dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER)
-
 test_SCRIPTS = $(dist_check_SCRIPTS)
 
 tests-validation.env:
diff --git a/test/platform/linux-generic/cls/.gitignore b/test/platform/linux-generic/cls/.gitignore
new file mode 100644
index 0000000..9447625
--- /dev/null
+++ b/test/platform/linux-generic/cls/.gitignore
@@ -0,0 +1,3 @@ 
+cls_main
+*.log
+*.trs
diff --git a/test/platform/linux-generic/cls/Makefile.am b/test/platform/linux-generic/cls/Makefile.am
new file mode 100644
index 0000000..43fb0bc
--- /dev/null
+++ b/test/platform/linux-generic/cls/Makefile.am
@@ -0,0 +1,13 @@ 
+include ../Makefile.inc
+
+noinst_LTLIBRARIES = libtestcls.la
+libtestcls_la_SOURCES = cls.c
+libtestcls_la_CFLAGS = $(AM_CFLAGS) $(INCCUNIT_COMMON) $(INCODP)
+
+test_PROGRAMS = cls_main$(EXEEXT)
+dist_cls_main_SOURCES = cls_main.c
+
+cls_main_LDFLAGS = $(AM_LDFLAGS)
+cls_main_LDADD = libtestcls.la $(LIBCUNIT_COMMON) $(LIBODP)
+
+noinst_HEADERS = cls_suites.h
diff --git a/test/platform/linux-generic/cls/cls.c b/test/platform/linux-generic/cls/cls.c
new file mode 100644
index 0000000..d527ec8
--- /dev/null
+++ b/test/platform/linux-generic/cls/cls.c
@@ -0,0 +1,349 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <inttypes.h>
+
+#include <test_debug.h>
+
+#include <odp_api.h>
+#include <odp/helper/linux.h>
+#include <odp/helper/eth.h>
+#include <odp/helper/ip.h>
+
+#include <odp_packet_internal.h>
+
+#include "cls_suites.h"
+
+/** Get rid of path in filename - only for unix-type paths using '/' */
+#define NO_PATH(file_name) (strrchr((file_name), '/') ? \
+			    strrchr((file_name), '/') + 1 : (file_name))
+
+/**
+ * Print usage information
+ */
+static void usage(char *progname)
+{
+	printf("\n"
+	       "This is test application to verify that linux-generic classifier\n"
+	       "correctly classifies packets on input. Main intend is add more code\n"
+	       "coverage for internal functions playing different traffic recorded to\n"
+	       "pcap files."
+	       "\n"
+	       "Usage: %s OPTIONS\n"
+	       "  E.g. %s -i pcap_file -e expected_bitmask\n"
+	       "\n"
+	       "Mandatory OPTIONS:\n"
+	       "  -i, pcap file name\n"
+	       "  -e, expected packet bitmask\n"
+	       "\n", NO_PATH(progname), NO_PATH(progname)
+	    );
+}
+
+/** @def SHM_PKT_POOL_SIZE
+ * @brief Size of the shared memory block
+ */
+#define SHM_PKT_POOL_SIZE      512
+
+/** @def SHM_PKT_POOL_BUF_SIZE
+ * @brief Buffer size of the packet pool buffer
+ */
+#define SHM_PKT_POOL_BUF_SIZE  1856
+
+/**
+ * Parsed command line application arguments
+ */
+typedef struct {
+	char *file_name;     /**< File name for pcap pktio */
+	odp_pktio_t pktio;  /**< Pktio dev */
+	input_flags_t expected_bits; /**< Expected bits from test run */
+} appl_args_t;
+
+/**
+ * Grouping of both parsed CL args and thread specific args - alloc together
+ */
+typedef struct {
+	/** Application (parsed) arguments */
+	appl_args_t appl;
+} args_t;
+
+/** Global pointer to args */
+static args_t *args;
+/** Fill this bit struct to check which packet fields were classified */
+static input_flags_t packet_flags;
+
+/**
+ * Parse and store the command line arguments
+ *
+ * @param argc       argument count
+ * @param argv[]     argument vector
+ * @param appl_args  Store application arguments here
+ */
+static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
+{
+	int opt;
+	int long_index;
+	static const struct option longopts[] = {
+		{"interface", required_argument, NULL, 'i'},	/* return 'i' */
+		{"extected", required_argument, NULL, 'e'},	/* return 'e' */
+		{"help", no_argument, NULL, 'h'},		/* return 'h' */
+		{NULL, 0, NULL, 0}
+	};
+
+	static const char *shortopts = ":i:e:h";
+
+	/* let helper collect its own arguments (e.g. --odph_proc) */
+	odph_parse_options(argc, argv, shortopts, longopts);
+
+	appl_args->file_name = NULL;
+	opterr = 0; /* do not issue errors on helper options */
+	appl_args->expected_bits.all = 0;
+
+	while (1) {
+		opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
+
+		if (opt == -1)
+			break;	/* No more options */
+
+		switch (opt) {
+		case 'i':
+			appl_args->file_name =  optarg;
+			break;
+		case 'e':
+			appl_args->expected_bits.all = atoll(optarg);
+			break;
+
+		case 'h':
+			usage(argv[0]);
+			exit(EXIT_SUCCESS);
+			break;
+		default:
+			break;
+		}
+	}
+
+	if (!appl_args->file_name) {
+		usage(argv[0]);
+		exit(EXIT_SUCCESS);
+	}
+
+	optind = 1;		/* reset 'extern optind' from the getopt lib */
+}
+
+/**
+ * Create a pktio handle, optionally associating a default input queue.
+ *
+ * @param dev Name of device to open
+ * @param pool Pool to associate with device for packet RX/TX
+ * @param mode Packet processing mode for this device (BURST or QUEUE)
+ *
+ * @return The handle of the created pktio object.
+ * @retval ODP_PKTIO_INVALID if the create fails.
+ */
+static odp_pktio_t create_pktio(const char *fname, odp_pool_t pool)
+{
+	odp_pktio_t pktio;
+	int ret;
+	odp_pktio_param_t pktio_param;
+	odp_pktin_queue_param_t pktin_param;
+	char dev[255];
+
+	odp_pktio_param_init(&pktio_param);
+	pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
+
+	memset(dev, 0, 255);
+	sprintf(dev, "pcap:in=%s:out=test_out.pcap",  fname);
+
+	/* Open a packet IO instance */
+	pktio = odp_pktio_open(dev, pool, &pktio_param);
+	if (pktio == ODP_PKTIO_INVALID)
+		LOG_ABORT("Error: pktio create failed for %s\n", dev);
+
+	odp_pktin_queue_param_init(&pktin_param);
+
+	pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
+
+	if (odp_pktin_queue_config(pktio, &pktin_param))
+		LOG_ABORT("Error: pktin config failed for %s\n", dev);
+
+	if (odp_pktout_queue_config(pktio, NULL))
+		LOG_ABORT("Error: pktout config failed for %s\n", dev);
+
+	ret = odp_pktio_start(pktio);
+	if (ret != 0)
+		LOG_ABORT("Error: unable to start %s\n", dev);
+
+	printf("  created pktio:%02" PRIu64
+	       ", dev:%s, queue mode (ATOMIC queues)\n"
+	       "  \tdefault pktio%02" PRIu64 "\n",
+	       odp_pktio_to_u64(pktio), dev,
+	       odp_pktio_to_u64(pktio));
+
+	return pktio;
+}
+
+/**
+ * Packet IO loopback worker thread using ODP queues
+ *
+ * @param arg  thread arguments of type 'thread_args_t *'
+ */
+static int pktio_queue_thread(void *arg ODP_UNUSED)
+{
+	int thr = odp_thread_id();
+	odp_pktout_queue_t pktout;
+	odp_packet_t pkt;
+	odp_event_t ev;
+	uint64_t sched_wait = odp_schedule_wait_time(ODP_TIME_MSEC_IN_NS * 100);
+
+	packet_flags.all = 0;
+
+	/* Loop packets */
+	while (1) {
+		odp_pktio_t pktio_tmp;
+
+		ev = odp_schedule(NULL, sched_wait);
+		if (ev == ODP_EVENT_INVALID)
+			break;
+
+		pkt = odp_packet_from_event(ev);
+		if (!odp_packet_is_valid(pkt))
+			continue;
+
+		pktio_tmp = odp_packet_input(pkt);
+
+		if (odp_pktout_queue(pktio_tmp, &pktout, 1) != 1) {
+			LOG_ERR("  [%02i] Error: no pktout queue\n", thr);
+			return -1;
+		}
+
+		/* Extend bits here for more additional tests */
+		if (odp_packet_has_l2(pkt))
+			packet_flags.parsed_l2 = 1;
+		if (odp_packet_has_vlan(pkt))
+			packet_flags.vlan = 1;
+
+		/* Enqueue the packet for output */
+		if (odp_pktout_send(pktout, &pkt, 1) != 1) {
+			LOG_ERR("  [%i] Packet send failed.\n", thr);
+			odp_packet_free(pkt);
+			continue;
+		}
+	}
+
+	return 0;
+}
+
+int cls_main(int argc, char *argv[])
+{
+	odph_odpthread_t thread_tbl[1];
+	odp_pool_t pool;
+	int num_workers;
+	int i;
+	int cpu;
+	odp_cpumask_t cpumask;
+	char cpumaskstr[ODP_CPUMASK_STR_SIZE];
+	odp_pool_param_t params;
+	odp_instance_t instance;
+	odph_odpthread_params_t thr_params;
+
+	args = calloc(1, sizeof(args_t));
+	if (args == NULL) {
+		LOG_ERR("Error: args mem alloc failed.\n");
+		exit(EXIT_FAILURE);
+	}
+
+	parse_args(argc, argv, &args->appl);
+
+	/* Init ODP before calling anything else */
+	if (odp_init_global(&instance, NULL, NULL)) {
+		LOG_ERR("Error: ODP global init failed.\n");
+		exit(EXIT_FAILURE);
+	}
+
+	/* Init this thread */
+	if (odp_init_local(instance, ODP_THREAD_CONTROL)) {
+		LOG_ERR("Error: ODP local init failed.\n");
+		exit(EXIT_FAILURE);
+	}
+
+	num_workers = odp_cpumask_default_worker(&cpumask, 1);
+	(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
+
+	/* Create packet pool */
+	odp_pool_param_init(&params);
+	params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
+	params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;
+	params.pkt.num     = SHM_PKT_POOL_SIZE;
+	params.type        = ODP_POOL_PACKET;
+
+	pool = odp_pool_create("packet_pool", &params);
+	if (pool == ODP_POOL_INVALID) {
+		LOG_ERR("Error: packet pool create failed.\n");
+		exit(EXIT_FAILURE);
+	}
+
+	args->appl.pktio = create_pktio(args->appl.file_name, pool);
+
+	/* Create and init worker threads */
+	memset(thread_tbl, 0, sizeof(thread_tbl));
+
+	memset(&thr_params, 0, sizeof(thr_params));
+	thr_params.thr_type = ODP_THREAD_WORKER;
+	thr_params.instance = instance;
+
+	cpu = odp_cpumask_first(&cpumask);
+	for (i = 0; i < num_workers; ++i) {
+		odp_cpumask_t thd_mask;
+		int (*thr_run_func)(void *);
+
+		thr_run_func = pktio_queue_thread;
+		/*
+		 * Create threads one-by-one instead of all-at-once,
+		 * because each thread might get different arguments.
+		 * Calls odp_thread_create(cpu) for each thread
+		 */
+		odp_cpumask_zero(&thd_mask);
+		odp_cpumask_set(&thd_mask, cpu);
+
+		thr_params.start = thr_run_func;
+		thr_params.arg   = &args;
+
+		odph_odpthreads_create(&thread_tbl[i], &thd_mask, &thr_params);
+		cpu = odp_cpumask_next(&cpumask, cpu);
+	}
+
+	/* Master thread waits for other threads to exit */
+	for (i = 0; i < num_workers; ++i)
+		odph_odpthreads_join(&thread_tbl[i]);
+
+	odp_pktio_stop(args->appl.pktio);
+	odp_pktio_close(args->appl.pktio);
+
+	while (1) {
+		odp_event_t ev;
+
+		ev = odp_schedule(NULL, 0);
+		if (ev == ODP_EVENT_INVALID)
+			break;
+	}
+
+	odp_pool_destroy(pool);
+	odp_term_local();
+	odp_term_global(instance);
+
+	if (packet_flags.all != args->appl.expected_bits.all) {
+		LOG_ERR("Flags %" PRIu64 " expected %" PRIu64 "\n",
+			packet_flags.all, args->appl.expected_bits.all);
+		free(args);
+		return -1;
+	}
+
+	free(args);
+	return 0;
+}
diff --git a/test/platform/linux-generic/cls/cls_main.c b/test/platform/linux-generic/cls/cls_main.c
new file mode 100644
index 0000000..40179b9
--- /dev/null
+++ b/test/platform/linux-generic/cls/cls_main.c
@@ -0,0 +1,12 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include "cls_suites.h"
+
+int main(int argc, char *argv[])
+{
+	return cls_main(argc, argv);
+}
diff --git a/test/platform/linux-generic/cls/cls_suites.h b/test/platform/linux-generic/cls/cls_suites.h
new file mode 100644
index 0000000..94c9b55
--- /dev/null
+++ b/test/platform/linux-generic/cls/cls_suites.h
@@ -0,0 +1 @@ 
+int cls_main(int argc, char *argv[]);
diff --git a/test/platform/linux-generic/cls/vlan.pcap b/test/platform/linux-generic/cls/vlan.pcap
new file mode 100644
index 0000000000000000000000000000000000000000..106ccb682e51495b4025337518a0bce63c2c7681
GIT binary patch
literal 9728
zcmeHNeQXrR6@R<F^Iq)3b|{=(C16{8IUt}71RM^-2~wIU*pOl>ikyh3QAN~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<lLnYk>-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-<X$<;!oI~ik=uuzyOrT5ATGkaPBO2JlXV}BNmHltQH1XBQqGIxB
zljw+U^mWzt`dC-+XBzhK8TN2Tj(!$l@3W%oreFHHd@xpu)``6eKOy$gmCxBdp4?km
zcOk;wono&-@A$eG`7XZiNzwWmd-x3haEHC`0}y;QvZ#0!b{bfxaRTgY=FeI7XemDg
zrt~v(2bR#*#*@ZM8*9~NW2GVr#A;%NVz9F1ZjF^e?ya$>uoBL#iIo(6N4XHj>S(MG
zeb3ib&#l6WQUqAxJ_;+1G%sQ<6jmy<(AQPlQ&<V@nONzj-$&R}SgBCO*Ck?w=N1@3
ztzC_<r?BGDHD4ECg)ywKqF4*@npnxu3)8|1QTKm^m5M(TBzz!q>u6q?Ejk-3sTiy%
zJLqU*1*lbZW@5#)vBLROyi$q5N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cGXX+DRoz`pSeQC2_O!0pfvZ7;gZocCA|HJ+)q%N#r>S}s!E9?#x$mpi>Ywi-))
zzlqPPulkI+{1I<Q$9P~!WW+Dz^Aho(8Sz_>=!jps-HaGs&hb6xvm83*LP+jfr{?Bf
zI_W|jxoaKf2D63d>gQgWH`vr!f<1NJC-ZiBu|or#2S`*D&f5H1L^1ZenkfFNqp0wI
zSNQ)QAvgyjv46|5;Cj<-r46np&s0uZI3frlYYB8{@6ZhP9)c)li1)B%M;7X4_~V3;
zweY?r!UwhjTaiBax{uQbVC0ia6YITCFtX0f?z#7McFRAtvy0s`aDWT^itOSU<``9e
z*o8Q9*E$t7pW+Ae-z3@9wtyG(Q9m~XI#usY+z*2OO@f;?E}jJRuan5`F(W(w6&+cA
zwHX;uyoe*XMIvi=PPq_Zq+RM4y2TP<&N=BqfRS9F>k(Zw`a|6ku?bs}H2&4@V19<y
zID}Ini24?e_AhE5T`)?NmT%$iQtg$F&ri|}c4@KSDc;0y{aiISvdwh*S?0(k1@)&>
zQ7plIU*=6|dR#J=D<oFhda1NSH5ognGq!{Y*RQl!v7!LwU*O1E{OJDRV*$_b-zLDq
zQO3ei&J^yz0(2S+l^`1m3)&VifIih&fKFqf!Wckb+_euHkKzNjM0<@#!v|j%=L2j_
H$A|v_$relS

literal 0
HcmV?d00001

diff --git a/test/platform/linux-generic/cls/vlan_run.sh b/test/platform/linux-generic/cls/vlan_run.sh
new file mode 100755
index 0000000..9849abf
--- /dev/null
+++ b/test/platform/linux-generic/cls/vlan_run.sh
@@ -0,0 +1,49 @@ 
+#!/bin/sh
+#
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier:      BSD-3-Clause
+#
+
+# 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 _build directory, when running after 'make distcheck',
+# -in the current directory.
+# running stand alone out of tree requires setting PATH
+PATH=${TEST_DIR}/pktio:$PATH
+PATH=$(dirname $0):$PATH
+PATH=$(dirname $0)/../../../../test/platform/linux-generic/cls:$PATH
+PATH=$(dirname $0)/../../../../_build/test/platform/linux-generic/cls:$PATH
+PATH=.:$PATH
+
+bin_path=$(which cls_main${EXEEXT})
+if [ -x "$bin_path" ] ; then
+	echo "Running with $bin_path"
+else
+	echo "Cannot find cls_main${EXEEXT}"
+	echo "Please set you PATH for it. PATH=$PATH"
+fi
+
+# Test1: find vlan packets in pcap file and test internal pkt_mmap_vlan_insert()
+#	 function. Load packets from vlan.pcap file and check that classifier
+#	 set vlan bits fisible with odp_packet_has_vlan().
+
+PCAP=`find . ${TEST_DIR} $(dirname $0) -name vlan.pcap -print -quit`
+
+cls_main -i $PCAP -e 4097
+ret=$?
+
+PCAP_IN_SIZE=`stat -c %s $PCAP`
+PCAP_OUT_SIZE=`stat -c %s test_out.pcap`
+
+rm -f test_out.pcap
+
+if [ ${ret} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then
+	echo "Error: status ${ret}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
+	exit 3
+fi
+
+echo "PASS: test 1 passed"
diff --git a/test/platform/linux-generic/m4/configure.m4 b/test/platform/linux-generic/m4/configure.m4
index 8c3db21..eb50756 100644
--- a/test/platform/linux-generic/m4/configure.m4
+++ b/test/platform/linux-generic/m4/configure.m4
@@ -1,4 +1,5 @@ 
 AC_CONFIG_FILES([test/platform/linux-generic/Makefile
+		 test/platform/linux-generic/cls/Makefile
 		 test/platform/linux-generic/shmem/Makefile
 		 test/platform/linux-generic/pktio/Makefile
 		 test/platform/linux-generic/pktio_ipc/Makefile