diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2016-12-09 14:45:25 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2016-12-09 16:13:23 +1100 |
commit | b4dc0ed8b127a16ca5215a08fd2890768cde646e (patch) | |
tree | e8e77f9aa39cb1b2e8bae1911bb3aadc4d1545eb /tests/check_path.c | |
parent | 3ea879dc0c8f86e57cac0ab8768aaa08b00940ea (diff) | |
download | device-tree-compiler-b4dc0ed8b127a16ca5215a08fd2890768cde646e.tar.gz |
tests: Fix double expansion bugs in test code
Two test programs - check_path and overlay - define a CHECK() helper macro
in such a way that in the case of an error it will re-execute the checked
code fragment, instead of using the return value from the initial call.
This can lead to misreporting errors, because the code may fail in a
different way the second time around due to changes made during the first
failing call.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/check_path.c')
-rw-r--r-- | tests/check_path.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/check_path.c b/tests/check_path.c index 0d6a73b..f12f950 100644 --- a/tests/check_path.c +++ b/tests/check_path.c @@ -26,8 +26,9 @@ #define CHECK(code) \ { \ - if (code) \ - FAIL(#code ": %s", fdt_strerror(code)); \ + int err = (code); \ + if (err) \ + FAIL(#code ": %s", fdt_strerror(err)); \ } /* 4k ought to be enough for anybody */ |