From: Andrea Righi Date: Tue, 12 Dec 2023 16:03:52 +0000 (+0100) Subject: tests: add a new unit test to verify the arch override X-Git-Tag: v0.2~2 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=7339d062737a27815882c5e7b7fcfa8b1e9b8764;p=annotations.git tests: add a new unit test to verify the arch override Signed-off-by: Andrea Righi --- diff --git a/tests/data/annotations.override.1 b/tests/data/annotations.override.1 new file mode 100644 index 0000000..47f0964 --- /dev/null +++ b/tests/data/annotations.override.1 @@ -0,0 +1,9 @@ +# Menu: HEADER +# FORMAT: 4 +# ARCH: arm64 armhf +# FLAVOUR: arm64-raspi armhf-raspi +# FLAVOUR_DEP: {'arm64-raspi': 'arm64-generic', 'armhf-raspi': 'armhf-generic-lpae'} + +include "annotations.override.2" + +CONFIG_SND_TRIDENT policy<{'arm64': '-', 'armhf': '-'}> note<'Pi specific (not availble on Pi)'> diff --git a/tests/data/annotations.override.1.result b/tests/data/annotations.override.1.result new file mode 100644 index 0000000..b25e305 --- /dev/null +++ b/tests/data/annotations.override.1.result @@ -0,0 +1,28 @@ +{ + "arch": [ + "arm64", + "armhf" + ], + "flavour": [ + "arm64-raspi", + "armhf-raspi" + ], + "flavour_dep": { + "arm64-raspi": "arm64-generic", + "armhf-raspi": "armhf-generic-lpae" + }, + "include": [ + "annotations.override.2" + ], + "config": { + "CONFIG_SND_TRIDENT": { + "policy": { + "amd64": "m", + "i386": "m", + "arm64": "-", + "armhf": "-" + }, + "note": "'Pi specific (not availble on Pi)'" + } + } +} diff --git a/tests/data/annotations.override.2 b/tests/data/annotations.override.2 new file mode 100644 index 0000000..dfdf2cb --- /dev/null +++ b/tests/data/annotations.override.2 @@ -0,0 +1,6 @@ +# Menu: HEADER +# FORMAT: 4 +# ARCH: amd64 arm64 armhf i386 ppc64el s390x +# FLAVOUR: amd64-generic amd64-lowlatency arm64-generic armhf-generic armhf-generic-lpae i386-generic i386-lowlatency ppc64el-generic s390x-generic + +CONFIG_SND_TRIDENT policy<{'amd64': 'm', 'armhf-generic-lpae': 'm', 'i386': 'm'}> diff --git a/tests/test_override.py b/tests/test_override.py new file mode 100644 index 0000000..3ec180e --- /dev/null +++ b/tests/test_override.py @@ -0,0 +1,15 @@ +import unittest + +from tests import utils + +from kconfig.annotations import Annotation + + +class TestLoadAnnotations(unittest.TestCase): + def test_load(self): + for d in ("annotations.override.1",): + f = "tests/data/" + d + a = Annotation(f) + print(utils.to_dict(a)) + r = utils.load_json(f + ".result") + self.assertEqual(utils.to_dict(a), r)