On Mon, 2009-01-19 at 01:43 +0100, Jiri Palecek > wrote:
> Hello,
> 
> this is the first from the series of minor patches to syslog tests. Parts 
> inspired by CAI Qian's remarks.
> 
> Resend due to line-wrapping problems.
> 
>  - Check for existence of the backup file before moving it back
>  - Do not restart syslog daemon, if syslog command was not found
> 
> Signed-off-by: Jiri Palecek <[email protected]>

Thanks to both of you.

Regards--
Subrata

> ---
>  testcases/kernel/syscalls/syslog/syslog01 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog02 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog03 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog04 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog05 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog06 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog07 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog08 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog09 |    8 +++++---
>  testcases/kernel/syscalls/syslog/syslog10 |    9 +++++----
>  10 files changed, 50 insertions(+), 31 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/syslog/syslog01 
> b/testcases/kernel/syscalls/syslog/syslog01
> index e5746cc..53923a2 100755
> --- a/testcases/kernel/syscalls/syslog/syslog01
> +++ b/testcases/kernel/syscalls/syslog/syslog01
> @@ -53,11 +53,13 @@ cleanup()
>   fi
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
> 
>   
> 
> diff --git a/testcases/kernel/syscalls/syslog/syslog02 
> b/testcases/kernel/syscalls/syslog/syslog02
> index 9fe819d..49342b9 100755
> --- a/testcases/kernel/syscalls/syslog/syslog02
> +++ b/testcases/kernel/syscalls/syslog/syslog02
> @@ -47,11 +47,13 @@ cleanup()
>    fi
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
> 
>    sleep 2
> 
> diff --git a/testcases/kernel/syscalls/syslog/syslog03 
> b/testcases/kernel/syscalls/syslog/syslog03
> index 32972fb..186f9ff 100755
> --- a/testcases/kernel/syscalls/syslog/syslog03
> +++ b/testcases/kernel/syscalls/syslog/syslog03
> @@ -50,11 +50,13 @@ else
>  fi
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
>  sleep 2
> 
>  exit $status_flag
> diff --git a/testcases/kernel/syscalls/syslog/syslog04 
> b/testcases/kernel/syscalls/syslog/syslog04
> index c011fba..b1d2d87 100755
> --- a/testcases/kernel/syscalls/syslog/syslog04
> +++ b/testcases/kernel/syscalls/syslog/syslog04
> @@ -48,11 +48,13 @@ else
>  fi
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
> 
>  sleep 2
> 
> diff --git a/testcases/kernel/syscalls/syslog/syslog05 
> b/testcases/kernel/syscalls/syslog/syslog05
> index f69657e..0d3d8da 100755
> --- a/testcases/kernel/syscalls/syslog/syslog05
> +++ b/testcases/kernel/syscalls/syslog/syslog05
> @@ -53,11 +53,13 @@ else
>  fi
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
> 
>   sleep 2
> 
> diff --git a/testcases/kernel/syscalls/syslog/syslog06 
> b/testcases/kernel/syscalls/syslog/syslog06
> index 46fe65b..65aa48f 100755
> --- a/testcases/kernel/syscalls/syslog/syslog06
> +++ b/testcases/kernel/syscalls/syslog/syslog06
> @@ -53,11 +53,13 @@ fi
> 
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
>   
>  sleep 2
> 
> diff --git a/testcases/kernel/syscalls/syslog/syslog07 
> b/testcases/kernel/syscalls/syslog/syslog07
> index daecfb2..cac678e 100755
> --- a/testcases/kernel/syscalls/syslog/syslog07
> +++ b/testcases/kernel/syscalls/syslog/syslog07
> @@ -54,11 +54,13 @@ cleanup()
>    fi
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart syslog"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
> 
> 
>    sleep 2
> diff --git a/testcases/kernel/syscalls/syslog/syslog08 
> b/testcases/kernel/syscalls/syslog/syslog08
> index e6b54c8..6693d57 100755
> --- a/testcases/kernel/syscalls/syslog/syslog08
> +++ b/testcases/kernel/syscalls/syslog/syslog08
> @@ -53,11 +53,13 @@ else
>  fi
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
> 
>  sleep 2
>  exit $status_flag
> diff --git a/testcases/kernel/syscalls/syslog/syslog09 
> b/testcases/kernel/syscalls/syslog/syslog09
> index 425b888..1a76613 100755
> --- a/testcases/kernel/syscalls/syslog/syslog09
> +++ b/testcases/kernel/syscalls/syslog/syslog09
> @@ -50,11 +50,13 @@ else
>  fi
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv "$CONFIG_FILE.ltpback" "$CONFIG_FILE"
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      "$syslog_cmd" restart 2>&1 1>/dev/null
> +  }
> 
>  sleep 2
> 
> diff --git a/testcases/kernel/syscalls/syslog/syslog10 
> b/testcases/kernel/syscalls/syslog/syslog10
> index 129150c..ed9d283 100755
> --- a/testcases/kernel/syscalls/syslog/syslog10
> +++ b/testcases/kernel/syscalls/syslog/syslog10
> @@ -54,12 +54,13 @@ cleanup()
> 
> 
>  #Restore syslog.conf
> -  mv $CONFIG_FILE.ltpback $CONFIG_FILE
> +  [ -f "$CONFIG_FILE.ltpback" ] && mv $CONFIG_FILE.ltpback $CONFIG_FILE
> 
>  #Restart syslog
> -  tst_resm TINFO "restart $syslog_cmd"
> -  $syslog_cmd restart 2>&1 1>/dev/null
> -
> +  [ -x "$syslog_cmd" ] && {
> +      tst_resm TINFO "restart $syslog_cmd"
> +      $syslog_cmd restart 2>&1 1>/dev/null
> +  }
>   
>    sleep 2
> 


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to