Преглед на файлове

oeqa/selftest: verify that devtool can use plugins in other layers

In selftest we want to exercise devtool's ability to use plugins from other
layers, so add a basic command to reverse a string to meta-selftest and a test
in oe-selftest to call it.

(From OE-Core rev: 69f5bbc1041e15691af0b4845e2136957a4846a1)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Ross Burton преди 10 години
родител
ревизия
e191120581
променени са 3 файла, в които са добавени 23 реда и са изтрити 0 реда
  1. 0 0
      meta-selftest/lib/devtool/__init__.py
  2. 11 0
      meta-selftest/lib/devtool/test.py
  3. 12 0
      meta/lib/oeqa/selftest/devtool.py

+ 0 - 0
meta-selftest/lib/devtool/__init__.py


+ 11 - 0
meta-selftest/lib/devtool/test.py

@@ -0,0 +1,11 @@
+import argparse
+
+def selftest_reverse(args, config, basepath, workspace):
+    """Reverse the value passed to verify the plugin is executing."""
+    print args.value[::-1]
+
+def register_commands(subparsers, context):
+    parser_build = subparsers.add_parser('selftest-reverse', help='Reverse value (for selftest)',
+                                         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+    parser_build.add_argument('value', help='Value to reverse')
+    parser_build.set_defaults(func=selftest_reverse)

+ 12 - 0
meta/lib/oeqa/selftest/devtool.py

@@ -1015,3 +1015,15 @@ class DevtoolTests(DevtoolBase):
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+
+    def test_devtool_layer_plugins(self):
+        """Test that devtool can use plugins from other layers.
+
+        This test executes the selftest-reverse command from meta-selftest."""
+
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+
+        s = "Microsoft Made No Profit From Anyone's Zunes Yo"
+        result = runCmd("devtool --quiet selftest-reverse \"%s\"" % s)
+        self.assertEqual(result.output, s[::-1])