[Crosstoolchain-logs] [device-tree-compiler] 08/58: tests: Fix double expansion bugs in test code

Vagrant Cascadian vagrant at moszumanska.debian.org
Mon Sep 25 16:23:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

vagrant pushed a commit to branch debian/master
in repository device-tree-compiler.

commit b4dc0ed8b127a16ca5215a08fd2890768cde646e
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Fri Dec 9 14:45:25 2016 +1100

    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 at gibson.dropbear.id.au>
---
 tests/check_path.c | 5 +++--
 tests/overlay.c    | 5 +++--
 2 files changed, 6 insertions(+), 4 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 */
diff --git a/tests/overlay.c b/tests/overlay.c
index 961ed60..3093eec 100644
--- a/tests/overlay.c
+++ b/tests/overlay.c
@@ -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 */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list