aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2025-08-20livetree: Add only new data to fixup nodes instead of complete regenerationUwe Kleine-König2-0/+34
Removing the complete __fixups__ and __local_fixups__ tree might delete data that should better be retained. See the added test for a situation that was broken before. Note that without removing /__fixups__ and /__local_fixups__ in generate_fixups_tree() and generate_local_fixups_tree() respectively calling build_and_name_child_node() isn't safe as the nodes might already exist and then a duplicate would be added. So build_root_node() has to be used which copes correctly here. Fixes: 915daadbb62d ("Start with empty __local_fixups__ and __fixups__ nodes") Closes: https://github.com/dgibson/dtc/issues/170 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Message-ID: <b061ee57157fafbb9d5b9b0b86af760d13a04eda.1755512759.git.u.kleine-koenig@baylibre.com> [dwg: Use -1 instead of 1 as an error return] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-08-19checks: Remove check for graph child addressesNiklas Söderlund1-2/+0
The dtc graph_child_address check can't distinguish between bindings where there can only be a single endpoint, and cases where there can be multiple endpoints. In cases where the bindings allow for multiple endpoints but only one is described false warnings about unnecessary #address-cells/#size-cells can be generated, but only if the endpoint described have an address of 0 (A), for single endpoints with a non-zero address (B) no warnings are generated. A) ports { #address-cells = <1>; #size-cells = <0>; port@0 { #address-cells = <1>; #size-cells = <0>; sourceA: endpoint@0 { reg = <0> }; }; }; B) ports { #address-cells = <1>; #size-cells = <0>; port@0 { #address-cells = <1>; #size-cells = <0>; sourceB: endpoint@1 { reg = <1> }; }; }; Remove the check as it is somewhat redundant now that we can use schemas to validate the full node. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Message-ID: <20250817133733.3483922-1-niklas.soderlund+renesas@ragnatech.se> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-07-28tests: Add compatibility with uutilsDavid Gibson1-6/+7
In some places run_tsets.sh needs to get the size of files, which it does with stat(1). However the syntax to do this is different between GNU coreutils stat(1) and BSD's stat(1). We have some logic that looks for "GNU" in the version string to figure out the correct version. This will break upcoming Ubuntu versions which are now using uutils, a Rust reimplementation of coreutils. These support the same GNU syntax, but don't have the "GNU" in the version string. Update the detection to simply try the GNU version and otherwise assume BSD. Link: https://github.com/dgibson/dtc/issues/166 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-07-25tests: Work around limitation in FreeBSD's printf(1)David Gibson1-1/+1
Some of our testcases check fdtget retreiving string list properties that include internal \0 characters. We use printf(1) to generate the expected value for comparison. However, on FreeBSD, printf(1)'s %b format option can't handle \0: it will terminate that argument ignoring it and everything after. Curiously, internal \0 *is* ok in the main format string. So avoid using %b and use the format string directly instead. Link: https:/https://github.com/dgibson/dtc/issues/165 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-14Use __ASSEMBLER__ instead of __ASSEMBLY__Thomas Huth2-4/+4
Both, Clang and GCC define __ASSEMBLER__ automatically when compiling .S files, so this macro is a much better fit for fdt.h - programs that want to use it from .S files don't have to manually #define __ASSEMBLY__ that way. While we're at it, also change it in testdata.h, then we don't have to define __ASSEMBLY__ in the Makefile / meson.build file anymore. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-ID: <20250313192718.1561683-1-thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-14Fix some typosThomas Huth5-7/+7
Discovered with the "codespell" utility. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-ID: <20250313191607.1556384-1-thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-13meson: support building libfdt without static libraryBrandon Maier1-6/+4
Some packaging systems like NixOS don't support compiling static libraries. However libfdt's meson.build uses `both_library()` which forces the build to always compile shared and static libraries. Removing `both_library()` will make packaging easier. libfdt uses `both_libraries()` to support the 'static-build' option. But we do not need the 'static-build' option as Meson can natively build static using > meson setup builddir/ -Dc_link_args='-static' --prefer-static --default-library=static So drop 'static-build' and then replace `both_libraries()` with `library()`. Signed-off-by: Brandon Maier <brandon.maier@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-03-03meson: don't build test programs by defaultEli Schwartz1-1/+3
They are only used when running tests, and are included as depedencies of the test cases themselves already. Marking them to not build by default, means that 291 compile edges can be skipped when only running ``` meson setup builddir/ ninja -C builddir/ meson install -C builddir/ ``` resulting in an overall much faster build. Instead they will be compiled on-demand by `meson test`, only for users that actually run the tests. Signed-off-by: Eli Schwartz <eschwartz@gentoo.org> Message-ID: <20250302222839.2256985-1-eschwartz@gentoo.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-02-05tests: When building .so from -O asm output mark as non-executable stackDavid Gibson1-1/+1
For certain tests, we take the output from dtc -O asm and build it into a .so shared library which we then dlopen() for further tests. Because we don't mark it otherwise, it's treated as requiring an executable stack, which dlopen() refuses to open as of glibc-2.41. Of course, the library is pure data, no code, so it certainly doesn't need an executable stack. Add the -znoexecstack linker option to avoid the error. Fixes: https://github.com/dgibson/dtc/issues/163 Reported-by: Xi Ruoyao <xry111@xry111.site> Signed-off-by: David Gibson <david@gibson.dropbear.id.a>
2024-11-25tests/sw_tree1.c: fix unitialized saveptrBrandon Maier1-1/+1
Building the dtc tests on the Conda build system results in the following error. > In function '__strtok_r_1c', 2024-11-23T19:17:20.7930512Z inlined from 'main' at ../tests/sw_tree1.c:140:17: > $BUILD_PREFIX/x86_64-conda-linux-gnu/sysroot/usr/include/bits/string2.h:1177:10: error: 'saveptr' may be used uninitialized [-Werror=maybe-uninitialized] > 1177 | while (*__s == __sep) > | ^~~~ > ../tests/sw_tree1.c: In function 'main': > ../tests/sw_tree1.c:137:39: note: 'saveptr' was declared here > 137 | char *str = argv[2], *saveptr, *tok; > | ^~~~~~~ > cc1: all warnings being treated as errors The manpage `strtok(3)` says the following. > VERSIONS > On some implementations, *saveptr is required to be NULL on the first call to strtok_r() that is being used to parse str. So set it to NULL. Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
2024-07-05libfdt: overlay: Fix phandle overwrite check for new subtreesUwe Kleine-König2-0/+12
If the overlay's target is only created in a previous fragment, it doesn't exist in the unmodified base device tree. For the phandle overwrite check this can be ignored because in this case the base tree doesn't contain a phandle that could be overwritten. Adapt the corresponding check to not error out if that happens but just continue with the next fragment. This is currently triggered by arch/arm64/boot/dts/renesas/salvator-panel-aa104xd12.dtso in the kernel repository which creates /panel in its first fragment and modifies it in its second. Reported-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/all/CAL_JsqL9MPycDjqQfPNAuGfC6EMrdzUivr+fuOS7YgU3biGd4A@mail.gmail.com/ Fixes: 1fad065080e6 ("libfdt: overlay: ensure that existing phandles are not overwritten") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Message-ID: <20240626075551.2493048-2-u.kleine-koenig@baylibre.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-06-26pylibfdt/meson.build: fix Python library being rebuilt during installBrandon Maier1-1/+13
User @sharkcz noted that when the '--quiet' flag is removed from ./setup.py, the following can be seen from the `./setup.py install` stage. Running custom install script 'dtc/g/pylibfdt/../setup.py --top-builddir \ dtc/g/redhat-linux-build install --prefix=/usr/local --root=$DESTDIR' running install ... building '_libfdt' extension swigging dtc/g/pylibfdt/../pylibfdt/libfdt.i to \ dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.c swig -python -Idtc/g/pylibfdt/../libfdt -o \ dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.c dtc/g/pylibfdt/../pylibfdt/libfdt.i gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 \ -DNDEBUG -fexceptions -fexceptions -fexceptions -fPIC -DPY_SSIZE_T_CLEAN \ -Idtc/g/pylibfdt/../libfdt -I/usr/include/python3.12 -c \ dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.c -o \ build/temp.linux-ppc64le-cpython-312dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.o creating build/lib.linux-ppc64le-cpython-312 gcc -shared build/temp.linux-ppc64le-cpython-312dtc/g/pylibfdt/../pylibfdt/libfdt_wrap.o \ -Ldtc/g/redhat-linux-build/libfdt -L/usr/lib64 -lfdt -o \ build/lib.linux-ppc64le-cpython-312/_libfdt.cpython-312-powerpc64le-linux-gnu.so copying dtc/g/pylibfdt/../pylibfdt/libfdt.py -> build/lib.linux-ppc64le-cpython-312 Meaning the python library is getting recompiled during the `meson install` phase. This causes build issues as Meson does not set the compiler and linker flags during the install phase. The reason the library is getting rebuilt is during the normal build with "build_ext", the `--build-lib` flag gets passed which changes the default output build directory. But there is no equivalent option for the "install" command. Install instead looks in the default directory "./build" and so does not find the previously built library. Since we can't fix the "install" command, drop the --build-lib flag. This causes setup.py to compile the libraries at `<meson-build>/build/lib.linux-x86_64-cpython-312/`. We must also then fix run_tests.sh to find the library build directory as it's machine-dependent. Fixes: #135 Signed-off-by: Brandon Maier <brandon.maier@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-06-26tests/run_tests.sh: fix Meson library path being droppedBrandon Maier1-1/+5
Meson automatically passes in LD_LIBRARY_PATH pointing at the correct build directory for libfdt.so. So preserve LD_LIBRARY_PATH if it's already set. Signed-off-by: Brandon Maier <brandon.maier@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-06-24tests/meson.build: fix python and yaml tests not runningBrandon Maier1-0/+3
The run-tests.sh script attempts to detect if Python and Yaml support is enabled in the build. This has caused false-negatives where it fails to find the Python library even though it was compiled into the build. Avoid this problem altogether and always set the NO_PYTHON and NO_YAML to match if the features are enabled in Meson. Signed-off-by: Brandon Maier <brandon.maier@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-05-01libfdt: tests: Update test case for overlay_bad_fixupZheng Guangyuan1-1/+1
Changed the target DTS from overlay_base_no_symbols.test.dtb to overlay_base_manual_symbols.test.dtb. This ensures that the test case doesn't exit prematurely due to the absence of label-linked phandle in the symbols node. The update guarantees that the test case appropriately checks the validity of the fixup string linked to the label, as intended. Signed-off-by: Zheng Guangyuan <1628513611@qq.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-04-29tests: Remove two_roots and named_root from LIBTREE_TESTS_L and add all dtb ↵Zheng Guangyuan1-3/+4
filenames generated by dumptrees to TESTS_TREES_L in Makefile.tests These two binaries are not produced; two_roots.dtb and named_root.dtb are instead generated in TESTS_TREES. Redundant file entries eliminated and Ensures that all dtb filenames generated by dumptrees are now accounted for in the TEST_TREES, addressing previous omissions Signed-off-by: Zheng Guangyuan <1628513611@qq.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-03-22tests: fix tests broken under MesonBrandon Maier1-7/+7
Tests running under Meson run from a different working directory then under Makefile. Some of these tests had not been fixed to work from a different directory because the tests were testing for an error condition which is indistinguishable from a missing file. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-03-19meson: split run-tests by typeBrandon Maier1-8/+23
Instead of running run-tests on all tests, split them down into the 9 separate run-tests test types. This provides better granularity of test results from the Meson test harness. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-03-19meson: fix dependencies of testsBrandon Maier1-2/+9
If the tests are run without a full compile they will fail. For example with the following. > rm -rf build/ > meson setup build/ > meson test -C build/ This is because the tests rely on the devicetree tools and test executables. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-03-14libfdt: overlay: ensure that existing phandles are not overwrittenUwe Kleine-König3-0/+83
A phandle in an overlay is not supposed to overwrite a phandle that already exists in the base dtb as this breaks references to the respective node in the base. So add another iteration over the fdto that checks for such overwrites and fixes the fdto phandle's value to match the fdt's. A test is added that checks that newly added phandles and existing phandles work as expected. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Message-ID: <20240225175422.156393-2-u.kleine-koenig@pengutronix.de> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-01-25tests: use correct pkg-config when cross compilingAlyssa Ross1-1/+1
By convention, the PKG_CONFIG environment variable is used to tell build systems which pkg-config executable should be used. This is often used when cross compiling, where it might be set to something like "aarch64-unknown-linux-gnu-pkg-config". Signed-off-by: Alyssa Ross <hi@alyssa.is> Message-ID: <20240123130409.181128-2-hi@alyssa.is> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-11-04treesource: Restore string list output when no type markersRob Herring2-2/+6
When the DTS output has no type markers, we have to guess the type. Prior to commit 32b9c6130762 ("Preserve datatype markers when emitting dts format"), instances of string lists would be delimited. Since then, a single string with embedded "\0"s are emitted. An embedded "\0" is valid for DTS files, but that's a rare exception and lists of strings are the overwhelming majority. Restore the prior behavior. stringlist.dts is reused for testing this, but needs a couple of tweaks in order to match the dts output. Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Rob Herring <robh@kernel.org> Message-ID: <20231027142901.2536622-1-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-10-11libfdt: fdt_path_offset_namelen: Reject empty pathPierre-Clément Tosi1-1/+7
Reject empty paths and negative lengths, according to the DT spec v0.4: The convention for specifying a device path is: /node-name-1/node-name-2/node-name-N The path to the root node is /. This prevents the access to path[0] from ever being out-of-bounds. Signed-off-by: Pierre-Clément Tosi <ptosi@google.com> Message-ID: <20231010092822.qo2nxc3g47t26dqs@google.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-10-11libfdt: fdt_get_alias_namelen: Validate aliasesPierre-Clément Tosi2-1/+17
Ensure that the alias found matches the device tree specification v0.4: Each property of the /aliases node defines an alias. The property name specifies the alias name. The property value specifies the full path to a node in the devicetree. This protects against a stack overflow caused by fdt_path_offset_namelen(fdt, path, namelen) calling fdt_path_offset(fdt, fdt_get_alias_namelen(fdt, path, namelen)) leading to infinite recursion on DTs with "circular" aliases. This fix was originally written by Mike McTernan for Android in [1]. [1]: https://android.googlesource.com/platform/external/dtc/+/9308e7f9772bd226fea9925b1fc4d53c127ed4d5 Signed-off-by: Pierre-Clément Tosi <ptosi@google.com> Acked-by: Mike McTernan <mikemcternan@google.com> Message-ID: <20231010092725.63h7c45p2fnmj577@google.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-09-15pylibfdt: Support boolean propertiesSimon Glass2-0/+34
Boolean properties are unusual in that their presense or absence indicates the value of the property. This makes them a little painful to support using the existing getprop() support. Add new methods to deal with booleans specifically. Signed-off-by: Simon Glass <sjg@chromium.org> Message-ID: <20230912182716.248253-1-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-08-04tests: generate dtbs in Meson build directoryBrandon Maier1-2/+3
When running under Meson, check_tests() is generating dtb build files in the source directory. This is because dtb is named by appending ".test.dtb" to the full source file name. Use basename to extract just the source filename and write it to the working directory which is the build directory. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-08-03tests: fix use of deprecated meson methodsBrandon Maier1-2/+2
Fixes the following warnings > tests/meson.build:123: WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead > tests/meson.build:124: WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-05-14dtc: Correct invalid dts output with mixed phandles and integersDavid Gibson2-0/+2
The handling of "type preservation" dts output is based on the idea of "phandles with arguments" in properties, which isn't really a thing, other than a fairly common convention about how bindings are written. There's nothing preventing a binding which freely mixes phandles and other integers in an array of cells. Currently write_propval() handles this incorrectly: specifically the case of a phandle which follows a regular integer in a 32-bit cell array, but without a new '< >' delimited causing an extra TYPE_UINT32 marker to be inserted. In this case it omits the necessary space between the integer and the phandle reference, leading to output which can't be sent back into dtc and parsed. Correct this, and update tests to match. I think this is more or less correct for now, but really write_propval() is a big mess :(. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-05-14tests: Add additional tests for device graph checksJohannes Beisswenger3-0/+61
* bad-graph-child-address.dts: additional child address test since the one in bad-graph.dts is now shadowed by its prerequisites also failing. * bad-graph-reg-cells.dts: test warnings produced by check_graph_reg(). Signed-off-by: Johannes Beisswenger <johannes.beisswenger@cetitec.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-05-14yaml: Depend on libyaml >= 0.2.3Uwe Kleine-König1-1/+1
libyaml before 0.2.3 expects non-const string parameters. Supporting both variants would require either cpp magic or ignoring "discarded-qualifiers" compiler warnings. For the sake of simplicity just support libyaml 0.2.3 and newer. Note that NO_YAML can be overwritten on the make command line. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2023-05-07tests: Add test cases for bad endpoint node and remote-endpoint prop checksJohannes Beisswenger5-0/+46
Signed-off-by: Johannes Beisswenger <johannes.beisswenger@cetitec.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-03-01tests: fix leaks spotted by ASANMarc-André Lureau10-21/+25
Always allocate from open_blob_rw(), to simplify memory management. The fixes are not exhaustive. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-03-01tests: fix -Wwrite-stringsMarc-André Lureau2-3/+3
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-02-28meson: Fix cell overflow tests when running from mesonDavid Gibson1-2/+2
Because meson always builds out-of-tree we need to reference things in the original source tree via $SRCDIR from run_tests.sh. We forgot a couple of cases for the cell overflow tests. Fix them. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-02-27Use #ifdef NO_VALGRINDMarc-André Lureau1-1/+1
Using simply #if will fail when NO_VALGRIND is undefined. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-02-27Do not redefine _GNU_SOURCE if already setMarc-André Lureau1-0/+2
Or else, compilation will fail. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-02-05pylibfdt: add size_hint parameter for get_pathLuca Weiss1-0/+1
This also enables us to test the -NOSPACE condition by adding a test setting size_hint=1 so this path is taken. Message-Id: <20230201181112.1644842-1-luca@z3ntu.xyz> Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-11-21dtc: Warning rather than error on possible truncation of cell valuesDavid Gibson3-0/+19
We always evaluate integer values in cell arrays as 64-bit quantities, then truncate to the size of the array cells (32-bit by default). However to detect accidental truncation of meaningful values, we give an error if the truncated portion isn't either all 0 or all 1 bits. However, this can still give counterintuitive errors. For if the user is thinking in 2's complement 32-bit arithmetic (which would be quite natural), then they'd expect the expression (-0xffffffff-2) to evaluate to -1 (0xffffffff). However in 64-bit it evaluates to 0xfffffffeffffffff which does truncate to the expected value but trips this error message. Because of this reduce the error to only a warnings, with a somewhat more helpful message. Fixes: https://github.com/dgibson/dtc/issues/74 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-10-12libfdt: tests: add get_next_tag_invalid_prop_lenTadeusz Struk5-1/+104
Add a new test get_next_tag_invalid_prop_len, which covers fdt_next_tag(), when it is passed an corrupted blob, with invalid property len values. The test runs twice, on a blob in sw and finished state. Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org> Message-Id: <20221011182611.116011-2-tadeusz.struk@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-07-31Don't generate erroneous fixups from reference to pathDavid Gibson2-0/+7
The dtb overlay format only permits (non local) fixups to reference labels, not paths. That's because the fixup target goes into the property name in the overlay, and property names aren't permitted to include '/' characters. Stop erroneously generating such fixups, because we didn't check for this case. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-07-27Allow static building with mesonTero Tervala1-2/+7
Added "static-build" option in the meson_options.txt. Setting it to "true" allows static building. Signed-off-by: Tero Tervala <tero.tervala@unikie.com> Message-Id: <20220629163557.932298-1-tero.tervala@unikie.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-07-27Allow static building with makeTero Tervala2-8/+14
Set STATIC_BUILD=1 environment variable to enable static building when using makefiles. Signed-off-by: Tero Tervala <tero.tervala@unikie.com> Message-Id: <20220629163531.932281-1-tero.tervala@unikie.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-07-26Fix test script to run also on dash shellTero Tervala1-2/+2
/bin/sh points to dash instead of bash in some linux distros. One test would fail if dash was used, this fix will allow all tests to run properly on dash too. dash built-in printf does not support "\xNN" -hex escape format. "\NNN" -octal escape format is supported by both bash and dash printf. Replaced "$(echo "$expect")" because this actually runs /bin/echo instead of shell internal echo and in some cases causes "\NNN" escapes to be printed as the actual characters they represent instead of the escape sequence itself. Cosmetic quotes added to make printout a bit clearer. Signed-off-by: Tero Tervala <tero.tervala@unikie.com> Message-Id: <20220704073722.1075849-1-tero.tervala@unikie.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-07-02Add missing relref_merge test to meson test listTero Tervala1-0/+1
Will remove one "Strange test result" when running tests with meson Signed-off-by: Tero Tervala <tero.tervala@unikie.com> Message-Id: <20220629163114.932175-1-tero.tervala@unikie.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-04-20pylibfdt: add FdtRo.get_path()Luca Weiss1-0/+13
Add a new Python method wrapping fdt_get_path() from the C API. Also add a test for the new method. Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Message-Id: <20220419194537.63170-1-luca@z3ntu.xyz> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-01-25tests: add test cases for label-relative path referencesAhmad Fatoum7-2/+112
Newly added &{label/path} feature doesn't yet have any tests. Add some. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2021-12-29Handle integer overflow in check_property_phandle_args()David Gibson2-0/+21
If the corresponding '#xxx-cells' value is much too large, an integer overflow can prevent the checks in check_property_phandle_args() from correctly determining that the checked property is too short for the given cells value. This leads to an infinite loops. This patch fixes the bug, and adds a testcase for it. Further information in https://github.com/dgibson/dtc/issues/64 Reported-by: Anciety <anciety@pku.edu.cn> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-28tests: setprop_inplace: use xstrdup instead of unchecked strdupAhmad Fatoum1-1/+1
This is the only strdup instance we have, all others are xstrdup. As strdup is _POSIX_C_SOURCE >= v200809L, which we don't require and we don't check strdup error return here, switch to xstrdup instead. This aligns the test with others that call xfuncs, mainly xmalloc(). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-28pylibfdt: add Property.as_*int*_array()Luca Weiss2-0/+15
Add new methods to handle decoding of int32, uint32, int64 and uint64 arrays. Also add tests for the new methods. Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Message-Id: <20211225132558.167123-3-luca@z3ntu.xyz> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-28pylibfdt: add Property.as_stringlist()Luca Weiss1-0/+8
Add a new method for decoding a string list property, useful for e.g. the "reg-names" property. Also add a test for the new method. Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Message-Id: <20211225132558.167123-2-luca@z3ntu.xyz> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>