aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest
diff options
context:
space:
mode:
Diffstat (limited to 'test/gtest')
-rw-r--r--test/gtest/Makefile115
-rw-r--r--test/gtest/test_common.cpp10
-rw-r--r--test/gtest/test_common.h6
-rw-r--r--test/gtest/test_tle_dring.h4
-rw-r--r--test/gtest/test_tle_udp_stream_gen.h7
5 files changed, 40 insertions, 102 deletions
diff --git a/test/gtest/Makefile b/test/gtest/Makefile
index 3858306..0d6372e 100644
--- a/test/gtest/Makefile
+++ b/test/gtest/Makefile
@@ -11,10 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-ifeq ($(RTE_SDK),)
-$(error "Please define RTE_SDK environment variable")
-endif
-
ifeq ($(GTEST_DIR),)
all:
@echo "GTEST_DIR is not setup properly. Skipping gtest"
@@ -24,111 +20,46 @@ all:
else
-# Default target, can be overridden by command line or environment
-RTE_TARGET ?= x86_64-native-linuxapp-gcc
-
-include $(RTE_SDK)/mk/rte.vars.mk
-
-CUR_SUBDIR ?= .
-
-# we must create the output dir first and recall the same Makefile
-# from this directory
-ifeq ($(NOT_FIRST_CALL),)
-
-NOT_FIRST_CALL = 1
-export NOT_FIRST_CALL
-
-
-BDIR := $(RTE_OUTPUT)/build/$(CUR_SUBDIR)
-
-all:
- $(Q)mkdir -p $(BDIR)
- $(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) \
- S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=obj
- $(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) \
- S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=app
-
-%::
- $(Q)mkdir -p $(BDIR)
- $(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) $@ \
- S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=obj
- $(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) $@ \
- S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=app
-else
-
-#
-# building object
-#
-
-ifeq ($(X),obj)
-include $(TLDK_ROOT)/mk/tle.cpp-vars.mk
-
# binary name
-OBJ = gtest-rfc.o
+APP_NAME = gtest-rfc
+
+include $(TLDK_ROOT)/mk/tle.var.mk
# all source are stored in SRCS-y
-SRCS-y += main.cpp
-SRCS-y += test_common.cpp
-SRCS-y += test_tle_dring.cpp
-SRCS-y += test_tle_ctx.cpp
-#SRCS-y += test_tle_udp_dev.cpp
-SRCS-y += test_tle_udp_destroy.cpp
-SRCS-y += test_tle_udp_event.cpp
-#SRCS-y += test_tle_udp_stream.cpp
-SRCS-y += test_tle_udp_stream_gen.cpp
-SRCS-y += test_tle_tcp_stream.cpp
-#SRCS-y += test_tle_tcp_stream_gen.cpp
+SRCCPP-y += main.cpp
+SRCCPP-y += test_common.cpp
+SRCCPP-y += test_tle_dring.cpp
+SRCCPP-y += test_tle_ctx.cpp
+SRCCPP-y += test_tle_udp_destroy.cpp
+SRCCPP-y += test_tle_udp_event.cpp
+SRCCPP-y += test_tle_udp_stream_gen.cpp
+SRCCPP-y += test_tle_tcp_stream.cpp
SYMLINK-y-app += test_scapy_gen.py
CXXFLAGS += -std=c++11
-ifeq ($(shell test $(GCC_VERSION) -lt 50 && echo 1), 1)
-CXXFLAGS += -D __STDC_FORMAT_MACROS
-endif
-
CXXFLAGS += -I$(GTEST_DIR)/include
CXXFLAGS += -I$(GMOCK_DIR)/include
-CXXFLAGS += -I$(RTE_OUTPUT)/include
-CXXFLAGS += $(EXTRA_CFLAGS)
+CXXFLAGS += $(CFLAGS) -Wno-error
-LDFLAGS += -lstdc++
+LDFLAGS += -lstdc++ -lpthread
LDFLAGS += -L$(GMOCK_DIR) -L$(GMOCK_DIR)/../lib -lgmock
-LDLIBS += -whole-archive -ltle_l4p -ltle_dring
-
-include $(TLDK_ROOT)/mk/tle.cpp-obj.mk
-endif
-
-#
-# building app
-#
-
-ifeq ($(X),app)
+LDFLAGS += -L$(GMOCK_DIR)/gtest -L$(GMOCK_DIR)/../lib -lgtest
-# binary name
-APP = gtest-rfc
-
-# all source are stored in SRCS-y
+LIB_DEPS += tle_l4p
+LIB_DEPS += tle_memtank
+LIB_DEPS += tle_timer
+LIB_DEPS += tle_dring
-CFLAGS += -O3
-
-ifeq ($(shell test $(GCC_VERSION) -lt 50 && echo 1), 1)
-CFLAGS += -D __STDC_FORMAT_MACROS
-endif
+CPP_OBJS := $(patsubst %.cpp,$(BDIR)/%.o,$(SRCCPP-y))
+OBJS += $(CPP_OBJS)
-CFLAGS += $(WERROR_FLAGS)
-
-LDLIBS += gtest-rfc.o
-
-LDLIBS += -lstdc++
-LDLIBS += -L$(GMOCK_DIR) -L$(GMOCK_DIR)/../lib -lgmock
-LDLIBS += -L$(GMOCK_DIR)/gtest -L$(GMOCK_DIR)/../lib -lgtest
-LDLIBS += -L$(RTE_OUTPUT)/lib
-LDLIBS += -whole-archive -ltle_l4p -ltle_dring -ltle_memtank -ltle_timer
+$(BDIR)/%.o: %.cpp Makefile
+ @mkdir -p $(BDIR)
+ $(Q)$(CXX) $(CXXFLAGS) $(CXXFLAGS_$(<)) -c $< -o $@
include $(TLDK_ROOT)/mk/tle.app.mk
-endif
endif
-endif
diff --git a/test/gtest/test_common.cpp b/test/gtest/test_common.cpp
index a91c8ba..74e535f 100644
--- a/test/gtest/test_common.cpp
+++ b/test/gtest/test_common.cpp
@@ -27,7 +27,7 @@ port_init(dpdk_port_t port, struct rte_mempool *mbuf_pool)
socket_id = rte_eth_dev_socket_id(port);
memset(&port_conf, 0, sizeof(struct rte_eth_conf));
- port_conf.rxmode.max_rx_pkt_len = RTE_ETHER_MAX_LEN;
+ port_conf.rxmode.mtu = RTE_ETHER_MAX_LEN;
/* Configure the Ethernet device. */
retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
@@ -255,18 +255,22 @@ typen_rx_callback(dpdk_port_t port, __rte_unused uint16_t queue,
}
int
-dummy_lookup4(void *opaque, const struct in_addr *addr, struct tle_dest *res)
+dummy_lookup4(void *opaque, uint64_t sdata, const struct in_addr *addr,
+ struct tle_dest *res)
{
RTE_SET_USED(opaque);
+ RTE_SET_USED(sdata);
RTE_SET_USED(addr);
RTE_SET_USED(res);
return -ENOENT;
}
int
-dummy_lookup6(void *opaque, const struct in6_addr *addr, struct tle_dest *res)
+dummy_lookup6(void *opaque, uint64_t sdata, const struct in6_addr *addr,
+ struct tle_dest *res)
{
RTE_SET_USED(opaque);
+ RTE_SET_USED(sdata);
RTE_SET_USED(addr);
RTE_SET_USED(res);
return -ENOENT;
diff --git a/test/gtest/test_common.h b/test/gtest/test_common.h
index 5b01114..d747857 100644
--- a/test/gtest/test_common.h
+++ b/test/gtest/test_common.h
@@ -98,9 +98,11 @@ typen_rx_callback(dpdk_port_t port, __rte_unused uint16_t queue,
__rte_unused uint16_t max_pkts, void *user_param);
int
-dummy_lookup4(void *opaque, const struct in_addr *addr, struct tle_dest *res);
+dummy_lookup4(void *opaque, uint64_t sdata, const struct in_addr *addr,
+ struct tle_dest *res);
int
-dummy_lookup6(void *opaque, const struct in6_addr *addr, struct tle_dest *res);
+dummy_lookup6(void *opaque, uint64_t sdata, const struct in6_addr *addr,
+ struct tle_dest *res);
#endif /* TEST_COMMON_H_ */
diff --git a/test/gtest/test_tle_dring.h b/test/gtest/test_tle_dring.h
index fdb2c47..1988e9f 100644
--- a/test/gtest/test_tle_dring.h
+++ b/test/gtest/test_tle_dring.h
@@ -384,7 +384,7 @@ test_dring_mt(int32_t master_enq_type, int32_t master_deq_type,
memset(arg, 0, sizeof(arg));
/* launch on all slaves */
- RTE_LCORE_FOREACH_SLAVE(lc) {
+ RTE_LCORE_FOREACH_WORKER(lc) {
arg[lc].dr = &dr;
arg[lc].r = r;
arg[lc].iter = ITER_NUM;
@@ -405,7 +405,7 @@ test_dring_mt(int32_t master_enq_type, int32_t master_deq_type,
deq = arg[lc].deq;
/* wait for slaves. */
- RTE_LCORE_FOREACH_SLAVE(lc) {
+ RTE_LCORE_FOREACH_WORKER(lc) {
rc |= rte_eal_wait_lcore(lc);
enq += arg[lc].enq;
deq += arg[lc].deq;
diff --git a/test/gtest/test_tle_udp_stream_gen.h b/test/gtest/test_tle_udp_stream_gen.h
index 8476375..855980c 100644
--- a/test/gtest/test_tle_udp_stream_gen.h
+++ b/test/gtest/test_tle_udp_stream_gen.h
@@ -62,7 +62,8 @@ extern struct rte_mempool *mbuf_pool;
/* Dummy lookup functions, TX operations are not performed in these tests */
static int
-lookup4_function(void *opaque, const struct in_addr *addr, struct tle_dest *res)
+lookup4_function(void *opaque, __rte_unused uint64_t sdata,
+ const struct in_addr *addr, struct tle_dest *res)
{
struct in_addr route;
struct rte_ether_hdr *eth;
@@ -98,8 +99,8 @@ lookup4_function(void *opaque, const struct in_addr *addr, struct tle_dest *res)
}
static int
-lookup6_function(void *opaque, const struct in6_addr *addr,
- struct tle_dest *res)
+lookup6_function(void *opaque, __rte_unused uint64_t sdata,
+ const struct in6_addr *addr, struct tle_dest *res)
{
struct rte_ether_hdr *eth;
struct rte_ipv6_hdr *ip6h;