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>
This commit is contained in:
David Gibson
2016-12-09 14:45:25 +11:00
parent 3ea879dc0c
commit b4dc0ed8b1
2 changed files with 6 additions and 4 deletions

View File

@@ -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 */

View File

@@ -27,8 +27,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 */