PDL: add basic support for generating Rust code
This CL adds support for handling a simple PDL file which defines a packet. The CL includes infrastructure for testing the generated code against known-good output. This is sometimes called “snapshot testing”. While there are crates for this, we currently don’t use any to avoid pulling in new dependencies. Bug: 228306440 Test: atest pdl_inline_tests Change-Id: If33403444ba9e4ce9c45e15b65c1da03011aa5e9
Showing
- tools/pdl/Android.bp 9 additions, 1 deletiontools/pdl/Android.bp
- tools/pdl/rustfmt 1 addition, 0 deletionstools/pdl/rustfmt
- tools/pdl/rustfmt.toml 1 addition, 0 deletionstools/pdl/rustfmt.toml
- tools/pdl/src/generator.rs 640 additions, 0 deletionstools/pdl/src/generator.rs
- tools/pdl/src/main.rs 34 additions, 1 deletiontools/pdl/src/main.rs
- tools/pdl/test/generated/packet_decl_empty.rs 67 additions, 0 deletionstools/pdl/test/generated/packet_decl_empty.rs
- tools/pdl/test/generated/packet_decl_simple_big_endian.rs 102 additions, 0 deletionstools/pdl/test/generated/packet_decl_simple_big_endian.rs
- tools/pdl/test/generated/packet_decl_simple_little_endian.rs 102 additions, 0 deletionstools/pdl/test/generated/packet_decl_simple_little_endian.rs
- tools/pdl/test/generated/preamble.rs 34 additions, 0 deletionstools/pdl/test/generated/preamble.rs
tools/pdl/rustfmt
0 → 120000
tools/pdl/rustfmt.toml
0 → 120000
tools/pdl/src/generator.rs
0 → 100644
This diff is collapsed.
tools/pdl/test/generated/preamble.rs
0 → 100644
Please register or sign in to comment