All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yi Zhao <yi.zhao@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 2/3] oeqa/runtime/logrotate: fix hardcoded root directory
Date: Thu, 7 Jan 2016 11:29:53 +0800	[thread overview]
Message-ID: <1452137394-333-3-git-send-email-yi.zhao@windriver.com> (raw)
In-Reply-To: <1452137394-333-1-git-send-email-yi.zhao@windriver.com>

Use $HOME instead of /home/root in case user changes the default root
directory by ROOT_HOME

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 meta/lib/oeqa/runtime/logrotate.py |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/runtime/logrotate.py b/meta/lib/oeqa/runtime/logrotate.py
index 86d791c..de300bf 100644
--- a/meta/lib/oeqa/runtime/logrotate.py
+++ b/meta/lib/oeqa/runtime/logrotate.py
@@ -14,9 +14,9 @@ class LogrotateTest(oeRuntimeTest):
 
     @skipUnlessPassed("test_ssh")
     def test_1_logrotate_setup(self):
-        (status, output) = self.target.run('mkdir /home/root/logrotate_dir')
+        (status, output) = self.target.run('mkdir $HOME/logrotate_dir')
         self.assertEqual(status, 0, msg = "Could not create logrotate_dir. Output: %s" % output)
-        (status, output) = self.target.run("sed -i 's#wtmp {#wtmp {\\n    olddir /home/root/logrotate_dir#' /etc/logrotate.conf")
+        (status, output) = self.target.run("sed -i \"s#wtmp {#wtmp {\\n    olddir $HOME/logrotate_dir#\" /etc/logrotate.conf")
         self.assertEqual(status, 0, msg = "Could not write to logrotate.conf file. Status and output: %s and %s)" % (status, output))
 
     @testcase(289)
@@ -24,5 +24,5 @@ class LogrotateTest(oeRuntimeTest):
     def test_2_logrotate(self):
         (status, output) = self.target.run('logrotate -f /etc/logrotate.conf')
         self.assertEqual(status, 0, msg = "logrotate service could not be reloaded. Status and output: %s and %s" % (status, output))
-        output = self.target.run('ls -la /home/root/logrotate_dir/ | wc -l')[1]
-        self.assertTrue(int(output)>=3, msg = "new logfile could not be created. List of files within log directory: %s" %(self.target.run('ls -la /home/root/logrotate_dir')[1]))
+        output = self.target.run('ls -la $HOME/logrotate_dir/ | wc -l')[1]
+        self.assertTrue(int(output)>=3, msg = "new logfile could not be created. List of files within log directory: %s" %(self.target.run('ls -la $HOME/logrotate_dir')[1]))
-- 
1.7.9.5



  parent reply	other threads:[~2016-01-07  3:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07  3:29 [PATCH 0/3] oeqa/runtime: improve some test cases Yi Zhao
2016-01-07  3:29 ` [PATCH 1/3] oeqa/runtime/smart: fix hardcoded root directory Yi Zhao
2016-01-07  3:29 ` Yi Zhao [this message]
2016-01-07  3:29 ` [PATCH 3/3] oeqa/runtime/parselogs: escape special character for grep Yi Zhao
2016-01-07 12:21   ` Burton, Ross
2016-01-08  8:44     ` Yi Zhao
2016-01-08  8:59       ` Burton, Ross
2016-01-12  1:51         ` Yi Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452137394-333-3-git-send-email-yi.zhao@windriver.com \
    --to=yi.zhao@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.