aboutsummaryrefslogtreecommitdiff
path: root/tests/testutils.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-03Remove duplicate assignmentHeinrich Schuchardt1-1/+0
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2013-04-22Revert "utilfdt_read: pass back up the length of data read"Jon Loeliger1-1/+1
This reverts commit cc2c178727cdeca4eb9756637c2e09e50e0856e7. It was the wrong version of the patch.
2013-04-21utilfdt_read: pass back up the length of data readMike Frysinger1-1/+1
For a follow up commit, we want to be able to scan the buffer that was returned to us. In order to do that safely, we need to know how big the buffer actually is, so pass that back if requested. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-09-22Make testutils use utilfdtSimon Glass1-48/+11
The load_blob() and save_blob() functions are very similar to the utilfdt versions. This removes the duplicated code. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
2008-07-14dtc: Enable and fix -Wpointer-arith warningsDavid Gibson1-1/+1
This patch turns on the -Wpointer-arith option in the dtc Makefile, and fixes the resulting warnings due to using (void *) in pointer arithmetic. While convenient, pointer arithmetic on void * is not portable, so it's better that we avoid it, particularly in libfdt. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-07-14dtc: Address an assortment of portability problemsDavid Gibson1-1/+1
I've recently worked with a FreeBSD developer, getting dtc and libfdt working on FreeBSD. This showed up a number of portability problems in the dtc package which this patch addresses. Changes are as follows: - the parent_offset and supernode_atdepth_offset testcases used the glibc extension functions strchrnul() and strndupa(). Those are removed, using slightly longer coding with standard C functions instead. - some other testcases had a #define _GNU_SOURCE for no particular reason. This is removed. - run_tests.sh has bash specific constructs removed, and the interpreter changed to /bin/sh. This apparently now runs fine on FreeBSD's /bin/sh, and I've also tested it with both ash and dash. - convert-dtsv0-lexer.l has some extra #includes added. These must have been included indirectly with Linux and glibc, but aren't on FreeBSD. - the endian handling functions in libfdt_env.h, based on endian.h and byteswap.h are replaced with some portable open-coded versions. Unfortunately, these result in fairly crappy code when compiled, but as far as I can determine there doesn't seem to be any POSIX, SUS or de facto standard way of determining endianness at compile time, nor standard names for byteswapping functions. - some more endian handling, from testdata.h using the problematic endian.h is simply removed, since it wasn't actually being used anyway. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-11-01libfdt: Handle v16 and re-ordered trees for r/wDavid Gibson1-0/+18
Currently all the read/write functions in libfdt require that the given tree be v17, and further, that the tree has the memory reservation block, structure block and strings block stored in that physical order. This patch eases these constraints, by making fdt_open_int() reorder the blocks, and/or convert the tree to v17, so that it will then be ready for the other read-write functions. It also extends fdt_pack() to actually remove any gaps between blocks that might be present. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-15libfdt: Add functions to get/add/delete memory reservemap entriesDavid Gibson1-0/+15
This patch adds functions to libfdt for accessing the memory reservation map section of a device tree blob. fdt_num_mem_rsv() retreives the number of reservation entries in a dtb, and fdt_get_mem_rsv() retreives a specific reservation entry. fdt_add_mem_rsv() adds a new entry, and fdt_del_mem_rsv() removes a specific numbered entry. Testcases for these new functions are also included. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-15libfdt: Make unit address optional for finding nodesDavid Gibson1-0/+15
At present, the fdt_subnode_offset() and fdt_path_offset() functions in libfdt require the exact name of the nodes in question be passed, including unit address. This is contrary to traditional OF-like finddevice() behaviour, which allows the unit address to be omitted (which is useful when the device name is unambiguous without the address). This patch introduces similar behaviour to fdt_subnode_offset_namelen(), and hence to fdt_subnode_offset() and fdt_path_offset() which are implemented in terms of the former. The unit address can be omitted from the given node name. If this is ambiguous, the first such node in the flattened tree will be selected (this behaviour is consistent with IEEE1275 which specifies only that an arbitrary node matching the given information be selected). This very small change is then followed by many more diffs which change the test examples and testcases to exercise this behaviour. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-18dtc: Whitespace cleanupDavid Gibson1-1/+0
This large patch removes all trailing whitespace from dtc (including libfdt, the testsuite and documentation). It also removes a handful of redundant blank lines (at the end of functions, or when there are two blank lines together for no particular reason). As well as anything else, this means that quilt won't whinge when I go to convert the whole of libfdt into a patch to apply to the kernel. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-06-14Merge libfdt into dtc.David Gibson1-0/+193
Having pulled the libfdt repository into dtc, merge the makefiles and testsuites so that they build together usefully.