Commit b730b2c1 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

regtest: Limit the number of arguments to 1

It's easier to run poppler-regtest more than once if you need to run
different tests.
parent 5ce045d0
......@@ -26,7 +26,7 @@ import tempfile
class CreateRefs(Command):
name = 'create-refs'
usage_args = '[ options ... ] documents ... '
usage_args = '[ options ... ] tests '
description = 'Create references for tests'
def __init__(self):
......@@ -41,7 +41,7 @@ class CreateRefs(Command):
parser.add_argument('-c', '--checksums-only',
action = 'store_true', dest = 'checksums_only', default = False,
help = 'Leave only checksum files in references dir, other files will be deleted')
parser.add_argument('documents', nargs='*')
parser.add_argument('tests')
def run(self, options):
config = Config()
......@@ -49,17 +49,17 @@ class CreateRefs(Command):
config.checksums_only = options['checksums_only']
t = Timer()
for doc in options['documents']:
if os.path.isdir(doc):
docs_dir = doc
else:
docs_dir = os.path.dirname(doc)
doc = options['tests']
if os.path.isdir(doc):
docs_dir = doc
else:
docs_dir = os.path.dirname(doc)
refs = TestReferences(docs_dir, options['refs_dir'])
if doc == docs_dir:
refs.create_refs()
else:
refs.create_refs_for_file(os.path.basename(doc))
refs = TestReferences(docs_dir, options['refs_dir'])
if doc == docs_dir:
refs.create_refs()
else:
refs.create_refs_for_file(os.path.basename(doc))
print "Refs created in %s" % (t.elapsed_str())
register_command('create-refs', CreateRefs)
......@@ -26,7 +26,7 @@ import tempfile
class RunTests(Command):
name = 'run-tests'
usage_args = '[ options ... ] documents ... '
usage_args = '[ options ... ] tests '
description = 'Run tests for documents'
def __init__(self):
......@@ -44,7 +44,7 @@ class RunTests(Command):
parser.add_argument('--create-diffs',
action = 'store_true', dest = 'create_diffs', default = False,
help = 'Create diff files for failed tests')
parser.add_argument('documents', nargs='*')
parser.add_argument('tests')
def run(self, options):
config = Config()
......@@ -52,18 +52,18 @@ class RunTests(Command):
config.create_diffs = options['create_diffs']
t = Timer()
for doc in options['documents']:
if os.path.isdir(doc):
docs_dir = doc
else:
docs_dir = os.path.dirname(doc)
doc = options['tests']
if os.path.isdir(doc):
docs_dir = doc
else:
docs_dir = os.path.dirname(doc)
tests = TestRun(docs_dir, options['refs_dir'], options['out_dir'])
if doc == docs_dir:
tests.run_tests()
else:
tests.run_test(os.path.basename(doc))
tests.summary()
tests = TestRun(docs_dir, options['refs_dir'], options['out_dir'])
if doc == docs_dir:
tests.run_tests()
else:
tests.run_test(os.path.basename(doc))
tests.summary()
print "Tests run in %s" % (t.elapsed_str())
register_command('run-tests', RunTests)
......@@ -42,7 +42,7 @@ def main(args):
parser = argparse.ArgumentParser(
description = 'Poppler regression tests',
prog = 'poppler-regtest',
usage = '%(prog)s [options ...] command [command-options ...] tests ...',
usage = '%(prog)s [options ...] command [command-options ...] tests',
add_help = False)
parser.add_argument('-h', '--help',
action = HelpAction, nargs = 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment