[Fuego] [PATCH] dovecot: fix test of logfile and ps.

Tim.Bird at sony.com Tim.Bird at sony.com
Wed Oct 10 03:34:12 UTC 2018


> -----Original Message-----
> From: Wang, Mingyu
> 
> Hi Tim
> 
> >I'm not sure I'm following this.  Is the board logger service writing the data
> to /var/log/mail.log?
> >I would have thought that messages going through the board's system
> logger would show up in
> >/var/log/messages.  I'm not familiar with dovecot, but is it using the system
> logger, or doing its own
> >logging to /var/log/mail.log?
> >I'm just trying to clarify this.
> 
> I tried the test on different boards and found that some of them generated
> mail.log, and the others did not.
> So I want to change /var/log/mail.log to /var/log/messages.

OK - I see.  Is there any pattern to this?  I did a bit more research,
and it looks like the logging in dovecot is configurable.  It says it
can be configured to use syslog, issues it's messages with the 'mail'
facility.  Maybe on some logging systems, the system logger automatically
puts the messages into mail.log, but on other systems the facility
doesn't matter and they just go into /var/log/messages.

I suppose you could always check both, just to be sure.  Or, if you find
out that the log file used is related to the logger used, then you could
use the value returned by detect_logger_service() to determine which
file to check.

> 
> >Why is it preferred to include the path?
> >'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'.
> >Are there more than one dovecot processes started, and you only want to
> match one?
> 
> In the test, because there are other processes are running, there will be
> other results containing the keyword dovecot.
> Log information is as follows:
> 
> -> stop of dovecot succeeded.
> 15011 ?        Ss     0:00 sh -c { cd /home/a/fuego.Functional.dovecot;
> ./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee
> /home/a/fuego.Functional.dovecot/Functional.dovecot.log
> 15012 ?        S      0:00 sh -c { cd /home/a/fuego.Functional.dovecot;
> ./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee
> /home/a/fuego.Functional.dovecot/Functional.dovecot.log
> 15013 ?        S      0:00 tee
> /home/a/fuego.Functional.dovecot/Functional.dovecot.log
> 15014 ?        S      0:00 /bin/sh ./dovecot_test.sh
> 15077 ?        S      0:00 sh tests/dovecot_ps.sh
> 
> In order to avoid grep the non dovecot commands,  I think it's need to match
> /usr/sbin/dovecot strictly.

Ok - that makes perfect sense.  I forgot about all the fuego test processes
running with 'dovecot' in their name.

Do you plan to re-submit this, or would you prefer I apply what you sent,
and do a patch on top of that for any new changes?

Thanks,
 -- Tim

> 
> by Wangmy
> 
> 
> -----Original Message-----
> From: Tim.Bird at sony.com [mailto:Tim.Bird at sony.com]
> Sent: Wednesday, October 10, 2018 2:42 AM
> To: Wang, Mingyu/王 鸣瑜 <wangmy at cn.fujitsu.com>;
> fuego at lists.linuxfoundation.org
> Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps.
> 
> Question inline below.
> 
> > -----Original Message-----
> > From: Wang Mingyu
> 
> There is no explanation in the body of the commit message, explaining the
> rationale for these changes.  I'm going to need such information to be
> included in the commit body from now on.
> 
> > Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
> > ---
> >  engine/tests/Functional.dovecot/tests/dovecot_logfile.sh | 8 ++++++--
> >  engine/tests/Functional.dovecot/tests/dovecot_ps.sh      | 4 ++--
> >  2 files changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh
> > b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh
> > index 7489103..89fc199 100644
> > --- a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh
> > +++ b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh
> > @@ -5,16 +5,18 @@
> >
> >
> >  test="logfile"
> > -service_name=""
> >
> >  . "./fuego_board_function_lib.sh"
> >
> >  set_init_manager
> > +logger_service=$(detect_logger_service)
> >
> >  exec_service_on_target dovecot stop
> >  rm -f /var/log/mail.log
> >
> > -exec_service_on_target $service_name restart
> > +exec_service_on_target $logger_service restart
> > +
> > +sleep 3
> I'm not sure I'm following this.  Is the board logger service writing the data to
> /var/log/mail.log?  I would have thought that messages going through the
> board's system logger would show up in /var/log/messages.  I'm not familiar
> with dovecot, but is it using the system logger, or doing its own logging to
> /var/log/mail.log?
> 
> I'm just trying to clarify this.
> 
> >
> >  if exec_service_on_target dovecot start  then @@ -24,6 +26,8 @@ else
> >      echo " -> $test: TEST-FAIL"
> >  fi
> >
> > +sleep 3
> > +
> >  if tail /var/log/mail.log | grep "dovecot"
> >  then
> >      echo " -> $test: TEST-PASS"
> > diff --git a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh
> > b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh
> > index 2c627bb..0585cf2 100644
> > --- a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh
> > +++ b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh
> > @@ -19,7 +19,7 @@ else
> >      exit
> >  fi
> >
> > -if ps -N a | grep [d]ovecot
> > +if ps -N a | grep "[/]usr/sbin/dovecot"
> 
> Why is it preferred to include the path?
> 'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'.
> 
> Are there more than one dovecot processes started, and you only want to
> match one?
> 
> >  then
> >      echo " -> get the pid of dovecot."
> >  else
> > @@ -38,7 +38,7 @@ else
> >      exit
> >  fi
> >
> > -if ps -N a | grep [d]ovecot
> > +if ps -N a | grep "[/]usr/sbin/dovecot"
> >  then
> >      echo " -> $test: TEST-FAIL"
> >  else
> > --
> > 1.8.3.1
> 
> 
> 
> 



More information about the Fuego mailing list