tcp: options support into pg
[vpp.git] / src / plugins / nat / CMakeLists.txt
index 623c92a..c53e0e3 100644 (file)
@@ -62,12 +62,10 @@ add_vpp_plugin(nat44_ei
   nat44-ei/nat44_ei_in2out.c
   nat44-ei/nat44_ei_out2in.c
   nat44-ei/nat44_ei_handoff.c
-  nat44-ei/nat44_ei_hairpinning.c
 
   MULTIARCH_SOURCES
   nat44-ei/nat44_ei_in2out.c
   nat44-ei/nat44_ei_out2in.c
-  nat44-ei/nat44_ei_hairpinning.c
 
   API_FILES
   nat44-ei/nat44_ei.api
@@ -172,17 +170,34 @@ add_vpp_plugin(pnat
 )
 
 # Unit tests
+set (PACKET_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/pnat/tests/test_packets.h)
+set (PACKET_DEFS
+  ${CMAKE_CURRENT_SOURCE_DIR}/pnat/tests/packets.def
+  ${CMAKE_CURRENT_SOURCE_DIR}/pnat/tests/missing_rule.def)
+set (PACKET_TESTGET ${CMAKE_CURRENT_SOURCE_DIR}/pnat/tests/test_genpackets.py)
+
 add_vpp_executable(test_pnat
   SOURCES
-  pnat/pnat_test.c
+  pnat/tests/pnat_test.c
   pnat/pnat_node.c
   pnat/pnat.c
   ../../vnet/ip/ip_checksum.c
+
   LINK_LIBRARIES vppinfra vlib
   NO_INSTALL
 )
 
-if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.13" AND "${CMAKE_C_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
+add_custom_target(test_pnat-generate
+  COMMAND ${PACKET_TESTGET} ${PACKET_DEFS} > ${PACKET_HEADER}
+  COMMENT "Generating packet test definitions ${PACKET_DEFS}"
+)
+
+add_custom_target(test_pnat-run
+  COMMAND test_pnat
+  DEPENDS test_pnat
+)
+
+if(VPP_BUILD_TESTS_WITH_COVERAGE)
   set(TARGET_NAME test_pnat)
   set(COV_SOURCES ${CMAKE_SOURCE_DIR}/plugins/nat/pnat/pnat.c ${CMAKE_SOURCE_DIR}/plugins/nat/pnat/pnat_node.h ${CMAKE_SOURCE_DIR}/plugins/nat/pnat/pnat_node.c)