Loading tools/pdl/Android.bp +7 −17 Original line number Diff line number Diff line Loading @@ -33,12 +33,6 @@ rust_binary_host { defaults: ["pdl_defaults"], } python_binary_host { name: "pypdl", main: "scripts/pdl/parser.py", srcs: ["scripts/pdl/parser.py"], } rust_test_host { name: "pdl_inline_tests", defaults: ["pdl_defaults"], Loading Loading @@ -84,17 +78,6 @@ rust_test_host { ], } // Python generator. python_binary_host { name: "pdl_python_generator", main: "scripts/generate_python_backend.py", srcs: [ "scripts/generate_python_backend.py", "scripts/pdl/ast.py", "scripts/pdl/core.py", ] } // Defaults for PDL python backend generation. genrule_defaults { name: "pdl_python_generator_defaults", Loading Loading @@ -146,6 +129,7 @@ genrule { // pre-generated binary inputs. python_test_host { name: "pdl_python_generator_test", defaults: ["modern_python_path_defaults"], main: "tests/python_generator_test.py", srcs: [ "tests/python_generator_test.py", Loading @@ -163,12 +147,18 @@ python_test_host { test_options: { unit_test: true, }, version: { py3: { embedded_launcher: true, }, }, } // Test the python parser against the rust parser // on selected PDL source files. python_test_host { name: "pdl_python_parser_test", defaults: ["modern_python_path_defaults"], main: "tests/python_parser_test.py", srcs: ["tests/python_parser_test.py"], data: [ Loading tools/pdl/scripts/Android.bp 0 → 100644 +27 −0 Original line number Diff line number Diff line package { // See: http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import // all of the 'license_kinds' from "system_bt_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 default_applicable_licenses: ["system_bt_license"], } python_binary_host { name: "pypdl", defaults: ["modern_python_path_defaults"], main: "pdl/parser.py", srcs: ["pdl/parser.py"], } // Python generator. python_binary_host { name: "pdl_python_generator", defaults: ["modern_python_path_defaults"], main: "generate_python_backend.py", srcs: [ "generate_python_backend.py", "pdl/ast.py", "pdl/core.py", ] } tools/pdl/tests/python_generator_test.py +5 −4 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import json import typing import typing_extensions import unittest from importlib import resources # (le|be)_pdl_test are the names of the modules generated from the canonical # little endian and big endian test grammars. The purpose of this module Loading Loading @@ -68,7 +69,7 @@ class PacketParserTest(unittest.TestCase): vectors in canonical/(le|be)_test_vectors.json""" def testLittleEndian(self): with open('tests/canonical/le_test_vectors.json') as f: with resources.files('tests.canonical').joinpath('le_test_vectors.json').open('r') as f: reference = json.load(f) for item in reference: Loading @@ -87,7 +88,7 @@ class PacketParserTest(unittest.TestCase): match_object(self, result, test['unpacked']) def testBigEndian(self): with open('tests/canonical/be_test_vectors.json') as f: with resources.files('tests.canonical').joinpath('be_test_vectors.json').open('r') as f: reference = json.load(f) for item in reference: Loading @@ -111,7 +112,7 @@ class PacketSerializerTest(unittest.TestCase): vectors in canonical/(le|be)_test_vectors.json""" def testLittleEndian(self): with open('tests/canonical/le_test_vectors.json') as f: with resources.files('tests.canonical').joinpath('le_test_vectors.json').open('r') as f: reference = json.load(f) for item in reference: Loading @@ -131,7 +132,7 @@ class PacketSerializerTest(unittest.TestCase): self.assertEqual(result, bytes.fromhex(test['packed'])) def testBigEndian(self): with open('tests/canonical/be_test_vectors.json') as f: with resources.files('tests.canonical').joinpath('be_test_vectors.json').open('r') as f: reference = json.load(f) for item in reference: Loading Loading
tools/pdl/Android.bp +7 −17 Original line number Diff line number Diff line Loading @@ -33,12 +33,6 @@ rust_binary_host { defaults: ["pdl_defaults"], } python_binary_host { name: "pypdl", main: "scripts/pdl/parser.py", srcs: ["scripts/pdl/parser.py"], } rust_test_host { name: "pdl_inline_tests", defaults: ["pdl_defaults"], Loading Loading @@ -84,17 +78,6 @@ rust_test_host { ], } // Python generator. python_binary_host { name: "pdl_python_generator", main: "scripts/generate_python_backend.py", srcs: [ "scripts/generate_python_backend.py", "scripts/pdl/ast.py", "scripts/pdl/core.py", ] } // Defaults for PDL python backend generation. genrule_defaults { name: "pdl_python_generator_defaults", Loading Loading @@ -146,6 +129,7 @@ genrule { // pre-generated binary inputs. python_test_host { name: "pdl_python_generator_test", defaults: ["modern_python_path_defaults"], main: "tests/python_generator_test.py", srcs: [ "tests/python_generator_test.py", Loading @@ -163,12 +147,18 @@ python_test_host { test_options: { unit_test: true, }, version: { py3: { embedded_launcher: true, }, }, } // Test the python parser against the rust parser // on selected PDL source files. python_test_host { name: "pdl_python_parser_test", defaults: ["modern_python_path_defaults"], main: "tests/python_parser_test.py", srcs: ["tests/python_parser_test.py"], data: [ Loading
tools/pdl/scripts/Android.bp 0 → 100644 +27 −0 Original line number Diff line number Diff line package { // See: http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import // all of the 'license_kinds' from "system_bt_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 default_applicable_licenses: ["system_bt_license"], } python_binary_host { name: "pypdl", defaults: ["modern_python_path_defaults"], main: "pdl/parser.py", srcs: ["pdl/parser.py"], } // Python generator. python_binary_host { name: "pdl_python_generator", defaults: ["modern_python_path_defaults"], main: "generate_python_backend.py", srcs: [ "generate_python_backend.py", "pdl/ast.py", "pdl/core.py", ] }
tools/pdl/tests/python_generator_test.py +5 −4 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import json import typing import typing_extensions import unittest from importlib import resources # (le|be)_pdl_test are the names of the modules generated from the canonical # little endian and big endian test grammars. The purpose of this module Loading Loading @@ -68,7 +69,7 @@ class PacketParserTest(unittest.TestCase): vectors in canonical/(le|be)_test_vectors.json""" def testLittleEndian(self): with open('tests/canonical/le_test_vectors.json') as f: with resources.files('tests.canonical').joinpath('le_test_vectors.json').open('r') as f: reference = json.load(f) for item in reference: Loading @@ -87,7 +88,7 @@ class PacketParserTest(unittest.TestCase): match_object(self, result, test['unpacked']) def testBigEndian(self): with open('tests/canonical/be_test_vectors.json') as f: with resources.files('tests.canonical').joinpath('be_test_vectors.json').open('r') as f: reference = json.load(f) for item in reference: Loading @@ -111,7 +112,7 @@ class PacketSerializerTest(unittest.TestCase): vectors in canonical/(le|be)_test_vectors.json""" def testLittleEndian(self): with open('tests/canonical/le_test_vectors.json') as f: with resources.files('tests.canonical').joinpath('le_test_vectors.json').open('r') as f: reference = json.load(f) for item in reference: Loading @@ -131,7 +132,7 @@ class PacketSerializerTest(unittest.TestCase): self.assertEqual(result, bytes.fromhex(test['packed'])) def testBigEndian(self): with open('tests/canonical/be_test_vectors.json') as f: with resources.files('tests.canonical').joinpath('be_test_vectors.json').open('r') as f: reference = json.load(f) for item in reference: Loading