[p4testgen] Add STF backend for PNA#5570
Conversation
2b4b49d to
aeb383d
Compare
|
I think we should split this off into a But let me also revive #4228 and see how this PR influences it. |
aeb383d to
d213dbd
Compare
|
Thanks for the feedback @fruffy! I've updated the PR to split out the drop-by-default change (will file that separately once the semantics are settled). What remains here is just the STF backend for PNA — no behavioral changes to existing code. Happy to rename the backend or restructure if you'd prefer a Re #4228 — would love to see that land too. This PR shouldn't conflict with it since we're only adding a new backend under |
d213dbd to
72fccaf
Compare
That version is in BCR and has //p4include, testdata exports, and the macOS fix — everything the smolkaj/p4c fork originally carried. BCR consumers now get the right p4c transitively without any manual pin, and bcr_test_module no longer needs a p4c override to mimic the BCR resolution path. The git_override stays: fourward-as-root still wants the fork for the PNA p4testgen STF backend (p4lang/p4c#5570) and drop-by-default fix (p4lang/p4c#5569), neither of which is in BCR yet. git_override is only honored for root, so non-root consumers are unaffected.
Adds STF output support for the PNA target, matching the existing BMv2
STF backend. This enables:
p4testgen --target dpdk --arch pna --test-backend stf program.p4
The backend handles exact, ternary, LPM, and optional match types. One
.stf file per test case, same format as BMv2's STF output.
Also enables PNA in the Bazel build by adding it to TESTGEN_TARGETS.
Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com>
72fccaf to
c346923
Compare
Summary
Adds STF output support for the PNA p4testgen target, matching the
existing BMv2 STF backend. This enables:
The backend handles exact, ternary, LPM, and optional match types.
One
.stffile per test case, same format as BMv2's STF output.New files:
backends/p4tools/modules/testgen/targets/pna/backend/stf/stf.{h,cpp}The Bazel
hdrsglob inbackends/p4tools/BUILD.bazelis widenedfrom
backend/*.htobackend/**/*.hso the newbackend/stf/subdirectory is picked up. (Enabling PNA itself in the Bazel build
was originally part of this PR but landed separately via #5575.)
Motivation
The 4ward P4 simulator uses
p4testgen to generate STF tests for PNA programs. Without an STF
backend,
--test-backend stffails with "Unsupported device: dpdk".Testing
Validated in 4ward: 411 p4testgen-generated STF tests across 21 PNA
programs pass with this change.
@fruffy — would appreciate your review on the STF backend approach.
Happy to adjust anything.