From 9f818d9bfa280b3a8cc7636a34f496adcf72bee4 Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Tue, 5 Dec 2023 14:53:15 +0100 Subject: [PATCH] tests: add an include test case Signed-off-by: Andrea Righi --- tests/data/annotations.derivative.1 | 9 +++++++ tests/data/annotations.derivative.1.result | 31 ++++++++++++++++++++++ tests/test_derivative.py | 14 ++++++++++ 3 files changed, 54 insertions(+) create mode 100644 tests/data/annotations.derivative.1 create mode 100644 tests/data/annotations.derivative.1.result create mode 100644 tests/test_derivative.py diff --git a/tests/data/annotations.derivative.1 b/tests/data/annotations.derivative.1 new file mode 100644 index 0000000..e72ac4c --- /dev/null +++ b/tests/data/annotations.derivative.1 @@ -0,0 +1,9 @@ +# Menu: HEADER +# FORMAT: 4 +# ARCH: amd64 armhf +# FLAVOUR: amd64-baz +# FLAVOUR_DEP: {"amd64-baz": "amd64-foo"} + +include "annotations.load.1" + +CONFIG_B_2 policy<{'amd64': '5'}> note diff --git a/tests/data/annotations.derivative.1.result b/tests/data/annotations.derivative.1.result new file mode 100644 index 0000000..d2bfdea --- /dev/null +++ b/tests/data/annotations.derivative.1.result @@ -0,0 +1,31 @@ +{ + "arch": [ + "amd64", + "armhf" + ], + "flavour": [ + "amd64-baz" + ], + "flavour_dep": { + "amd64-baz": "amd64-foo" + }, + "include": [ + "annotations.load.1" + ], + "config": { + "CONFIG_A_1": { + "policy": { + "amd64": "1", + "armhf": "1" + }, + "note": "'Config A_1'" + }, + "CONFIG_B_2": { + "policy": { + "amd64": "5", + "armhf": "2" + }, + "note": "'override Config B_2'" + } + } +} diff --git a/tests/test_derivative.py b/tests/test_derivative.py new file mode 100644 index 0000000..47ca5c0 --- /dev/null +++ b/tests/test_derivative.py @@ -0,0 +1,14 @@ +import unittest + +from tests import utils + +from kconfig.annotations import Annotation + + +class TestLoadAnnotations(unittest.TestCase): + def test_load(self): + for d in ("annotations.derivative.1",): + f = "tests/data/" + d + a = Annotation(f) + r = utils.load_json(f + ".result") + self.assertEqual(utils.to_dict(a), r) -- 2.31.1