Re: [PATCH 3/3] tests: Add test for /./

David Gibson <[email protected]>
Newsgroups org.kernel.vger.devicetree-compiler
Message-ID <Z8fQVMAVtpaKRe1Y@zatzit>
On Sat, Mar 01, 2025 at 06:55:04PM +0530, Ayush Singh wrote:
> - Test /./ on a string and int array.
> - Also test on subnode property.

These tests are ok as far as they go.  Testing  a property with mixed
data types would be a good idea for completeness.

> 
> Signed-off-by: Ayush Singh <[email protected]>
> ---
>  tests/prev_prop.dts | 21 +++++++++++++++++++++
>  tests/run_tests.sh  |  7 +++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/tests/prev_prop.dts b/tests/prev_prop.dts
> new file mode 100644
> index 0000000000000000000000000000000000000000..41a0e19015b006d78a3ec35a26db63982ec4c90a
> --- /dev/null
> +++ b/tests/prev_prop.dts
> @@ -0,0 +1,21 @@
> +/dts-v1/;
> +
> +/ {
> +        str-prop = "1", "2";
> +        int-prop = <1 2>;
> +
> +        subnode {
> +                str-prop = "1", "2";
> +                int-prop = <1 2>;
> +        };
> +};
> +
> +/ {
> +        str-prop = /./, "3", "4", /./, "6";
> +        int-prop = /./, <3 4>, /./, <6>;
> +
> +        subnode {
> +                str-prop = /./, "3", "4", /./;
> +                int-prop = /./, <3 4>, /./;
> +        };
> +};
> diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> index f0b51c04bf0af69f1df483b185f3aefa5d0bae27..30aa99f55570ac10b85c94353711361c19a5b479 100755
> --- a/tests/run_tests.sh
> +++ b/tests/run_tests.sh
> @@ -708,6 +708,13 @@ dtc_tests () {
>      run_dtc_test -I dts -O dtb -o dtc_tree1_delete.test.dtb "$SRCDIR/test_tree1_delete.dts"
>      tree1_tests dtc_tree1_delete.test.dtb
>  
> +    # Check previous property functionality
> +    run_dtc_test -I dts -O dtb -o prev_prop.test.dtb "$SRCDIR/prev_prop.dts"
> +    run_fdtget_test "1 2 3 4 1 2 6" prev_prop.test.dtb "/" "str-prop"
> +    run_fdtget_test "1 2 3 4 1 2 6" prev_prop.test.dtb "/" "int-prop"
> +    run_fdtget_test "1 2 3 4 1 2" prev_prop.test.dtb "/subnode" "str-prop"
> +    run_fdtget_test "1 2 3 4 1 2" prev_prop.test.dtb "/subnode"
> "int-prop"

Rather than have a batch of separate fdtget tests, I think it would be
cleaner to create a different .dts with the expected output from the
expansions, then compare them with dtbs_equal_ordered.

> +
>      # Check omit-if-no-ref functionality
>      run_dtc_test -I dts -O dtb -o omit-no-ref.test.dtb "$SRCDIR/omit-no-ref.dts"
>      run_test check_path omit-no-ref.test.dtb not-exists "/node1"
> 

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmfH0FMACgkQzQJF27ox
2Gc2hhAAqrWZIFfySeEZioXV2+DV6tWe7AOMFU4LzeLWCbhamOnWNGHMGdzjHrJW
dGdFtCWM8skeNF4oDgrM1QhP3tS5fTFIpGSCB9UKjTAeHGlRK0vwkz+VCrlFnwKS
r8gMmOTITtdPSEKeSnOaFZ2V7j4x2QMsIVOZgwN/qtZnWSXa+XsrurYkxNUiarS9
BH1UtJEODc5iEMyTSdBBiYDLYapwrOynnkQdfWCtIHZpUeulGVXVQ4HtfSz+LHc8
8I+86drq2eB/oi6yN3tXx2O8Z2pKqi8lUNw7YePnEFKKDTDRKTUH/sZul5db1YrX
OmkZgWNUJr0IUktAGsCau5AC3S3paZR9PsjY8xIsx/Zfnsy6hpJGr47x2lgaVNw3
PGd2HviurT7Y4sINBNAruC88f+fw6vmbelNu3r73QNftSB4QrGwho/1Qz7GgA59o
wGujx8Lr/q+UaNrFVtfgMHIOUnd2GOfqWlSLFeCQpSIjTr0j6ZNKb4AmsgIjrnPL
LH60a/oQkYvHnI8iu+dwHDoBiboGYoLGk6u36j2LBCqGeiIfPRhHzBh6UCn5GFgs
kfn8UYj23zsFrLeNBy0qNUPJEUtbFh0jTY4PxPJJsuF+xPPiet6ba2zjvxQhIwQ3
weDy+V2wlja7eJoXLOcrAzRY4AOLERa75ynLI/+ohgqZHwkfTPk=
=rogd
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.