scripts: dts: Add test for multiple binding directories

Add two bindings

    test-bindings/multidir.yaml
    test-bindings-2/multidir.yaml

and a new test-multidir.dts with two nodes that use them.

Verify that the two bindings were found by checking the
Device.binding_path attribute for the two device nodes.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
Ulf Magnusson 2019-08-02 23:45:51 +02:00 committed by Kumar Gala
commit fe2d858b5f
4 changed files with 50 additions and 1 deletions

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
title: Binding in test-bindings-2/
description: Binding in test-bindings-2/
properties:
compatible:
constraint: "in-dir-2"
type: string-array

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
title: Binding in test-bindings/
description: Binding in test-bindings/
properties:
compatible:
constraint: "in-dir-1"
type: string-array

View file

@ -0,0 +1,19 @@
/*
* Copyright (c) 2019, Nordic Semiconductor
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// Used by testedtlib.py. Dedicated file for testing having multiple binding
// directories.
/dts-v1/;
/ {
in-dir-1 {
compatible = "in-dir-1";
};
in-dir-2 {
compatible = "in-dir-2";
};
};

View file

@ -30,7 +30,7 @@ def run():
fail("not equal (expected value last):\n'{}'\n'{}'" fail("not equal (expected value last):\n'{}'\n'{}'"
.format(actual, expected)) .format(actual, expected))
edt = edtlib.EDT("test.dts", "test-bindings") edt = edtlib.EDT("test.dts", ["test-bindings"])
# #
# Test interrupts # Test interrupts
@ -115,6 +115,18 @@ def run():
verify_streq(edt.get_dev("/props").props, verify_streq(edt.get_dev("/props").props,
r"{'compatible': <Property, name: compatible, value: ['props']>, 'int': <Property, name: int, value: 1>, 'array': <Property, name: array, value: [1, 2, 3]>, 'uint8-array': <Property, name: uint8-array, value: b'\x124'>, 'string': <Property, name: string, value: 'foo'>, 'string-array': <Property, name: string-array, value: ['foo', 'bar', 'baz']>}") r"{'compatible': <Property, name: compatible, value: ['props']>, 'int': <Property, name: int, value: 1>, 'array': <Property, name: array, value: [1, 2, 3]>, 'uint8-array': <Property, name: uint8-array, value: b'\x124'>, 'string': <Property, name: string, value: 'foo'>, 'string-array': <Property, name: string-array, value: ['foo', 'bar', 'baz']>}")
#
# Test having multiple directories with bindings, with a different .dts file
#
edt = edtlib.EDT("test-multidir.dts", ["test-bindings", "test-bindings-2"])
verify_streq(edt.get_dev("/in-dir-1").binding_path,
"test-bindings/multidir.yaml")
verify_streq(edt.get_dev("/in-dir-2").binding_path,
"test-bindings-2/multidir.yaml")
print("all tests passed") print("all tests passed")