Skip to content

Commit

Permalink
[#4614] Unconditionally copy dpdk p4include files to the binary dir…
Browse files Browse the repository at this point in the history
…ectory (#4615)

* Omit psa and pna dpdk tests under check-p4 testing target

* Revert "Omit psa and pna dpdk tests under check-p4 testing target"

This reverts commit 54ee318.

* Copy dpdk p4include files even when dpdk backend is not enabled.

* Disambiguate all psa.p4 includes

* Update test outputs

* Disambiguate all pna.p4 includes

* Update test outputs

* Use angled brackets instead of double quotes for psa and pna includes

* Update test outputs

* Add TODO comment referencing issue #4614

* Only #include <dpdk/pna.p4> for tests which actually require dpdk-specific externs

* Update test outputs

* fix #include typo
  • Loading branch information
kfcripps authored Apr 18, 2024
1 parent 6643d68 commit 81af965
Show file tree
Hide file tree
Showing 387 changed files with 391 additions and 393 deletions.
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -539,18 +539,13 @@ add_custom_target(update_includes ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/*.p4 ${P4C_BINARY_DIR}/p4include
COMMAND ${CMAKE_COMMAND} -E make_directory ${P4C_BINARY_DIR}/p4include/bmv2
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/bmv2/psa.p4 ${P4C_BINARY_DIR}/p4include/bmv2
COMMAND ${CMAKE_COMMAND} -E make_directory ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/dpdk/psa.p4 ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/dpdk/pna.p4 ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND for h in ${OTHER_HEADERS} \; do
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/\$$h ${P4C_BINARY_DIR}/p4include \;
done
)
if (ENABLE_DPDK)
add_custom_target(dpdk_includes ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/dpdk/psa.p4 ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/dpdk/pna.p4 ${P4C_BINARY_DIR}/p4include/dpdk
DEPENDS update_includes
)
endif()

# Installation
# Targets install themselves. Here we install the core headers
Expand Down
3 changes: 3 additions & 0 deletions backends/dpdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ set(DPDK_PTF_DRIVER "${CMAKE_CURRENT_SOURCE_DIR}/run-dpdk-ptf-test.py")
set(DPDK_COMPILER_DRIVER "${CMAKE_CURRENT_SOURCE_DIR}/run-dpdk-test.py")

set (P4_16_SUITES
# TODO (issue #4614): Consider moving dpdk pna and psa tests to their own
# subdirectories (e.g. p4_16_psa_samples/), similar to what is done for the
# dpdk/psa/pna errors tests.
"${P4C_SOURCE_DIR}/testdata/p4_16_samples/psa-*.p4"
"${P4C_SOURCE_DIR}/testdata/p4_16_samples/pna-*.p4"
"${P4C_SOURCE_DIR}/testdata/p4_16_psa_errors/*.p4"
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-add-on-miss-err1.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-dpdk-large-constants.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
typedef bit<32> IPv4Address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <dpdk/pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-example-ipsec-err1.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>


#define inbound(meta) (istd.direction == PNA_Direction_t.NET_TO_HOST)
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-example-ipsec-err2.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>


#define inbound(meta) (istd.direction == PNA_Direction_t.NET_TO_HOST)
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-example-ipsec-err3.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>


#define inbound(meta) (istd.direction == PNA_Direction_t.NET_TO_HOST)
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-example-ipsec-err4.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>


#define inbound(meta) (istd.direction == PNA_Direction_t.NET_TO_HOST)
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/psa-dpdk-lpm-match-err1.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/psa-dpdk-lpm-match-err2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/psa-dpdk-struct-field.p4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- P4_16 -*- */
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>

/************ H E A D E R S ******************************/
struct EMPTY {};
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_errors/psa-meter2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <bmv2/psa.p4>

struct EMPTY { };

Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-add-on-miss-err.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-counter-err-1.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-counter-err-3.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 14;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-counter-err-4.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-meter-err-2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 14;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-meter-err-4.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-example-addhit.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-example-miss.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


// Very simple PNA program intended to demonstrate one use of an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


// Very simple PNA program intended to demonstrate one use of an
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_psa_errors/psa-counter6.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>

struct EMPTY { };

Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/fwd-bmv2-psa.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <bmv2/psa.p4>

typedef bit<48> EthernetAddress;
header ethernet_t {
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/internet_checksum1-bmv2.p4
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


#include <core.p4>
#include "psa.p4"
#include <bmv2/psa.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/issue3550.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <bmv2/psa.p4>


typedef bit<48> EthernetAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- P4_16 -*- */
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>

/************ H E A D E R S ******************************/
struct EMPTY {};
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-action-selector-1.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-action-selector.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-add-on-miss.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-add_on_miss_action_name.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-direction-main-parser-err.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-direction.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-bvec_union.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

struct alt_t {
bit<1> valid;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-direct-counter-learner.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-header-union-stack.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-header-union-stack1.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-header-union-stack2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-invalid-hdr-warnings5.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-invalid-hdr-warnings6.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-small_sample.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

// small_sample

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
Loading

0 comments on commit 81af965

Please sign in to comment.