net: apps: Add sanity test changes to test_15_4
Add sanity test related changes to test_15_4 application in both micro and nano kernel. config_whitelist in testcase.ini is not accepting other than PLATFORM configs. So creating test folder for sanity tests. src directory is still common for all. Change-Id: Iffa4c588500367fa475aef8e0772f1c08946c5a4 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This commit is contained in:
parent
a81c968b0b
commit
1c0c1e4a00
14 changed files with 302 additions and 0 deletions
26
samples/microkernel/apps/network/test/test_15_4/Makefile
Normal file
26
samples/microkernel/apps/network/test/test_15_4/Makefile
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Makefile - IP 15.4 test Makefile for nanokernel
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011-2014, Wind River Systems, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
MDEF_FILE = prj.mdef
|
||||||
|
KERNEL_TYPE = micro
|
||||||
|
PLATFORM_CONFIG ?= basic_atom
|
||||||
|
CONF_FILE = prj_$(ARCH).conf
|
||||||
|
SOURCE_DIR = $(ZEPHYR_BASE)/samples/network/test_15_4/src/
|
||||||
|
|
||||||
|
include $(ZEPHYR_BASE)/Makefile.inc
|
||||||
|
include $(ZEPHYR_BASE)/samples/network/test_15_4/Makefile.15_4
|
84
samples/microkernel/apps/network/test/test_15_4/README
Normal file
84
samples/microkernel/apps/network/test/test_15_4/README
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
802.15.4 test Application:
|
||||||
|
|
||||||
|
1) Loopback in single qemu:
|
||||||
|
|
||||||
|
$ make qemu0
|
||||||
|
|
||||||
|
This enables the dummy driver will feed sending 802.15.4 frames back to
|
||||||
|
15_4 Rx FIFO. 15_4 Rx FIFO will asseble all frames and feed it to IP Rx FIFO.
|
||||||
|
|
||||||
|
|
||||||
|
2) Loopback between two qemus without monitoring support:
|
||||||
|
|
||||||
|
$ make qemu1
|
||||||
|
|
||||||
|
Then in second window start the other qemu
|
||||||
|
|
||||||
|
$ make qemu2
|
||||||
|
|
||||||
|
If you want to run test 3) then you need to remove the pipes before
|
||||||
|
doing so.
|
||||||
|
|
||||||
|
$ make remove_pipes
|
||||||
|
|
||||||
|
3) Loopback between two qemus with monitoring support:
|
||||||
|
|
||||||
|
$ make qemu1monitor
|
||||||
|
|
||||||
|
Then in second window start the monitor (found in net/ip/tools directory)
|
||||||
|
$ ./monitor_15_4 sample.pcap
|
||||||
|
|
||||||
|
Then in third window start the other qemu
|
||||||
|
|
||||||
|
$ make qemu2monitor
|
||||||
|
|
||||||
|
If you want to run test 2) then you need to remove the pipes before
|
||||||
|
doing so.
|
||||||
|
|
||||||
|
$ make remove_pipes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Expert and more detailed instructions:
|
||||||
|
--------------------------------------
|
||||||
|
You can execute the tests manually if needed. Just follow the instructions
|
||||||
|
below.
|
||||||
|
|
||||||
|
802.15.4 test Application:
|
||||||
|
|
||||||
|
1) Loopback in single qemu:
|
||||||
|
Enable CONFIG_NETWORKING_WITH_15_4_LOOPBACK config option in prj_x86/arm.conf
|
||||||
|
to test 802.15.4. By enabling this option dummy driver will feed sending
|
||||||
|
802.15.4 frames back to 15_4 Rx FIFO. 15_4 Rx FIFO will asseble all frames
|
||||||
|
and feed it to IP Rx FIFO.
|
||||||
|
|
||||||
|
2) Loopback between two qemus:
|
||||||
|
Enable CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART config option in
|
||||||
|
prj_x86/arm.conf to send 802.15.4 frames out through QEMU UART and receive
|
||||||
|
frames through QEMU UART.
|
||||||
|
|
||||||
|
Follow below simple steps to create fifos at host.
|
||||||
|
|
||||||
|
$ mkfifo /tmp/ip-15-4-1.{in,out}
|
||||||
|
$ ln /tmp/ip-15-4-1.in /tmp/ip-15-4-2.out
|
||||||
|
$ ln /tmp/ip-15-4-1.out /tmp/ip-15-4-2.in
|
||||||
|
|
||||||
|
Open two terminals and run two qemus with below options.
|
||||||
|
$ make qemu QEMU_NUM=1 CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y
|
||||||
|
$ make qemu QEMU_NUM=2 CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y
|
||||||
|
|
||||||
|
3) Loopback between two qemus and pcap support:
|
||||||
|
Enable CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART config option in
|
||||||
|
prj_x86/arm.conf to send 802.15.4 frames out through QEMU UART and receive
|
||||||
|
frames through QEMU UART.
|
||||||
|
|
||||||
|
Follow below simple steps to create fifos at host.
|
||||||
|
|
||||||
|
$ mkfifo /tmp/ip-15-4-1.{in,out}
|
||||||
|
$ mkfifo /tmp/ip-15-4-2.{in,out}
|
||||||
|
|
||||||
|
also read net/ip/contiki/tools/README and run monitor_15.4
|
||||||
|
and then
|
||||||
|
|
||||||
|
$ make qemu QEMU_NUM=1 CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y
|
||||||
|
$ make qemu QEMU_NUM=2 CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y
|
16
samples/microkernel/apps/network/test/test_15_4/prj.mdef
Normal file
16
samples/microkernel/apps/network/test/test_15_4/prj.mdef
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
% Application : Network demo
|
||||||
|
|
||||||
|
% Warning: Saving a VxMicro project file (.vpf) with the
|
||||||
|
% VxMicro Project Manager (VPM) tool will result in any
|
||||||
|
% manually entered comments being removed, along with
|
||||||
|
% any format changes being undone.
|
||||||
|
|
||||||
|
% TASK NAME PRIO ENTRY STACK GROUPS
|
||||||
|
% ==================================
|
||||||
|
TASK TASKA 7 taskA 2048 [EXE]
|
||||||
|
TASK TASKB 7 taskB 2048 [EXE]
|
||||||
|
|
||||||
|
% SEMA NAME
|
||||||
|
% =============
|
||||||
|
SEMA TASKASEM
|
||||||
|
SEMA TASKBSEM
|
|
@ -0,0 +1,6 @@
|
||||||
|
CONFIG_NETWORKING=y
|
||||||
|
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||||
|
CONFIG_NETWORKING_WITH_6LOWPAN=y
|
||||||
|
CONFIG_NETWORKING_WITH_15_4=y
|
||||||
|
CONFIG_NET_BUF_RX_SIZE=5
|
||||||
|
CONFIG_NET_BUF_TX_SIZE=3
|
|
@ -0,0 +1,8 @@
|
||||||
|
CONFIG_NETWORKING=y
|
||||||
|
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||||
|
CONFIG_NETWORKING_WITH_6LOWPAN=y
|
||||||
|
CONFIG_NETWORKING_WITH_15_4=y
|
||||||
|
CONFIG_NET_BUF_RX_SIZE=5
|
||||||
|
CONFIG_NET_BUF_TX_SIZE=3
|
||||||
|
CONFIG_NET_15_4_LOOPBACK_NUM=1
|
||||||
|
CONFIG_NET_SANITY_TEST=y
|
|
@ -0,0 +1,4 @@
|
||||||
|
[test]
|
||||||
|
tags = net
|
||||||
|
arch_whitelist = x86
|
||||||
|
platform_whitelist = basic_atom
|
26
samples/network/test/test_15_4/Makefile
Normal file
26
samples/network/test/test_15_4/Makefile
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Makefile - IP 15.4 test Makefile for nanokernel
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011-2014, Wind River Systems, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
MDEF_FILE = prj.mdef
|
||||||
|
KERNEL_TYPE = nano
|
||||||
|
PLATFORM_CONFIG ?= basic_atom
|
||||||
|
CONF_FILE = prj_$(ARCH).conf
|
||||||
|
SOURCE_DIR = $(ZEPHYR_BASE)/samples/network/test_15_4/src/
|
||||||
|
|
||||||
|
include $(ZEPHYR_BASE)/Makefile.inc
|
||||||
|
include $(ZEPHYR_BASE)/samples/network/test_15_4/Makefile.15_4
|
84
samples/network/test/test_15_4/README
Normal file
84
samples/network/test/test_15_4/README
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
802.15.4 test Application:
|
||||||
|
|
||||||
|
1) Loopback in single qemu:
|
||||||
|
|
||||||
|
$ make qemu0
|
||||||
|
|
||||||
|
This enables the dummy driver will feed sending 802.15.4 frames back to
|
||||||
|
15_4 Rx FIFO. 15_4 Rx FIFO will asseble all frames and feed it to IP Rx FIFO.
|
||||||
|
|
||||||
|
|
||||||
|
2) Loopback between two qemus without monitoring support:
|
||||||
|
|
||||||
|
$ make qemu1
|
||||||
|
|
||||||
|
Then in second window start the other qemu
|
||||||
|
|
||||||
|
$ make qemu2
|
||||||
|
|
||||||
|
If you want to run test 3) then you need to remove the pipes before
|
||||||
|
doing so.
|
||||||
|
|
||||||
|
$ make remove_pipes
|
||||||
|
|
||||||
|
3) Loopback between two qemus with monitoring support:
|
||||||
|
|
||||||
|
$ make qemu1monitor
|
||||||
|
|
||||||
|
Then in second window start the monitor (found in net/ip/tools directory)
|
||||||
|
$ ./monitor_15_4 sample.pcap
|
||||||
|
|
||||||
|
Then in third window start the other qemu
|
||||||
|
|
||||||
|
$ make qemu2monitor
|
||||||
|
|
||||||
|
If you want to run test 2) then you need to remove the pipes before
|
||||||
|
doing so.
|
||||||
|
|
||||||
|
$ make remove_pipes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Expert and more detailed instructions:
|
||||||
|
--------------------------------------
|
||||||
|
You can execute the tests manually if needed. Just follow the instructions
|
||||||
|
below.
|
||||||
|
|
||||||
|
802.15.4 test Application:
|
||||||
|
|
||||||
|
1) Loopback in single qemu:
|
||||||
|
Enable CONFIG_NETWORKING_WITH_15_4_LOOPBACK config option in prj_x86/arm.conf
|
||||||
|
to test 802.15.4. By enabling this option dummy driver will feed sending
|
||||||
|
802.15.4 frames back to 15_4 Rx FIFO. 15_4 Rx FIFO will asseble all frames
|
||||||
|
and feed it to IP Rx FIFO.
|
||||||
|
|
||||||
|
2) Loopback between two qemus:
|
||||||
|
Enable CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART config option in
|
||||||
|
prj_x86/arm.conf to send 802.15.4 frames out through QEMU UART and receive
|
||||||
|
frames through QEMU UART.
|
||||||
|
|
||||||
|
Follow below simple steps to create fifos at host.
|
||||||
|
|
||||||
|
$ mkfifo /tmp/ip-15-4-1.{in,out}
|
||||||
|
$ ln /tmp/ip-15-4-1.in /tmp/ip-15-4-2.out
|
||||||
|
$ ln /tmp/ip-15-4-1.out /tmp/ip-15-4-2.in
|
||||||
|
|
||||||
|
Open two terminals and run two qemus with below options.
|
||||||
|
$ make qemu QEMU_NUM=1 CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y
|
||||||
|
$ make qemu QEMU_NUM=2 CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y
|
||||||
|
|
||||||
|
3) Loopback between two qemus and pcap support:
|
||||||
|
Enable CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART config option in
|
||||||
|
prj_x86/arm.conf to send 802.15.4 frames out through QEMU UART and receive
|
||||||
|
frames through QEMU UART.
|
||||||
|
|
||||||
|
Follow below simple steps to create fifos at host.
|
||||||
|
|
||||||
|
$ mkfifo /tmp/ip-15-4-1.{in,out}
|
||||||
|
$ mkfifo /tmp/ip-15-4-2.{in,out}
|
||||||
|
|
||||||
|
also read net/ip/contiki/tools/README and run monitor_15.4
|
||||||
|
and then
|
||||||
|
|
||||||
|
$ make qemu QEMU_NUM=1 CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y
|
||||||
|
$ make qemu QEMU_NUM=2 CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y
|
1
samples/network/test/test_15_4/prj.mdef
Normal file
1
samples/network/test/test_15_4/prj.mdef
Normal file
|
@ -0,0 +1 @@
|
||||||
|
% Application : Network demo
|
6
samples/network/test/test_15_4/prj_arm.conf
Normal file
6
samples/network/test/test_15_4/prj_arm.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
CONFIG_NETWORKING=y
|
||||||
|
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||||
|
CONFIG_NETWORKING_WITH_6LOWPAN=y
|
||||||
|
CONFIG_NETWORKING_WITH_15_4=y
|
||||||
|
CONFIG_NET_BUF_RX_SIZE=5
|
||||||
|
CONFIG_NET_BUF_TX_SIZE=3
|
8
samples/network/test/test_15_4/prj_x86.conf
Normal file
8
samples/network/test/test_15_4/prj_x86.conf
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
CONFIG_NETWORKING=y
|
||||||
|
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||||
|
CONFIG_NETWORKING_WITH_6LOWPAN=y
|
||||||
|
CONFIG_NETWORKING_WITH_15_4=y
|
||||||
|
CONFIG_NET_BUF_RX_SIZE=5
|
||||||
|
CONFIG_NET_BUF_TX_SIZE=3
|
||||||
|
CONFIG_NET_15_4_LOOPBACK_NUM=1
|
||||||
|
CONFIG_NET_SANITY_TEST=y
|
4
samples/network/test/test_15_4/testcase.ini
Normal file
4
samples/network/test/test_15_4/testcase.ini
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[test]
|
||||||
|
tags = net
|
||||||
|
arch_whitelist = x86
|
||||||
|
platform_whitelist = basic_atom
|
|
@ -3,5 +3,6 @@ ccflags-y += -I${srctree}/net/ip/contiki
|
||||||
ccflags-y += -I${srctree}/net/ip/contiki/os/lib
|
ccflags-y += -I${srctree}/net/ip/contiki/os/lib
|
||||||
ccflags-y += -I${srctree}/net/ip/contiki/os
|
ccflags-y += -I${srctree}/net/ip/contiki/os
|
||||||
ccflags-y += -I${srctree}/net/ip
|
ccflags-y += -I${srctree}/net/ip
|
||||||
|
ccflags-$(CONFIG_NET_SANITY_TEST) += -I${srctree}/samples/include
|
||||||
|
|
||||||
obj-y = network.o
|
obj-y = network.o
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
#define PRINT printk
|
#define PRINT printk
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_SANITY_TEST
|
||||||
|
#include <tc_util.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <net/net_core.h>
|
#include <net/net_core.h>
|
||||||
#include <net/net_socket.h>
|
#include <net/net_socket.h>
|
||||||
|
@ -72,6 +75,11 @@ const uip_lladdr_t dest_mac = { };
|
||||||
static struct net_addr loopback_addr;
|
static struct net_addr loopback_addr;
|
||||||
static struct net_addr any_addr;
|
static struct net_addr any_addr;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_SANITY_TEST
|
||||||
|
static int loopback = 0;
|
||||||
|
static int test_rp = TC_PASS;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Generated by http://www.lipsum.com/
|
/* Generated by http://www.lipsum.com/
|
||||||
* 2 paragraphs, 185 words, 1230 bytes of Lorem Ipsum
|
* 2 paragraphs, 185 words, 1230 bytes of Lorem Ipsum
|
||||||
* The send_data() will add one null byte at the end and
|
* The send_data() will add one null byte at the end and
|
||||||
|
@ -146,6 +154,9 @@ static void send_data(const char *taskname, struct net_context *ctx)
|
||||||
static void receive_data(const char *taskname, struct net_context *ctx)
|
static void receive_data(const char *taskname, struct net_context *ctx)
|
||||||
{
|
{
|
||||||
struct net_buf *buf;
|
struct net_buf *buf;
|
||||||
|
#ifdef CONFIG_NET_SANITY_TEST
|
||||||
|
int rp;
|
||||||
|
#endif
|
||||||
|
|
||||||
buf = net_receive(ctx, TICKS_NONE);
|
buf = net_receive(ctx, TICKS_NONE);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
@ -153,8 +164,25 @@ static void receive_data(const char *taskname, struct net_context *ctx)
|
||||||
__func__, net_buf_datalen(buf));
|
__func__, net_buf_datalen(buf));
|
||||||
if (memcmp(net_buf_data(buf), lorem_ipsum, sizeof(lorem_ipsum))) {
|
if (memcmp(net_buf_data(buf), lorem_ipsum, sizeof(lorem_ipsum))) {
|
||||||
PRINT("ERROR: data does not match\n");
|
PRINT("ERROR: data does not match\n");
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_SANITY_TEST
|
||||||
|
rp = TC_FAIL;
|
||||||
|
} else {
|
||||||
|
rp = TC_PASS;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
net_buf_put(buf);
|
net_buf_put(buf);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_SANITY_TEST
|
||||||
|
loopback++;
|
||||||
|
test_rp = test_rp && rp;
|
||||||
|
TC_END_RESULT(rp);
|
||||||
|
|
||||||
|
if (loopback == CONFIG_NET_15_4_LOOPBACK_NUM) {
|
||||||
|
loopback = 0;
|
||||||
|
TC_END_REPORT(test_rp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue