ctdb-build: Check the return value of RUN_COMMAND
authorAmitay Isaacs <amitay@gmail.com>
Tue, 8 Jul 2014 01:40:52 +0000 (11:40 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 8 Jul 2014 08:17:54 +0000 (10:17 +0200)
RUN_COMMAND does not raise exceptions if the command fails, but returns
non-zero status.  Ensure that make terminates with non-zero status if
RUN_COMMAND fails.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/wscript

index df7ce98a77f8201ad41087917640476ce503dcd3..db5e5b6f4306ae5d1e4eb184377475294fb382ab 100755 (executable)
@@ -528,7 +528,10 @@ def build(bld):
 
 def testonly(ctx):
     cmd = 'tests/run_tests.sh -V tests/var'
-    samba_utils.RUN_COMMAND(cmd)
+    ret = samba_utils.RUN_COMMAND(cmd)
+    if ret != 0:
+        print('tests exited with exit status %d' % ret)
+        sys.exit(ret)
 
 def test(ctx):
     import Scripting
@@ -537,7 +540,10 @@ def test(ctx):
 
 def autotest(ctx):
     cmd = 'LD_PRELOAD=bin/shared/libsocket-wrapper.so tests/run_tests.sh -e -S -C'
-    samba_utils.RUN_COMMAND(cmd)
+    ret = samba_utils.RUN_COMMAND(cmd)
+    if ret != 0:
+        print('autotest exited with exit status %d' % ret)
+        sys.exit(ret)
 
 def show_version(ctx):
     print VERSION
@@ -576,7 +582,10 @@ def dist():
 
 def rpmonly(ctx):
     cmd = 'rpmbuild -ta --clean --rmsource ctdb-%s.tar.gz' % VERSION
-    samba_utils.RUN_COMMAND(cmd)
+    ret = samba_utils.RUN_COMMAND(cmd)
+    if ret != 0:
+        print('rpmbuild exited with exit status %d' % ret)
+        sys.exit(ret)
 
 def rpm(ctx):
     import Scripting