Skip to content
Permalink
Browse files

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>
  • Loading branch information...
ulfalizer authored and galak committed Aug 2, 2019
1 parent b890943 commit fe2d858b5f4a552e2e4dc7ec9f1e9177e76075a8
@@ -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
@@ -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
@@ -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";
};
};
@@ -30,7 +30,7 @@ def verify_streq(actual, expected):
fail("not equal (expected value last):\n'{}'\n'{}'"
.format(actual, expected))

edt = edtlib.EDT("test.dts", "test-bindings")
edt = edtlib.EDT("test.dts", ["test-bindings"])

#
# Test interrupts
@@ -115,6 +115,18 @@ def verify_streq(actual, expected):
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']>}")

#
# 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")

0 comments on commit fe2d858

Please sign in to comment.
You can’t perform that action at this time.