poky: refresh master: 8217b477a1..4e511f0abc

Update poky to master HEAD.

Adrian Bunk (1):
      bind: upgrade 9.11.5 -> 9.11.5-P4

Alexey Brodkin (1):
      busybox: Enable domain search list support

Andre Rosa (2):
      lib/oe/utils: Make prune_suffix prune a suffix
      bitbake: utils: Make prune_suffix prune a suffix

Andreas Müller (1):
      patch/insane: Rework patch fuzz handling

Bruce Ashfield (8):
      poky-tiny: set 5.0 as the preferred kernel
      linux-yocto-rt/4.19: fix duplicate TIF_NEED_RESCHED_LAZY
      linux-yocto/5.0: update CGL audit configuration fragment
      linux-yocto-tiny/4.18: point KBRANCH to 4.18
      linux-yocto/4.18: update to v4.18.33
      qemumips: Enable the poweroff driver
      linux-yocto/5.0: tweak qemuarm -tiny configuration
      linux-yocto/4.18: remove versioned recipes

Gianfranco Costamagna (1):
      kernel-dev, sdk-manual: Unified question spacing

Khem Raj (2):
      libgcc: Create linux-musleabihf and linux-gnueabihf symlinks
      Revert "mdadm: fix gcc8 maybe-uninitialized/format-overflow warning"

Mark Asselstine (2):
      go.bbclass: Export more GO* environment variables
      goarch.bbclass: use MACHINEOVERRIDES and simplify go_map_arm()

Nathan Rossi (3):
      cmake-native: Enable ccmake by default and depend on ncurses
      ccmake.bbclass: Create a cml1 style class for the CMake curses UI
      devtool: standard: Handle exporting generated config fragments

Nikhil Pal Singh (1):
      cmake: Support Eclipse and other cmake generators

Ovidiu Panait (2):
      xf86-video-vesa: Refuse to run on UEFI machines
      ghostscript: Fix 3 CVEs

Randy MacLeod (1):
      autoconf: update runtime perl module dependencies

Richard Purdie (4):
      openssh/util-linux/python*: Ensure ptest output is unbuffered
      ptest-runner: Add several logging fixes
      oeqa/utils/qemurunner: Fix typo in previous commit
      linux-yocto: Drop 4.18 kernel

Robert Yang (1):
      sstate.bbclass: Use bb.utils.to_boolean() for BB_NO_NETWORK

Ross Burton (2):
      sanity: clarify error message if TMPDIR moves
      insane: fix gettext dependency warning

Scott Rifenbark (2):
      ref-manual: Updated BB_GENERATE_MIRROR_TARBALLS
      overview-manual: Fixed broken link to pseudo.

Tomasz Meresiński (1):
      systemd: fix predictable network interface names in initrd

Yeoh Ee Peng (2):
      resulttool/manualexecution: Enable configuration options selection
      resulttool/manualexecution: Enable creation of configuration option file

Change-Id: I988df9d6bf0dfdeaa517960fb744c7388f791cf6
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/poky/scripts/lib/resulttool/manualexecution.py b/poky/scripts/lib/resulttool/manualexecution.py
index c94f981..12ef90d 100755
--- a/poky/scripts/lib/resulttool/manualexecution.py
+++ b/poky/scripts/lib/resulttool/manualexecution.py
@@ -24,6 +24,11 @@
     with open(file, "r") as f:
         return json.load(f)
 
+def write_json_file(f, json_data):
+    os.makedirs(os.path.dirname(f), exist_ok=True)
+    with open(f, 'w') as filedata:
+        filedata.write(json.dumps(json_data, sort_keys=True, indent=4))
+
 class ManualTestRunner(object):
 
     def _get_testcases(self, file):
@@ -38,7 +43,21 @@
             print('Only lowercase alphanumeric, hyphen and dot are allowed. Please try again')
         return output
 
-    def _create_config(self):
+    def _get_available_config_options(self, config_options, test_module, target_config):
+        avail_config_options = None
+        if test_module in config_options:
+            avail_config_options = config_options[test_module].get(target_config)
+        return avail_config_options
+
+    def _choose_config_option(self, options):
+        while True:
+            output = input('{} = '.format('Option index number'))
+            if output in options:
+                break
+            print('Only integer index inputs from above available configuration options are allowed. Please try again.')
+        return options[output]
+
+    def _create_config(self, config_options):
         from oeqa.utils.metadata import get_layers
         from oeqa.utils.commands import get_bb_var
         from resulttool.resultutils import store_map
@@ -54,11 +73,22 @@
 
         extra_config = set(store_map['manual']) - set(self.configuration)
         for config in sorted(extra_config):
-            print('---------------------------------------------')
-            print('This is configuration #%s. Please provide configuration value(use "None" if not applicable).' % config)
-            print('---------------------------------------------')
-            value_conf = self._get_input('Configuration Value')
-            print('---------------------------------------------\n')
+            avail_config_options = self._get_available_config_options(config_options, self.test_module, config)
+            if avail_config_options:
+                print('---------------------------------------------')
+                print('These are available configuration #%s options:' % config)
+                print('---------------------------------------------')
+                for option, _ in sorted(avail_config_options.items(), key=lambda x: int(x[0])):
+                    print('%s: %s' % (option, avail_config_options[option]))
+                print('Please select configuration option, enter the integer index number.')
+                value_conf = self._choose_config_option(avail_config_options)
+                print('---------------------------------------------\n')
+            else:
+                print('---------------------------------------------')
+                print('This is configuration #%s. Please provide configuration value(use "None" if not applicable).' % config)
+                print('---------------------------------------------')
+                value_conf = self._get_input('Configuration Value')
+                print('---------------------------------------------\n')
             self.configuration[config] = value_conf
 
     def _create_result_id(self):
@@ -99,9 +129,12 @@
         basepath = os.environ['BUILDDIR']
         self.write_dir = basepath + '/tmp/log/manual/'
 
-    def run_test(self, file):
+    def run_test(self, file, config_options_file):
         self._get_testcases(file)
-        self._create_config()
+        config_options = {}
+        if config_options_file:
+            config_options = load_json_file(config_options_file)
+        self._create_config(config_options)
         self._create_result_id()
         self._create_write_dir()
         test_results = {}
@@ -111,9 +144,54 @@
             test_results.update(test_result)
         return self.configuration, self.result_id, self.write_dir, test_results
 
+    def _get_true_false_input(self, input_message):
+        yes_list = ['Y', 'YES']
+        no_list = ['N', 'NO']
+        while True:
+            more_config_option = input(input_message).upper()
+            if more_config_option in yes_list or more_config_option in no_list:
+                break
+            print('Invalid input!')
+        if more_config_option in no_list:
+            return False
+        return True
+
+    def make_config_option_file(self, logger, manual_case_file, config_options_file):
+        config_options = {}
+        if config_options_file:
+            config_options = load_json_file(config_options_file)
+        new_test_module = os.path.basename(manual_case_file).split('.')[0]
+        print('Creating configuration options file for test module: %s' % new_test_module)
+        new_config_options = {}
+
+        while True:
+            config_name = input('\nPlease provide test configuration to create:\n').upper()
+            new_config_options[config_name] = {}
+            while True:
+                config_value = self._get_input('Configuration possible option value')
+                config_option_index = len(new_config_options[config_name]) + 1
+                new_config_options[config_name][config_option_index] = config_value
+                more_config_option = self._get_true_false_input('\nIs there more configuration option input: (Y)es/(N)o\n')
+                if not more_config_option:
+                    break
+            more_config = self._get_true_false_input('\nIs there more configuration to create: (Y)es/(N)o\n')
+            if not more_config:
+                break
+
+        if new_config_options:
+            config_options[new_test_module] = new_config_options
+        if not config_options_file:
+            self._create_write_dir()
+            config_options_file = os.path.join(self.write_dir, 'manual_config_options.json')
+        write_json_file(config_options_file, config_options)
+        logger.info('Configuration option file created at %s' % config_options_file)
+
 def manualexecution(args, logger):
     testrunner = ManualTestRunner()
-    get_configuration, get_result_id, get_write_dir, get_test_results = testrunner.run_test(args.file)
+    if args.make_config_options_file:
+        testrunner.make_config_option_file(logger, args.file, args.config_options_file)
+        return 0
+    get_configuration, get_result_id, get_write_dir, get_test_results = testrunner.run_test(args.file, args.config_options_file)
     resultjsonhelper = OETestResultJSONHelper()
     resultjsonhelper.dump_testresult_file(get_write_dir, get_configuration, get_result_id, get_test_results)
     return 0
@@ -125,3 +203,7 @@
                                          group='manualexecution')
     parser_build.set_defaults(func=manualexecution)
     parser_build.add_argument('file', help='specify path to manual test case JSON file.Note: Please use \"\" to encapsulate the file path.')
+    parser_build.add_argument('-c', '--config-options-file', default='',
+                              help='the config options file to import and used as available configuration option selection or make config option file')
+    parser_build.add_argument('-m', '--make-config-options-file', action='store_true',
+                              help='make the configuration options file based on provided inputs')