Patchwork [21/21] lib/oeqa: add a restart method for base class and use it for build tests

login
register
mail settings
Submitter Stanacar, StefanX
Date Aug. 23, 2013, 3:31 p.m.
Message ID <6d7bb8409eb99b415d2500c5146a6b0c7eac2e7f.1377269486.git.stefanx.stanacar@intel.com>
Download mbox | patch
Permalink /patch/56405/
State New
Headers show

Comments

Stanacar, StefanX - Aug. 23, 2013, 3:31 p.m.
This can be used by tests to restart the target
(useful for passing extra qemuparams, like more RAM)

Build projects like cvs/iptables can take 15min+ on
qemu targets with the default RAM, and sudoku fails
with out of memory, so use this there.

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
 meta/lib/oeqa/oetest.py                | 7 +++++++
 meta/lib/oeqa/runtime/buildcvs.py      | 2 ++
 meta/lib/oeqa/runtime/buildiptables.py | 2 ++
 meta/lib/oeqa/runtime/buildsudoku.py   | 2 ++
 4 files changed, 13 insertions(+)
Paul Eggleton - Aug. 23, 2013, 3:41 p.m.
On Friday 23 August 2013 18:31:01 Stefan Stanacar wrote:
> This can be used by tests to restart the target
> (useful for passing extra qemuparams, like more RAM)
> 
> Build projects like cvs/iptables can take 15min+ on
> qemu targets with the default RAM, and sudoku fails
> with out of memory, so use this there.
> 
> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
> ---
>  meta/lib/oeqa/oetest.py                | 7 +++++++
>  meta/lib/oeqa/runtime/buildcvs.py      | 2 ++
>  meta/lib/oeqa/runtime/buildiptables.py | 2 ++
>  meta/lib/oeqa/runtime/buildsudoku.py   | 2 ++
>  4 files changed, 13 insertions(+)
> 
> diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
> index e694c0b..c9dc5dc 100644
> --- a/meta/lib/oeqa/oetest.py
> +++ b/meta/lib/oeqa/oetest.py
> @@ -81,6 +81,13 @@ class oeRuntimeTest(unittest.TestCase):
>          else:
>              return False
> 
> +    @classmethod
> +    def restartTarget(self,params=None):
> +
> +        if oeRuntimeTest.tc.qemu.restart(params):
> +            oeRuntimeTest.tc.target.host = oeRuntimeTest.tc.qemu.ip
> +        else:
> +            raise Exception("Restarting target failed")
> 
> 
>  def getmodule(pos=2):
> diff --git a/meta/lib/oeqa/runtime/buildcvs.py
> b/meta/lib/oeqa/runtime/buildcvs.py index 9bf764d..f024dfa 100644
> --- a/meta/lib/oeqa/runtime/buildcvs.py
> +++ b/meta/lib/oeqa/runtime/buildcvs.py
> @@ -10,6 +10,7 @@ class BuildCvsTest(oeRuntimeTest):
> 
>      @classmethod
>      def setUpClass(self):
> +        self.restartTarget("-m 512")
>          self.project = TargetBuildProject(oeRuntimeTest.tc.target,
>                         
> "http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2"
> ) self.project.download_archive()
> @@ -28,3 +29,4 @@ class BuildCvsTest(oeRuntimeTest):
>      @classmethod
>      def tearDownClass(self):
>          self.project.clean()
> +        self.restartTarget()
> diff --git a/meta/lib/oeqa/runtime/buildiptables.py
> b/meta/lib/oeqa/runtime/buildiptables.py index 50faf5d..88ece3b 100644
> --- a/meta/lib/oeqa/runtime/buildiptables.py
> +++ b/meta/lib/oeqa/runtime/buildiptables.py
> @@ -10,6 +10,7 @@ class BuildIptablesTest(oeRuntimeTest):
> 
>      @classmethod
>      def setUpClass(self):
> +        self.restartTarget("-m 512")
>          self.project = TargetBuildProject(oeRuntimeTest.tc.target,
>                         
> "http://netfilter.org/projects/iptables/files/iptables-1.4.13.tar.bz2")
> self.project.download_archive()
> @@ -28,3 +29,4 @@ class BuildIptablesTest(oeRuntimeTest):
>      @classmethod
>      def tearDownClass(self):
>          self.project.clean()
> +        self.restartTarget()
> diff --git a/meta/lib/oeqa/runtime/buildsudoku.py
> b/meta/lib/oeqa/runtime/buildsudoku.py index 61dc1ff..0a7306d 100644
> --- a/meta/lib/oeqa/runtime/buildsudoku.py
> +++ b/meta/lib/oeqa/runtime/buildsudoku.py
> @@ -10,6 +10,7 @@ class SudokuTest(oeRuntimeTest):
> 
>      @classmethod
>      def setUpClass(self):
> +        self.restartTarget("-m 512")
>          self.project = TargetBuildProject(oeRuntimeTest.tc.target,
>                         
> "http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudok
> u-savant-1.3/sudoku-savant-1.3.tar.bz2") self.project.download_archive()
> @@ -25,3 +26,4 @@ class SudokuTest(oeRuntimeTest):
>      @classmethod
>      def tearDownClass(self):
>          self.project.clean()
> +        self.restartTarget()

Could you please you move the function addition earlier in the series and 
merge the test changes into the earlier commits that added them?

Thanks,
Paul

Patch

diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index e694c0b..c9dc5dc 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -81,6 +81,13 @@  class oeRuntimeTest(unittest.TestCase):
         else:
             return False
 
+    @classmethod
+    def restartTarget(self,params=None):
+
+        if oeRuntimeTest.tc.qemu.restart(params):
+            oeRuntimeTest.tc.target.host = oeRuntimeTest.tc.qemu.ip
+        else:
+            raise Exception("Restarting target failed")
 
 
 def getmodule(pos=2):
diff --git a/meta/lib/oeqa/runtime/buildcvs.py b/meta/lib/oeqa/runtime/buildcvs.py
index 9bf764d..f024dfa 100644
--- a/meta/lib/oeqa/runtime/buildcvs.py
+++ b/meta/lib/oeqa/runtime/buildcvs.py
@@ -10,6 +10,7 @@  class BuildCvsTest(oeRuntimeTest):
 
     @classmethod
     def setUpClass(self):
+        self.restartTarget("-m 512")
         self.project = TargetBuildProject(oeRuntimeTest.tc.target,
                         "http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2")
         self.project.download_archive()
@@ -28,3 +29,4 @@  class BuildCvsTest(oeRuntimeTest):
     @classmethod
     def tearDownClass(self):
         self.project.clean()
+        self.restartTarget()
diff --git a/meta/lib/oeqa/runtime/buildiptables.py b/meta/lib/oeqa/runtime/buildiptables.py
index 50faf5d..88ece3b 100644
--- a/meta/lib/oeqa/runtime/buildiptables.py
+++ b/meta/lib/oeqa/runtime/buildiptables.py
@@ -10,6 +10,7 @@  class BuildIptablesTest(oeRuntimeTest):
 
     @classmethod
     def setUpClass(self):
+        self.restartTarget("-m 512")
         self.project = TargetBuildProject(oeRuntimeTest.tc.target,
                         "http://netfilter.org/projects/iptables/files/iptables-1.4.13.tar.bz2")
         self.project.download_archive()
@@ -28,3 +29,4 @@  class BuildIptablesTest(oeRuntimeTest):
     @classmethod
     def tearDownClass(self):
         self.project.clean()
+        self.restartTarget()
diff --git a/meta/lib/oeqa/runtime/buildsudoku.py b/meta/lib/oeqa/runtime/buildsudoku.py
index 61dc1ff..0a7306d 100644
--- a/meta/lib/oeqa/runtime/buildsudoku.py
+++ b/meta/lib/oeqa/runtime/buildsudoku.py
@@ -10,6 +10,7 @@  class SudokuTest(oeRuntimeTest):
 
     @classmethod
     def setUpClass(self):
+        self.restartTarget("-m 512")
         self.project = TargetBuildProject(oeRuntimeTest.tc.target,
                         "http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2")
         self.project.download_archive()
@@ -25,3 +26,4 @@  class SudokuTest(oeRuntimeTest):
     @classmethod
     def tearDownClass(self):
         self.project.clean()
+        self.restartTarget()