[OE-core] [OE-Core][master][PATCH 2/2] oeselftest: devtool reset --remove-work command

Sai Hari Chandana Kalluri chandana.kalluri at xilinx.com
Tue Nov 26 19:43:26 UTC 2019


Add oeselftest for devtool reset command. DevtoolResetTests class can be used
to test devtool reset command behaviour wrt to source directory in workspace.

The first test test_devtool_reset_package will verify if the source directory
is present for a package once the workspace is reset.

Example usage: oeselftest -r
devtool.DevtoolResetTests.test_devtool_reset_package

The second test test_devtool_reset_remove_work_package will verify if the
source directory is cleaned up during workspace reset.

Example usage: oeselftest -r
devtool.DevtoolResetTests.test_devtool_reset_remove_work_package

Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri at xilinx.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 57e6662..f6093c0 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -1777,3 +1777,52 @@ class DevtoolUpgradeTests(DevtoolBase):
         #Step 4.5
         checkmodconfg = runCmd("grep %s %s" % (modconfopt, codeconfigfile))
         self.assertEqual(0,checkmodconfg.status,'Modification to configuration file failed')
+
+class DevtoolResetTests(DevtoolBase):
+    def test_devtool_reset_package(self):
+        """
+        Summary:        The purpose of this test case is to verify that
+                        devtool reset cleans the workspace without
+                        removing the source directory.
+        Dependencies:   NA
+        Steps:          1. Use devtool modify mdadm to extract source to workspace.
+                        2. Use devtool reset mdadm to verify that workspace is reset
+                        by clearing the sysroot and the append file. But source folder
+                        is not removed by default.
+        Expected:       devtool reset by default doesnt clean the source folder of the
+                        package and the user is forced to manual remove it.
+        """
+        # Extract a recipe
+        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(tempdir)
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+        sourcedir=os.path.join(os.path.join(self.workspacedir,"sources"),"mdadm")
+        result = runCmd('devtool modify mdadm')
+        result = runCmd('devtool reset mdadm')
+        self.assertTrue('Leaving source tree', result.output)
+        self.assertExists(sourcedir,'the source directory is missing when it should be present')
+
+    def test_devtool_reset_remove_work_package(self):
+        """
+        Summary:        The purpose of this test case is to verify that
+                        devtool reset -r cleans the workspace as well as
+                        removes the source directory.
+        Dependencies:   NA
+        Steps:          1. Use devtool modify mdadm to extract source to workspace.
+                        2. Use devtool reset --remove-work mdadm to verify that workspace is reset
+                        by clearing the sysroot and the append file and source folder
+                        removed.
+        Expected:       devtool reset --remove-work will clean the source folder of the
+                        package along with the appendfile and sysroot.
+        """
+        # Extract a recipe
+        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(tempdir)
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+        sourcedir=os.path.join(os.path.join(self.workspacedir,"sources"),"mdadm")
+        result = runCmd('devtool modify mdadm')
+        result = runCmd('devtool reset -r mdadm')
+        self.assertTrue('Removing source tree', result.output)
+        self.assertNotExists(sourcedir,'the source directory is present when it should have been removed')
-- 
2.7.4



More information about the Openembedded-core mailing list