@@ -14,5 +14,5 @@ libthrmask_common_la_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK
endif
-noinst_HEADERS = test_debug.h
+noinst_HEADERS = test_debug.h test_packet_parser.h
dist_test_SCRIPTS = run-test.sh
new file mode 100644
@@ -0,0 +1,175 @@
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * Test packets for parser tests
+ */
+
+#ifndef TEST_PACKET_PARSER_H_
+#define TEST_PACKET_PARSER_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Test packets without CRC */
+
+/**
+ * ARP request
+ */
+static const uint8_t test_packet_arp[] = {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x08, 0x06, 0x00, 0x01,
+ 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0xC0, 0xA8, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xA8,
+ 0x01, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
+ 0x0E, 0x0F, 0x10, 0x11
+};
+
+/**
+ * ICMPv4 echo reply
+ */
+static const uint8_t test_packet_ipv4_icmp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00,
+ 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01,
+ 0xF3, 0x7B, 0xC0, 0xA8, 0x01, 0x01, 0xC4, 0xA8,
+ 0x01, 0x02, 0x00, 0x00, 0xB7, 0xAB, 0x00, 0x01,
+ 0x00, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
+ 0x0E, 0x0F, 0x10, 0x11
+};
+
+/**
+ * IPv4 TCP
+ */
+static const uint8_t test_packet_ipv4_tcp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00,
+ 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x06,
+ 0xF3, 0x76, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8,
+ 0x01, 0x01, 0x04, 0xD2, 0x10, 0xE1, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x50, 0x00,
+ 0x00, 0x00, 0x0C, 0xCC, 0x00, 0x00, 0x00, 0x01,
+ 0x02, 0x03, 0x04, 0x05
+};
+
+/**
+ * IPv4 UDP
+ */
+static const uint8_t test_packet_ipv4_udp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00,
+ 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11,
+ 0xF3, 0x6B, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8,
+ 0x01, 0x01, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x1A,
+ 0x2F, 0x97, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
+ 0x0E, 0x0F, 0x10, 0x11
+};
+
+/**
+ * VLAN IPv4 UDP
+ * - ID: 23
+ */
+static const uint8_t test_packet_vlan_ipv4_udp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x17,
+ 0x08, 0x00, 0x45, 0x00, 0x00, 0x2A, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x11, 0xF3, 0x6F, 0xC0, 0xA8,
+ 0x01, 0x02, 0xC4, 0xA8, 0x01, 0x01, 0x00, 0x3F,
+ 0x00, 0x3F, 0x00, 0x16, 0x4D, 0xBF, 0x00, 0x01,
+ 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
+ 0x0A, 0x0B, 0x0C, 0x0D
+};
+
+/**
+ * VLAN Q-in-Q IPv4 UDP
+ * - Outer: Tag Protocol ID 0x88a8, VLAN ID 1
+ * - Inner: Tag Protocol ID 0x8100, VLAN ID 2
+ */
+static const uint8_t test_packet_vlan_qinq_ipv4_udp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x88, 0xA8, 0x00, 0x01,
+ 0x81, 0x00, 0x00, 0x02, 0x08, 0x00, 0x45, 0x00,
+ 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11,
+ 0xF3, 0x73, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8,
+ 0x01, 0x01, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x12,
+ 0x63, 0xDF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0x08, 0x09
+};
+
+/**
+ * ICMPv6 echo request
+ */
+static const uint8_t test_packet_ipv6_icmp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30,
+ 0x00, 0x00, 0x00, 0x08, 0x3A, 0xFF, 0xFE, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55,
+ 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77,
+ 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x80, 0x00,
+ 0x1B, 0xC2, 0x00, 0x01, 0x00, 0x02
+};
+
+/**
+ * IPv6 TCP
+ */
+static const uint8_t test_packet_ipv6_tcp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30,
+ 0x00, 0x00, 0x00, 0x14, 0x06, 0xFF, 0xFE, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55,
+ 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77,
+ 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x04, 0xD2,
+ 0x10, 0xE1, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x02, 0x50, 0x00, 0x00, 0x00, 0x36, 0x37,
+ 0x00, 0x00
+};
+
+/**
+ * IPv6 UDP
+ */
+static const uint8_t test_packet_ipv6_udp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30,
+ 0x00, 0x00, 0x00, 0x08, 0x11, 0xFF, 0xFE, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55,
+ 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77,
+ 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x00, 0x3F,
+ 0x00, 0x3F, 0x00, 0x08, 0x9B, 0x68
+};
+
+/**
+ * VLAN IPv6
+ * - ID: 23
+ */
+static const uint8_t test_packet_vlan_ipv6_udp[] = {
+ 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x17,
+ 0x86, 0xDD, 0x60, 0x30, 0x00, 0x00, 0x00, 0x08,
+ 0x11, 0xFF, 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x09, 0xFF, 0xFE, 0x00,
+ 0x04, 0x00, 0x35, 0x55, 0x55, 0x55, 0x66, 0x66,
+ 0x66, 0x66, 0x77, 0x77, 0x77, 0x77, 0x88, 0x88,
+ 0x88, 0x88, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x08,
+ 0x9B, 0x68
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
@@ -8,6 +8,7 @@
#include <odp_api.h>
#include <odp_cunit_common.h>
+#include <test_packet_parser.h>
#include <odp/helper/odph_api.h>
@@ -28,153 +28,4 @@ int parser_suite_init(void);
/* test arrays: */
extern odp_testinfo_t parser_suite[];
-/* Test packets without CRC */
-
-/**
- * ARP request
- */
-static const uint8_t test_packet_arp[] = {
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x08, 0x06, 0x00, 0x01,
- 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0xC0, 0xA8, 0x01, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xA8,
- 0x01, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
- 0x0E, 0x0F, 0x10, 0x11
-};
-
-/**
- * ICMPv4 echo reply
- */
-static const uint8_t test_packet_ipv4_icmp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01,
- 0xF3, 0x7B, 0xC0, 0xA8, 0x01, 0x01, 0xC4, 0xA8,
- 0x01, 0x02, 0x00, 0x00, 0xB7, 0xAB, 0x00, 0x01,
- 0x00, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
- 0x0E, 0x0F, 0x10, 0x11
-};
-
-/**
- * IPv4 TCP
- */
-static const uint8_t test_packet_ipv4_tcp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x06,
- 0xF3, 0x76, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8,
- 0x01, 0x01, 0x04, 0xD2, 0x10, 0xE1, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x50, 0x00,
- 0x00, 0x00, 0x0C, 0xCC, 0x00, 0x00, 0x00, 0x01,
- 0x02, 0x03, 0x04, 0x05
-};
-
-/**
- * IPv4 UDP
- */
-static const uint8_t test_packet_ipv4_udp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11,
- 0xF3, 0x6B, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8,
- 0x01, 0x01, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x1A,
- 0x2F, 0x97, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
- 0x0E, 0x0F, 0x10, 0x11
-};
-
-/**
- * VLAN IPv4 UDP
- * - ID: 23
- */
-static const uint8_t test_packet_vlan_ipv4_udp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x17,
- 0x08, 0x00, 0x45, 0x00, 0x00, 0x2A, 0x00, 0x00,
- 0x00, 0x00, 0x40, 0x11, 0xF3, 0x6F, 0xC0, 0xA8,
- 0x01, 0x02, 0xC4, 0xA8, 0x01, 0x01, 0x00, 0x3F,
- 0x00, 0x3F, 0x00, 0x16, 0x4D, 0xBF, 0x00, 0x01,
- 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
- 0x0A, 0x0B, 0x0C, 0x0D
-};
-
-/**
- * VLAN Q-in-Q IPv4 UDP
- * - Outer: Tag Protocol ID 0x88a8, VLAN ID 1
- * - Inner: Tag Protocol ID 0x8100, VLAN ID 2
- */
-static const uint8_t test_packet_vlan_qinq_ipv4_udp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x88, 0xA8, 0x00, 0x01,
- 0x81, 0x00, 0x00, 0x02, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11,
- 0xF3, 0x73, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8,
- 0x01, 0x01, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x12,
- 0x63, 0xDF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x09
-};
-
-/**
- * ICMPv6 echo request
- */
-static const uint8_t test_packet_ipv6_icmp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30,
- 0x00, 0x00, 0x00, 0x08, 0x3A, 0xFF, 0xFE, 0x80,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
- 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55,
- 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77,
- 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x80, 0x00,
- 0x1B, 0xC2, 0x00, 0x01, 0x00, 0x02
-};
-
-/**
- * IPv6 TCP
- */
-static const uint8_t test_packet_ipv6_tcp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30,
- 0x00, 0x00, 0x00, 0x14, 0x06, 0xFF, 0xFE, 0x80,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
- 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55,
- 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77,
- 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x04, 0xD2,
- 0x10, 0xE1, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x02, 0x50, 0x00, 0x00, 0x00, 0x36, 0x37,
- 0x00, 0x00
-};
-
-/**
- * IPv6 UDP
- */
-static const uint8_t test_packet_ipv6_udp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30,
- 0x00, 0x00, 0x00, 0x08, 0x11, 0xFF, 0xFE, 0x80,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
- 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55,
- 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77,
- 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x00, 0x3F,
- 0x00, 0x3F, 0x00, 0x08, 0x9B, 0x68
-};
-
-/**
- * VLAN IPv6
- * - ID: 23
- */
-static const uint8_t test_packet_vlan_ipv6_udp[] = {
- 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x17,
- 0x86, 0xDD, 0x60, 0x30, 0x00, 0x00, 0x00, 0x08,
- 0x11, 0xFF, 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x09, 0xFF, 0xFE, 0x00,
- 0x04, 0x00, 0x35, 0x55, 0x55, 0x55, 0x66, 0x66,
- 0x66, 0x66, 0x77, 0x77, 0x77, 0x77, 0x88, 0x88,
- 0x88, 0x88, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x08,
- 0x9B, 0x68
-};
-
#endif