[PATCH v2 2/3] waf: improve readability of cross-answers generated by cross-execute

Uri Simchoni urisimchoni at gmail.com
Sun May 3 15:38:51 MDT 2015


When generating a result for cross-answers from the (retcode, retstring) tuple:
- (0, "output") indicated as "output"
- 1 is interpreted as generic fail code, instead of 255, because most
  if not all tests fail with 1 as exit code rather than 255
- For failing test, use NO instead of FAIL, because that's not
  necessarily a failure (it could mean that something is NOT
  broken)

Signed-off-by: Uri Simchoni <urisimchoni at gmail.com>
---
 buildtools/wafsamba/samba_cross.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py
index 057099e..e0499df 100644
--- a/buildtools/wafsamba/samba_cross.py
+++ b/buildtools/wafsamba/samba_cross.py
@@ -6,7 +6,7 @@ from Configure import conf
 real_Popen = None
 
 ANSWER_UNKNOWN = (254, "")
-ANSWER_FAIL    = (255, "")
+ANSWER_NO      = (1, "")
 ANSWER_OK      = (0, "")
 
 cross_answers_incomplete = False
@@ -33,10 +33,13 @@ def add_answer(ca_file, msg, answer):
         f.write('%s: OK\n' % msg)
     elif answer == ANSWER_UNKNOWN:
         f.write('%s: UNKNOWN\n' % msg)
-    elif answer == ANSWER_FAIL:
-        f.write('%s: FAIL\n' % msg)
+    elif answer == ANSWER_NO:
+        f.write('%s: NO\n' % msg)
     else:
-        f.write('%s: (%d, "%s")\n' % (msg, retcode, retstring))
+        if retcode == 0:
+            f.write('%s: "%s"\n' % (msg, retstring))
+        else:
+            f.write('%s: (%d, "%s")\n' % (msg, retcode, retstring))
     f.close()
 
 
@@ -64,7 +67,7 @@ def cross_answer(ca_file, msg):
                 return ANSWER_UNKNOWN
             elif ans == "FAIL" or ans == "NO":
                 f.close()
-                return ANSWER_FAIL
+                return ANSWER_NO
             elif ans[0] == '"':
                 f.close()
                 return (0, ans.strip('"'))
-- 
1.9.1



More information about the samba-technical mailing list