ping

On 11/15/2021 4:39 PM, Ryan Long wrote:
ping

On 11/1/2021 5:31 PM, Ryan Long wrote:
ping

-----Original Message-----
From: Ryan Long <ryan.l...@oarcorp.com>
Sent: Wednesday, October 20, 2021 3:06 PM
To: devel@rtems.org
Cc: Ryan Long <ryan.l...@oarcorp.com>
Subject: [rtems-tools] tester: Update jobs configuration

Allow for default_jobs and max_jobs to be specified in the BSP's configuration file.
---
  rtemstoolkit/options.py                            | 45 +++++++++++++---------
  tester/rtems/testing/bsps/beagleboardxm.ini        |  2 +-
  tester/rtems/testing/bsps/beagleboneblack.ini      |  2 +-
  tester/rtems/testing/bsps/imx7.ini                 |  2 +-
  tester/rtems/testing/bsps/mcf5235.ini              |  2 +-
  tester/rtems/testing/bsps/mvme2307.ini             |  2 +-
  tester/rtems/testing/bsps/pc.ini                   |  2 +-
  tester/rtems/testing/bsps/qoriq_e500.ini           |  2 +-
  tester/rtems/testing/bsps/qoriq_e6500_32.ini       |  2 +-
  tester/rtems/testing/bsps/qoriq_e6500_64.ini       |  2 +-
  tester/rtems/testing/bsps/raspberrypi2.ini         |  2 +-
  tester/rtems/testing/bsps/xilinx_versal_vck190.ini |  2 +- .../rtems/testing/bsps/xilinx_zynq_a9_qemu_smp.ini |  2 +-
  tester/rtems/testing/bsps/xilinx_zynq_zc706.ini    |  2 +-
  tester/rtems/testing/bsps/xilinx_zynq_zedboard.ini |  2 +-
  .../testing/bsps/xilinx_zynqmp_ilp32_zu3eg.ini     |  2 +-
  .../testing/bsps/xilinx_zynqmp_lp64_zu3eg.ini      |  2 +-
  tester/rtems/testing/defaults.mc                   |  2 +
  18 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/rtemstoolkit/options.py b/rtemstoolkit/options.py index 5ebe3bc..4b7a93a 100644
--- a/rtemstoolkit/options.py
+++ b/rtemstoolkit/options.py
@@ -102,7 +102,7 @@ class command_line(object):
              '--no-clean':                   'Do not clean up the build tree',               '--always-clean':               'Always clean the build tree, even with an error',               '--keep-going':                 'Do not stop on an error.', -            '--jobs=[0..n,none,half,full]': 'Run with specified number of jobs, default: num CPUs.',
+            '--jobs=[0..n,none,half,full]': 'Run with specified number
+ of jobs (default: defined in configuration file)',
              '--macros file[,file]':         'Macro format files to load after the defaults',               '--log file':                   'Log file where all build output is written to',
          }
@@ -327,6 +327,11 @@ class command_line(object):
          # Handle the jobs for make
          if '_ncpus' not in self.defaults:
              raise error.general('host number of CPUs not set')
+        if self.defaults['default_jobs'] != '0':
+            print(
+                'default_jobs is %d and the default is %d' %
+                (self.defaults['default_jobs'], 0)
+            )
          ncpus = self.jobs(self.defaults['_ncpus'])
          if ncpus > 1:
              self.defaults['_smp_mflags'] = '-j %d' % (ncpus) @@ -427,28 +432,25 @@ class command_line(object):
                      um += [m]
          return um if len(um) else None
  -    def jobs(self, cpus):
+    def jobs(self, num_cpus):
          try:
-            cpus = int(cpus)
+            cpus = int(num_cpus)
          except:
              raise error.general('invalid host cpu value')
          opt_jobs = self.opts['jobs']
          if opt_jobs == 'default':
-            _jobs = self.defaults.get_value('jobs')
-            if _jobs is not None:
-                if _jobs == 'none':
-                    cpus = 0
-                elif _jobs == 'max':
-                    pass
-                elif _jobs == 'half':
-                    cpus = cpus / 2
-                else:
-                    try:
-                        cpus = int(_jobs)
-                    except:
-                        raise error.general('invalid %%{jobs} value: %s' % (_jobs))
+            _jobs = self.defaults.get_value('default_jobs')
+            if _jobs == 'none':
+                cpus = 0
+            elif _jobs == 'max':
+                pass
+            elif _jobs == 'half':
+                cpus = cpus / 2
              else:
-                opt_jobs = 'max'
+                try:
+                    cpus = int(_jobs)
+                except:
+                    raise error.general('invalid %%{jobs} value: %s' %
+ (_jobs))
          if opt_jobs != 'default':
              if opt_jobs == 'none':
                  cpus = 0
@@ -474,7 +476,14 @@ class command_line(object):
                      if not ok:
                          raise error.internal('bad jobs option: %s' % (opt_jobs))
          if cpus <= 0:
-            cpu = 1
+            cpus = 1
+        max_jobs = int(self.defaults.get_value('max_jobs'))
+        if max_jobs == 0:
+            max_jobs = cpus
+        if cpus > max_jobs:
+            raise error.internal(
+                'exceeded maximum number of jobs: %d > %d' % (cpus, max_jobs)
+            )
          return cpus
        def params(self):
diff --git a/tester/rtems/testing/bsps/beagleboardxm.ini b/tester/rtems/testing/bsps/beagleboardxm.ini
index e8a79a6..72e6e8f 100644
--- a/tester/rtems/testing/bsps/beagleboardxm.ini
+++ b/tester/rtems/testing/bsps/beagleboardxm.ini
@@ -36,7 +36,7 @@
  [beagleboardxm]
  bsp        = beagleboardxm
  arch       = arm
-jobs       = 1
+max_jobs   = 1
  tester     = %{_rtscripts}/gdb.cfg
  gdb_script = bsp_gdb_script
  requires   = bsp_tty_dev, bsp_gdb_script
diff --git a/tester/rtems/testing/bsps/beagleboneblack.ini b/tester/rtems/testing/bsps/beagleboneblack.ini
index 4bf850f..346d859 100644
--- a/tester/rtems/testing/bsps/beagleboneblack.ini
+++ b/tester/rtems/testing/bsps/beagleboneblack.ini
@@ -35,7 +35,7 @@
  [beagleboneblack]
  bsp                = beagleboneblack
  arch               = arm
-jobs               = 1
+max_jobs           = 1
  tester             = %{_rtscripts}/tftp.cfg
  test_restarts      = 3
  target_reset_regex = ^No ethernet found.*|BOOTP broadcast 6.*|^ERROR: can.t get kernel image diff --git a/tester/rtems/testing/bsps/imx7.ini b/tester/rtems/testing/bsps/imx7.ini
index 0a56ba8..28dd77f 100644
--- a/tester/rtems/testing/bsps/imx7.ini
+++ b/tester/rtems/testing/bsps/imx7.ini
@@ -35,7 +35,7 @@
  [imx7]
  bsp                = imx7
  arch               = arm
-jobs               = 1
+max_jobs           = 1
  tester             = %{_rtscripts}/tftp.cfg
  test_restarts      = 3
  target_start_regex = Hit any key to stop autoboot:
diff --git a/tester/rtems/testing/bsps/mcf5235.ini b/tester/rtems/testing/bsps/mcf5235.ini
index 00f6a26..5023275 100644
--- a/tester/rtems/testing/bsps/mcf5235.ini
+++ b/tester/rtems/testing/bsps/mcf5235.ini
@@ -34,6 +34,6 @@
  [mcf5235]
  bsp      = mcf5235
  arch     = m68k
-jobs     = 1
+max_jobs = 1
  tester   = %{_rtscripts}/gdb.cfg
  requires = bsp_tty_dev, gdb_script
diff --git a/tester/rtems/testing/bsps/mvme2307.ini b/tester/rtems/testing/bsps/mvme2307.ini
index b142aa9..bb7e15f 100644
--- a/tester/rtems/testing/bsps/mvme2307.ini
+++ b/tester/rtems/testing/bsps/mvme2307.ini
@@ -52,7 +52,7 @@
  [mvme2307]
  bsp                = mvme2307
  arch               = powerpc
-jobs               = 1
+max_jobs           = 1
  test_restarts      = 3
  tester             = %{_rtscripts}/wait.cfg
  target_start_regex = ^Copyright Motorola Inc.*, All Rights Reserved diff --git a/tester/rtems/testing/bsps/pc.ini b/tester/rtems/testing/bsps/pc.ini
index 93a5dae..5f81336 100644
--- a/tester/rtems/testing/bsps/pc.ini
+++ b/tester/rtems/testing/bsps/pc.ini
@@ -31,7 +31,7 @@
  [pc]
  bsp           = pc686
  arch          = i386
-jobs          = 1
+max_jobs      = 1
  tester        = %{_rtscripts}/tftp.cfg
  test_restarts = 3
  requires      = bsp_tty_dev, target_on_command, target_off_command, target_reset_command diff --git a/tester/rtems/testing/bsps/qoriq_e500.ini b/tester/rtems/testing/bsps/qoriq_e500.ini
index 322069b..1756bcd 100644
--- a/tester/rtems/testing/bsps/qoriq_e500.ini
+++ b/tester/rtems/testing/bsps/qoriq_e500.ini
@@ -35,7 +35,7 @@
  [qoriq_e500]
  bsp                = qoriq_e500
  arch               = powerpc
-jobs               = 1
+max_jobs           = 1
  tester             = %{_rtscripts}/tftp.cfg
  test_restarts      = 3
  target_start_regex = U-Boot
diff --git a/tester/rtems/testing/bsps/qoriq_e6500_32.ini b/tester/rtems/testing/bsps/qoriq_e6500_32.ini
index 26ee3ae..daf564e 100644
--- a/tester/rtems/testing/bsps/qoriq_e6500_32.ini
+++ b/tester/rtems/testing/bsps/qoriq_e6500_32.ini
@@ -36,7 +36,7 @@
  [qoriq_e6500_32]
  bsp                = qoriq_e6500_32
  arch               = powerpc
-jobs               = 1
+max_jobs           = 1
  tester             = %{_rtscripts}/tftp.cfg
  test_restarts      = 3
  target_start_regex = U-Boot
diff --git a/tester/rtems/testing/bsps/qoriq_e6500_64.ini b/tester/rtems/testing/bsps/qoriq_e6500_64.ini
index c9b6ab7..e507032 100644
--- a/tester/rtems/testing/bsps/qoriq_e6500_64.ini
+++ b/tester/rtems/testing/bsps/qoriq_e6500_64.ini
@@ -36,7 +36,7 @@
  [qoriq_e6500_64]
  bsp                = qoriq_e6500_64
  arch               = powerpc
-jobs               = 1
+max_jobs           = 1
  tester             = %{_rtscripts}/tftp.cfg
  test_restarts      = 3
  target_start_regex = U-Boot
diff --git a/tester/rtems/testing/bsps/raspberrypi2.ini b/tester/rtems/testing/bsps/raspberrypi2.ini
index e8043ac..f7f3c8c 100644
--- a/tester/rtems/testing/bsps/raspberrypi2.ini
+++ b/tester/rtems/testing/bsps/raspberrypi2.ini
@@ -35,7 +35,7 @@
  [raspberrypi2]
  bsp                = raspberrypi2
  arch               = arm
-jobs               = 1
+max_jobs           = 1
  tester             = %{_rtscripts}/tftp.cfg
  test_restarts      = 3
  target_reset_regex = BOOTP broadcast 6.*|^ERROR: can.t get kernel image diff --git a/tester/rtems/testing/bsps/xilinx_versal_vck190.ini b/tester/rtems/testing/bsps/xilinx_versal_vck190.ini
index 3bdd6be..a7695a7 100644
--- a/tester/rtems/testing/bsps/xilinx_versal_vck190.ini
+++ b/tester/rtems/testing/bsps/xilinx_versal_vck190.ini
@@ -36,7 +36,7 @@
  bsp                = xilinx_versal_vck190
  arch               = aarch64
  tester             = %{_rtscripts}/tftp.cfg
-jobs               = 1
+max_jobs           = 1
  test_restarts      = 3
  target_reset_regex = ^No ethernet found.*|^BOOTP broadcast 6.*|^.+complete\.+ TIMEOUT.*  target_start_regex = .* PSCI Power Domain Map:$|^U-Boot .* diff --git a/tester/rtems/testing/bsps/xilinx_zynq_a9_qemu_smp.ini b/tester/rtems/testing/bsps/xilinx_zynq_a9_qemu_smp.ini
index 4366ffc..b6b39b6 100644
--- a/tester/rtems/testing/bsps/xilinx_zynq_a9_qemu_smp.ini
+++ b/tester/rtems/testing/bsps/xilinx_zynq_a9_qemu_smp.ini
@@ -34,6 +34,6 @@
  [xilinx_zynq_a9_qemu_smp]
  bsp           = xilinx_zynq_a9_qemu
  arch          = arm
-jobs          = half
+default_jobs  = half
  tester        = %{_rtscripts}/qemu.cfg
  bsp_qemu_opts = %{qemu_opts_base} %{qemu_opts_no_net} %{qemu_opts_serial} -M xilinx-zynq-a9 -m 256M -smp cpus=2 diff --git a/tester/rtems/testing/bsps/xilinx_zynq_zc706.ini b/tester/rtems/testing/bsps/xilinx_zynq_zc706.ini
index e543022..844776d 100644
--- a/tester/rtems/testing/bsps/xilinx_zynq_zc706.ini
+++ b/tester/rtems/testing/bsps/xilinx_zynq_zc706.ini
@@ -35,7 +35,7 @@
  [xilinx_zynq_zc706]
  bsp        = xilinx_zynq_zc706
  arch       = arm
-jobs       = 1
+max_jobs   = 1
  tester     = %{_rtscripts}/gdb.cfg
  gdb_script = bsp_gdb_script
  requires   = bsp_tty_dev, bsp_gdb_script
diff --git a/tester/rtems/testing/bsps/xilinx_zynq_zedboard.ini b/tester/rtems/testing/bsps/xilinx_zynq_zedboard.ini
index 14b4d94..5c2451b 100644
--- a/tester/rtems/testing/bsps/xilinx_zynq_zedboard.ini
+++ b/tester/rtems/testing/bsps/xilinx_zynq_zedboard.ini
@@ -36,7 +36,7 @@
  bsp                = xilinx_zynq_zedboard
  arch               = arm
  tester             = %{_rtscripts}/tftp.cfg
-jobs               = 1
+max_jobs           = 1
  test_restarts      = 3
  target_reset_regex = ^No ethernet found.*|^BOOTP broadcast 6.*|^.+complete\.+ TIMEOUT.*  target_start_regex = ^U-Boot SPL .* diff --git a/tester/rtems/testing/bsps/xilinx_zynqmp_ilp32_zu3eg.ini b/tester/rtems/testing/bsps/xilinx_zynqmp_ilp32_zu3eg.ini
index 8c1c839..eefe173 100644
--- a/tester/rtems/testing/bsps/xilinx_zynqmp_ilp32_zu3eg.ini
+++ b/tester/rtems/testing/bsps/xilinx_zynqmp_ilp32_zu3eg.ini
@@ -35,7 +35,7 @@
  bsp                = xilinx_zynqmp_ilp32_zu3eg
  arch               = aarch64
  tester             = %{_rtscripts}/tftp.cfg
-jobs               = 1
+max_jobs           = 1
  test_restarts      = 3
  target_reset_regex = ^No ethernet found.*|^.*: No link\..* target_start_regex = ^.*Xilinx Zynq MP First Stage Boot Loader.* diff --git a/tester/rtems/testing/bsps/xilinx_zynqmp_lp64_zu3eg.ini b/tester/rtems/testing/bsps/xilinx_zynqmp_lp64_zu3eg.ini
index 663e5de..1fa35e5 100644
--- a/tester/rtems/testing/bsps/xilinx_zynqmp_lp64_zu3eg.ini
+++ b/tester/rtems/testing/bsps/xilinx_zynqmp_lp64_zu3eg.ini
@@ -35,7 +35,7 @@
  bsp                = xilinx_zynqmp_lp64_zu3eg
  arch               = aarch64
  tester             = %{_rtscripts}/tftp.cfg
-jobs               = 1
+max_jobs           = 1
  test_restarts      = 3
  target_reset_regex = ^No ethernet found.*|^.*: No link\..* target_start_regex = ^.*Xilinx Zynq MP First Stage Boot Loader.* diff --git a/tester/rtems/testing/defaults.mc b/tester/rtems/testing/defaults.mc
index d3e16a9..830b377 100644
--- a/tester/rtems/testing/defaults.mc
+++ b/tester/rtems/testing/defaults.mc
@@ -116,6 +116,8 @@ __xz:                exe,     required, '/usr/bin/xz'
    # Default settings
  _target:             none,    none,     '%{nil}'
+max_jobs:            none,    none,     '0'
+default_jobs:        none,    none,     '0'
    # Paths
  _rtbase:             none,    none,     '%{_rtdir}'
--
1.8.3.1

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to