aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2007-10-17dtc: Restore missing code for testcasesDavid Gibson2-0/+111
Recent commits 333542fabf8720b881e992a5abca32ef4bcb841a and fd1bf3a5ae46962528ef89a824261a88830758a2 added new testcases to dtc. However, although the testcases were added to the Makefile and run_tests.sh, one of the .c files for the testcase was omitted from the patch in each case. This patch restores the missing testcase code. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-16dtc: Improve support for string escapesDavid Gibson5-1/+52
dtc supports the use of C-style escapes (\n, \t and so forth) in string property definitions via the data_copy_escape_string() function. However, while it supports the most common escape characters, it doesn't support the full set that C does, which is a potential gotcha. Worse, a bug in the lexer means that while data_copy_escape_string() can handle the \" escape, a string with such an escape won't lex correctly. This patch fixes both problems, extending data_copy_escape_string() to support the missing escapes, and fixing the regex for strings in the lexer to handle internal escaped quotes. This also adds a testcase for string escape functionality. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-16libfdt: Add functions for handling the "compatible" propertyDavid Gibson7-1/+111
This patch adds functions for dealing with the compatible property. fdt_node_check_compatible() can be used to determine whether a node is compatible with a given string and fdt_node_offset_by_compatible() locates nodes with a given compatible string. Testcases for these functions are also included. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-16dtc: Don't delete *.test.dtb between testgroupsDavid Gibson1-6/+3
The dtc/libfdt testsuite creates a number of .dtb files during its run. To ensure a clean test run, these are currently deleted before each group of tests. This is, in fact, a mistake, since if something goes wrong in the first group of tests, deleting the .dtb at the beginning of the second group of tests makes it harder to figure out what the problem was. This patch changes the script to only delete the files once, before the whole test run. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-15libfdt: Add functions to get/add/delete memory reservemap entriesDavid Gibson9-3/+49
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 Gibson16-72/+95
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-10-15libfdt: Test rw functions on more treesDavid Gibson1-3/+18
At present, the testcases for read/write functions (setprop, del_property and del_node) are only invoked on the single asm-generated tree, not on any of the other tree images which should be equivalent. The functions in question will (correctly) not work on the "unfinished" tree output from sw_tree1, but should work on most of the others. This patch extends the run_tests script to invoke the r/w testcases on more example trees. The testsuite still passes clean with this addition. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-18dtc: Whitespace cleanupDavid Gibson7-10/+9
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-09-18dtc: Add basic testcases for dtcDavid Gibson4-3/+62
This patch adds a handful of simple testcases for dtc. It adds a dts file which should generate the same sample tree as is used for the libfdt testcases, and tests invoking dtc on this dts, plus the standard batch of libfdt cases on the resulting dtb, which effectively checks that the dtb is correct. Because the test framework assumes each testcase is an executable with the right output conventions, we use a little shell script, dtc.sh, as a wrapper around dtc itself. It simply invokes dtc and returns a PASS or FAIL depending on whether dtc returned an error. It's not much, but it's a start. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-17dtc: Cleanup testsuite organizationDavid Gibson2-23/+4
run_tests.sh from the dtc testsuite currently has a facility ro run just "functional" or just "stress" tests. This distinction is carried over from libhugetlbfs where the test framework originated, and where it made sense. In dtc, we have no stress tests, so running these subsections isn't particularly interesting. This patch removes these test subsets, instead defining a single "libfdt" test subset for testcases related to libfdt (and not dtc proper only. Currently that's all of the testcases, but with any luck we'll have some dtc testcases in the future. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-17libfdt: Consistently use big-endian property data in testcasesDavid Gibson1-2/+13
Flat device trees always have integers in their structure stored as big-endian. From this point of view, property values are bags-of-bytes and any endianness is up to users of the device tree to determine. The libfdt testcases which use properties with integer values, currently use native endian format for the architecture on which the testcases are run. This works ok for now, since both the creation and checking of the example device trees happen in the same endianness. This will become a problem, however, for tests of dtc which we want to add in the nearish future. dtc always uses big-endian format for 'cell' format data in properties; as it needs to in order to produce powerpc-usable device trees when hosted on a little-endian architecture. This patch, therefore, changes the libfdt testsuite to use big-endian format always for integer format data, in order to interoperate sanely with future dtc testcases. This also means that the example trees created by the testsuite should now be byte-for-byte identical regardless of dtc and libfdt's host platform, which is arguably an advantage. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-17libfdt: Add fdt_node_offset_by_prop_value()David Gibson3-0/+112
This patch adds a function to libfdt to locate nodes containing a property with a specific value. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-08-31dtc: Optimise by default, fix warnings thus uncoveredDavid Gibson1-2/+1
This patch turns on optimisation in the Makefile by default. With the optimizer on, some uninitialized variable warnings (one real, two bogus) are now generated. This patch also squashes those again.
2007-08-30dtc: Fix summary calculation in testsuiteDavid Gibson1-5/+8
The bookkeeping for producing the testsuite summary (total number of tests passed, failed and so forth) is broken. It uses $? across several tests, but for checks after the first, the value of $? will no longer contain the original return code, but just that from the previous test. This patch fixes the problem. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-08-30libfdt: Add fdt_parent_offset() and supporting functionsDavid Gibson4-1/+237
This patch adds an fdt_parent_offset() function which returns an offset to the parent node of a given node. It also adds two helper functions which are used to implement fdt_parent_offset() but are also exported: fdt_supernode_atdepth_offset() which returns the ancestor of a given node at a specified depth from the root of the tree, and fdt_node_depth() which returns the depth of a given node. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-08-30libfdt: Add fdt_get_path() functionDavid Gibson3-1/+93
This patch adds an fdt_get_path() function to libfdt, which returns the full path of a given node in a caller supplied buffer. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-08-30libfdt: Add fdt_get_name() to retrieve a node's nameDavid Gibson3-1/+86
This patch adds a new fdt_get_name() function to libfdt which will return a node's name string (including unit address, if any). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-08-30libfdt: Fix handling of trailing / in fdt_path_offset()David Gibson1-0/+8
Currently, fdt_path_offset() returns FDL_ERR_BADOFFSET if given a path with a trailing '/'. In particular this means that fdt_path_offset("/") returns FDT_ERR_BADOFFSET rather than 0 as one would expect. This patch fixes the function to accept and ignore trailing '/' characters. As well as allowing fdt_path_offset("/") this means that fdt_path_offset("/foo/") will return the same as fdt_path_offset("/foo") which seems in keeping with the principle of least surprise. This also adds a testcase to ensure that fdt_path_offset("/") returns 0 as it should. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-07-07dtc: add a testcase with labelsMilton Miller1-0/+60
Create a source file with labels for use as a testcase to check parsing dts files. Signed-off-by: Milton Miller <miltonm@bga.com>
2007-06-25dtc: Improve and better integrate dtc and libfdt MakefilesDavid Gibson2-67/+65
This patch substantially revamps the dtc Makefiles, in particular better integrating the Makefile for dtc proper with the Makefiles imported from libfdt for libfdt and the shared testsuite. Notable changes: - No recursive make calls. Instead subsidiary Makefiles are included into the top-level Makefile so we get a complete dependency information. - Common pattern rules, CFLAGS etc. shared between dtc, libfdt and testsuite, rather than separate copies. - Vaguely Kbuild-like non-verbose mode used by default, which makes warnings more prominent. - libfdt Makefile consists only of variable definitions and helper rules, to make it more easily embeddable into other Makefile systems. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-06-25dtc: Count testcases and results in the dtc/libfdt testsuiteDavid Gibson1-1/+25
There are quite a lot of testcases in the dtc testsuite (recently imported from libfdt). It can be easy to miss a stray FAIL result in the midst of all the rest. To improve this, this patch adds a summary to the end of the testsuite results giving the total number of tests along with the number of PASSes FAILs and other results. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-06-14Merge libfdt into dtc.David Gibson25-5/+1950
Having pulled the libfdt repository into dtc, merge the makefiles and testsuites so that they build together usefully.
2007-02-15Add some initial test cases.Jon Loeliger7-0/+566
Add the original simple test case and a case with different based cell values. Correct output asm files as well as stderr is captured. Signed-off-by: Jon Loeliger <jdl@freescale.com>
2005-07-04Add missing file.David Gibson1-0/+2
2005-06-08Initial commitDavid Gibson2-0/+14