Re: [Question] How can i stop build immediately in build fail?

2013-01-12 Thread Eli Zaretskii
 Date: Fri, 11 Jan 2013 17:57:28 -0800
 From: David Boyce d...@boyski.com
 Cc: help-make help-m...@gnu.org, bug-make bug-make@gnu.org
 
 % make -j2
 sleep 3
 while echo ok; do sleep 1; done
 ok
 ok
 ok
 ok
 exit 1
 stopping make!
 make: *** [job2] Terminated
 make: *** [job1] Terminated
 Terminated

Which is dangerous, since when Make is terminated, it doesn't do the
cleanup, like deleting incomplete products, which could produce
strange effects the next time you run it.

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: [Question] How can i stop build immediately in build fail?

2013-01-12 Thread Martin d'Anjou

On 2013-01-10, jungsoo.son wrote:

How can i stop build immediately in build fail?


There is a patch already for this:
http://lists.gnu.org/archive/html/bug-make/2009-01/msg00035.html

And an example of how it works:
http://ninjaverification.wordpress.com/2009/02/03/continous-integration-system-using-parallel-make/

Used it for years, saved us several thousands of hours on the continuous 
integration server.


Martin


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: [Question] How can i stop build immediately in build fail?

2013-01-12 Thread Oleksandr Gavenko
On 2013-01-12, Eli Zaretskii wrote:

 Date: Fri, 11 Jan 2013 17:57:28 -0800
 From: David Boyce d...@boyski.com
 Cc: help-make help-m...@gnu.org, bug-make bug-make@gnu.org
 
 % make -j2
 sleep 3
 while echo ok; do sleep 1; done
 ok
 ok
 ok
 ok
 exit 1
 stopping make!
 make: *** [job2] Terminated
 make: *** [job1] Terminated
 Terminated

 Which is dangerous, since when Make is terminated, it doesn't do the
 cleanup, like deleting incomplete products, which could produce
 strange effects the next time you run it.

I suggest to enable .DELETE_ON_ERROR option in such case...

-- 
Best regards!

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: [Question] How can i stop build immediately in build fail?

2013-01-12 Thread Eli Zaretskii
 From: Oleksandr Gavenko gaven...@gmail.com
 Date: Sat, 12 Jan 2013 11:17:17 +0200
 Cc: bug-make@gnu.org, help-m...@gnu.org
 
 On 2013-01-12, Eli Zaretskii wrote:
 
  Date: Fri, 11 Jan 2013 17:57:28 -0800
  From: David Boyce d...@boyski.com
  Cc: help-make help-m...@gnu.org, bug-make bug-make@gnu.org
  
  % make -j2
  sleep 3
  while echo ok; do sleep 1; done
  ok
  ok
  ok
  ok
  exit 1
  stopping make!
  make: *** [job2] Terminated
  make: *** [job1] Terminated
  Terminated
 
  Which is dangerous, since when Make is terminated, it doesn't do the
  cleanup, like deleting incomplete products, which could produce
  strange effects the next time you run it.
 
 I suggest to enable .DELETE_ON_ERROR option in such case...

How can that help, if Make itself is killed by a signal?

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: [Question] How can i stop build immediately in build fail?

2013-01-11 Thread David Boyce
It may be a reasonable feature request but it also may not be that
hard to implement with existing functionality. Here's one approach:

% cat makefile
SHELL := $(abspath shx)

.PHONY: job
job: job1 job2

.PHONY: job1
job1:
sleep 3
exit 1

.PHONY: job2
job2:
while echo ok; do sleep 1; done

% cat shx
#!/usr/bin/env python

import optparse
import os
import subprocess
import sys

if '__main__' == __name__:
parser = optparse.OptionParser()
parser.add_option('-c', '--command', type='string',
  help='Command to execute')
(opts, args) = parser.parse_args(sys.argv[1:])

rc = subprocess.call(opts.command, shell=True)
if rc != 0:
print 'stopping make!'
os.killpg(0, 15)
sys.exit(rc)

% make -j2
sleep 3
while echo ok; do sleep 1; done
ok
ok
ok
ok
exit 1
stopping make!
make: *** [job2] Terminated
make: *** [job1] Terminated
Terminated

I implemented the replacement shell in Python but it could use any
language. You just need to kill the process group once the first
recipe fails.

-David Boyce

On Fri, Jan 11, 2013 at 9:38 AM, Oleksandr Gavenko gaven...@gmail.com wrote:
 On 2013-01-10, jungsoo.son wrote:

 I always run 'make' with -j8. In this case, when there are a fail it is too
 hard to check the fail.

 I want to kill the all sub-make process immediately when the error occurred.

 How can i stop build immediately in build fail?


 I make such example:

 .PHONY: job
 job: job1 job2

 .PHONY: job1
 job1:
 sleep 3
 exit 1

 .PHONY: job2
 job2:
 while echo ok; do sleep 1; done

 Ir you run like:

   $ make -j2

 you get:

   sleep 3
   while echo ok; do sleep 1; done
   ok
   ok
   ok
   exit 1
   make: *** [job1] Error 1
   make: *** Waiting for unfinished jobs
   ok
   ok
   ...

 Seems to be reasonable have an option to kill jobs after some timeout if one
 job fail (or make receive signal) and enabling .DELETE_ON_ERROR in this
 case...

 --
 Best regards!


 ___
 Help-make mailing list
 help-m...@gnu.org
 https://lists.gnu.org/mailman/listinfo/help-make

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make