We present P4Testgen, a test oracle for the P4-16 language that supports automatic test generation for any P4 target. Unlike prior tools, which were tailored to specific programs and targets, P4Testgen is designed to be general and extensible. It models the complete semantics of the entire packet-processing pipeline including the P4 language, architectures and externs, and target-specific extensions. Handling aspects of packet processing that lie outside of the official language specification is critical for supporting real-world targets. P4Testgen uses taint tracking and concolic execution to handle non-deterministic behaviors and complex externs (e.g., checksums and hash functions) and it provides path selection strategies that reduce the number of tests required to achieve full coverage. We have instantiated P4Testgen for the V1model, eBPF, and Tofino architectures. Each extension required effort commensurate with the complexity of the target. We validated the tests generated by P4Testgen by running them across the entire P4C test suite as well as the programs supplied with the Tofino P4 Studio. Using the tool, we have confirmed 28 bugs in the mature, production toolchains for BMv2 and Tofino.
翻译:P4Testorgen是支持为任何P4目标进行自动测试生成的P4-16语言的测试器; P4Testorgen与以前的工具不同,以前的工具是专门为特定的程序和目标定制的; P4Testorgen的设计是通用的和可扩展的; 它模拟了整个包处理管道的完整语义,包括P4语言、建筑和外部处理,以及特定目标扩展; 处理官方语言规格以外的包处理方面,对于支持真实世界目标至关重要; P4Tegogen使用污点跟踪和冷却执行来处理非决定性行为和复杂的外部外行(例如核对和散列功能),它提供了路径选择战略,减少了实现全面覆盖所需的测试数量; 我们为V1模型、 eBPF和 Tofino 结构进行了即时P4测试; 每个扩展都需要与目标复杂性相称的努力。 我们验证了P4Toptopgen产生的测试, 在整个P4C测试套中运行, 以及我们确认的Tafino P4DRMADR 和 IMADR 提供的程序。</s>