[poppler] regtest/main.py

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sat Dec 8 09:58:41 PST 2012


 regtest/main.py |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 8cd5cae953de374276c11711dc106de15c8dcad0
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sat Dec 8 18:57:07 2012 +0100

    regtest: Use the number of cpus as default number of worker threads

diff --git a/regtest/main.py b/regtest/main.py
index 7b42f48..41ce454 100644
--- a/regtest/main.py
+++ b/regtest/main.py
@@ -41,6 +41,8 @@ class HelpAction(argparse.Action):
         sys.exit(0)
 
 def main(args):
+    n_cpus = cpu_count()
+
     parser = argparse.ArgumentParser(
         description = 'Poppler regression tests',
         prog = 'poppler-regtest',
@@ -64,8 +66,8 @@ def main(args):
                         action = 'store', dest = 'skipped_file',
                         help = 'File containing tests to skip')
     parser.add_argument('-t', '--threads',
-                        action = 'store', dest = 'threads', type = int, default = 1,
-                        help = 'Number of worker threads')
+                        action = 'store', dest = 'threads', type = int, default = n_cpus,
+                        help = 'Number of worker threads (Default: %d)' % n_cpus)
 
     ns, args = parser.parse_known_args(args)
     if not args:
@@ -75,7 +77,7 @@ def main(args):
     c = Config(vars(ns))
 
     if c.threads <= 0:
-        c.threads = cpu_count() - c.threads
+        c.threads = n_cpus - c.threads
 
     try:
         commands.run(args)


More information about the poppler mailing list