waf: improve readability of cross-answers generated by cross-execute
authorUri Simchoni <urisimchoni@gmail.com>
Sun, 3 May 2015 19:56:15 +0000 (22:56 +0300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 May 2015 09:19:11 +0000 (11:19 +0200)
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@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
buildtools/wafsamba/samba_cross.py

index 9ca2f8d4610d8c7def48a3bb919bccc207d4b323..8213e1718d311948006b4872bfb11c29d7ce414a 100644 (file)
@@ -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('"'))