History log of /external/dtc/tests/fdtput-runtest.sh
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c34e88354a07099dbc15a41621c81f71325d25fd 03-Feb-2012 David Gibson <david@gibson.dropbear.id.au> Don't use diff to check fdt{get,put} results

Currently the fdt{get,put}-runtest.sh scripts invoke diff to check if
fdt{get,put} did the right thing. This isn't great though: it's not
obvious from the diff output which is the expected and which is the
actual result; diff's line by line behaviour is useless here, since all
the results are a single line and finally, when there is a difference
it always prints information even when the tests are supposed to be
running in quiet mode.

This patch uses cmp instead, and explicitly prints the expected results,
when running in verbose mode (the invocation of fdtget itself will have
already displayed the actual results in this mode.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/tests/fdtput-runtest.sh
15b23d21a62b5a0295ee08b54d0842889ce94c92 03-Feb-2012 David Gibson <david@gibson.dropbear.id.au> Clean up invocation of fdt{get,put} tests

This patch cleans up how the fdtget and fdtput tests are invoked.
Specifically we no longer hide the full command lines with a wrapper
function - this makes it possible to distinguish fdtget from similar
fdtput tests and makes it easier to work out how to manually invoke an
individual failing test.

In addition, we remove the testing for errors from the
fdt{get,put}-runtest.sh script, instead using an internal wrapper
analagous to run_wrap_test which can test for any program invocation
that's expected to return an error.

For a couple of the fdtput tests this would result in printing out
ludicrously large command lines. Therefore we introduce a new
mechanism to cut those down to something reasonable.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/tests/fdtput-runtest.sh
c879a8a28b168b3b448ca8a107e3386eda6829c7 03-Feb-2012 David Gibson <david@gibson.dropbear.id.au> Factor signal checks out of test scripts

Several test scripts now have some code to check for a program returning
a signal, and reporting a suitable failure. This patch moves this
duplicated code into a helper function in tests.sh. At the same time we
remove a bashism found in the current copies (using the non portablr $[ ]
construct for arithmetic).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/tests/fdtput-runtest.sh
2ca83614e78f32e68202100e94668b0bb62f1ba6 03-Feb-2012 David Gibson <david@gibson.dropbear.id.au> Use 'trap' builtin to clean up temporaries in test scripts

Some of the test scripts create temporary files, which we remove at the
end. Except that we usually forgot to remove them on some exit paths. To
avoid this problem in future, this modifies the scripts to use the shell's
trap 0 functionality to automatically remove the temporaries on any exit.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/tests/fdtput-runtest.sh
9a50d82c4e3a44ca004ada288f7c37004da0b0cc 03-Feb-2012 David Gibson <david@gibson.dropbear.id.au> Remove unused variable from test scripts

Several of the test scripts remove $TMPFILE, without ever having set
the TMPFILE variable. This patch fixes it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/tests/fdtput-runtest.sh
1ede50c3559bbfca79fadcbfd8acb9388f4aac87 21-Jan-2012 Simon Glass <sjg@chromium.org> Add fdtput utility to write property values to a device tree

This simple utility allows writing of values into a device tree from the
command line. It aimes to be the opposite of fdtget.

What is it for:
- Updating fdt values when a binary blob already exists
(even though source may be available it might be easier to use this
utility rather than sed, etc.)
- Writing machine-specific fdt values within a build system

To use it, specify the fdt binary file on command line followed by the node
and property to set. Then, provide a list of values to put into that
property. Often there will be just one, but fdtput also supports arrays and
string lists.

fdtput does not try to guess the type of the property based on looking at
the arguments. Instead it always assumes that an integer is provided. To
indicate that you want to write a string, use -ts. You can also provide
hex values with -tx.

The command line arguments are joined together into a single value. For
strings, a nul terminator is placed between each string when it is packed
into the property. To avoid this, pass the string as a single argument.

Usage:
fdtput <options> <dt file> <<node> <property> [<value>...]
Options:
-t <type> Type of data
-v Verbose: display each value decoded from command line
-h Print this help

<type> s=string, i=int, u=unsigned, x=hex
Optional modifier prefix:
hh or b=byte, h=2 byte, l=4 byte (default)

To read from stdin and write to stdout, use - as the file. So you can do:

cat somefile.dtb | fdtput -ts - /node prop "My string value" > newfile.dtb

This commit also adds basic tests to verify the major features.

Signed-off-by: Simon Glass <sjg@chromium.org>
/external/dtc/tests/fdtput-runtest.sh