Re: How to run TESTS automatically on each source code change?

2014-07-31 Thread Gavin Smith
On Thu, Jul 24, 2014 at 4:48 PM, Steffen Dettmer
steffen.dett...@gmail.com wrote:
 Hi,

 I have a test that generates a log file, which I can manually run via
 make check. Is there a simple way to automate that? For the moment I
 just created a pragmatic target autotest, but I think it is ugly
 (and too specific).

What do you want to happen? The test to be automatically run whenever
make is run?

 Any pointers appreciated!

 Regards,
 Steffen


 autotest:
 @echo Will run \`make check' after each change, stop with INT. ; \
 while true ; do \
   if ! make --question -s -j4 testrunner ; then \
 echo Rechecking... ; \
   make -s check || { \
 echo failed to run `date`  testrunner.log ; \
   } ; \
   fi ; \
   sleep 1 ; \
 done




Re: How to run TESTS automatically on each source code change?

2014-07-31 Thread Pippijn van Steenhoven
On Thu, Jul 24, 2014 at 4:48 PM, Steffen Dettmer steffen.dett...@gmail.com 
wrote:
 Hi,

 I have a test that generates a log file, which I can manually run via
 make check. Is there a simple way to automate that? For the moment I
 just created a pragmatic target autotest, but I think it is ugly
 (and too specific).

Hi,

You may want to look into inotify-tools, in particular inotifywait. You
can use it to monitor a list of files or optionally recursive directories
for changes and do something like:

  while true; do inotifywait file ...; make check; done

If the list of files is very large, the set-up can take a long time
(several seconds for tens of thousands of files). In that case, you may
want to write a smarter script with inotifywatch that has the set-up
cost only once, and then you just monitor inotifywatch's standard output.
If your list of files is extremely large, then you may run out of kernel
memory or the user limit on inotify watches. In the latter case, you can
increase the limit in /etc/sysctl.conf (the relevant variable is
fs.inotify.max_user_watches). In the former case, you really have a very
large file list and you may want to restrict it to your current working
set.

I hope this helps.

Pippijn


signature.asc
Description: Digital signature