Skip to content

Commit

Permalink
Add -r option to fbt_run
Browse files Browse the repository at this point in the history
  • Loading branch information
pcisar committed Mar 5, 2021
1 parent 443e31f commit f627816
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions fbtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from fdb.ibase import DB_CHAR_SET_NAME_TO_PYTHON_ENCODING_MAP
from mako.template import Template
from mako.lookup import TemplateLookup
from argparse import ArgumentParser
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from time import time
from xml.sax import saxutils
import datetime
Expand Down Expand Up @@ -2523,12 +2523,12 @@ def run_tests(self,options):
else:
expectations = None
if options.rerun:
last_results = RunResults.load(os.path.join(os.getcwd(),'results.trf'))
last_results = RunResults.load(options.results)
run_ids = [r.id for r in last_results.results.values() if r.kind == Result.TEST and
r.outcome != Result.PASS]
run_list = list(itertools.imap(repository.get_test, run_ids))
elif options.untested:
last_results = RunResults.load(os.path.join(os.getcwd(),'results.trf'))
last_results = RunResults.load(options.results)
run_ids = [r.id for r in last_results.results.values() if r.kind == Result.TEST and
r.outcome == Result.UNTESTED]
run_list = list(itertools.imap(repository.get_test, run_ids))
Expand All @@ -2553,14 +2553,15 @@ def run_tests(self,options):
else:
results = runner.run(run_list,skip_tests,verbosity,expectations=expectations)
if not (options.rerun or options.untested):
results.dump(os.path.join(os.getcwd(),'results.trf'))
results.dump(options.results)
elif options.update:
last_results.results.update(results.results)
last_results.dump(os.path.join(os.getcwd(),'results.trf'))
last_results.dump(options.results)
if options.archive:
repository.result_archive.store(results)
if options.xunit:
results.save_xunit(os.path.join(os.getcwd(),'results.xml'))
base, _ = os.path.splitext(options.results)
results.save_xunit(base + '.xml')
else:
print ('Nothing to run')
if not runner.all_passed:
Expand Down Expand Up @@ -3264,33 +3265,35 @@ def run_tests():
Test results file to be used as expeted outcomes
"""
parser = ArgumentParser()
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument('name',nargs='?',default=None,help="Suite or test name")
parser.add_argument('-b','--bin-dir',help="Directory where Firebird binaries tools are")
parser.add_argument('-d','--db-dir',help="Directory to use for test databases")
parser.add_argument('-b','--bin-dir',metavar='PATH',help="Directory where Firebird binaries tools are")
parser.add_argument('-d','--db-dir',metavar='PATH',help="Directory to use for test databases")
parser.add_argument('--archive',action='store_true',help="Save last run results to archive")
parser.add_argument('--rerun',action='store_true',help="Run only tests that don't PASSed in last run")
parser.add_argument('--untested',action='store_true',help="Run only tests that were UNTESTED in last run")
parser.add_argument('-v','--verbose',action='store_true',help="Be more verbose")
parser.add_argument('--verbosity',type=int,choices=[0,1,2],default=1,help="Set verbosity; --verbosity=2 is the same as -v")
parser.add_argument('-q','--quiet',action='store_true',help="Be less verbose")
parser.add_argument('-x','--xunit',action='store_true',help="Provides test results also in the standard XUnit XML format")
parser.add_argument('-e','--expect',type=str,metavar="FILENAME",help="Test results file to be used as expeted outcomes")
parser.add_argument('-e','--expect',type=str,metavar="FILE",help="Test results file to be used as expeted outcomes")
if rpyc_available:
parser.add_argument('--remote',action='store_true',help="Connect to remote fbtest server")

parser.add_argument('-u','--update',action='store_true',help="Update last run results with re-run results")
parser.add_argument('-w','--password',help="SYSDBA password")
parser.add_argument('-o','--host',help="Remote Firebird or fbtest host machine identification")
parser.add_argument('-p','--person',help="QA person name")
parser.add_argument('-a','--arch',help="Firebird architecture: SS, CS, SC, EM")
parser.add_argument('-s','--sequence',type=int,help="Run sequence number for this target")
parser.add_argument('-k','--skip',help="Suite or test name or name of file with suite/test names to skip")
parser.add_argument('-c','--client',help="Use specified Firebird client library")
parser.add_argument('-t','--temp',help="Directory for temporary files")
parser.add_argument('-p','--person',metavar='NAME',help="QA person name")
parser.add_argument('-a','--arch',metavar='SPEC',help="Firebird architecture: SS, CS, SC, EM")
parser.add_argument('-s','--sequence',metavar='NUM',type=int,help="Run sequence number for this target")
parser.add_argument('-k','--skip',metavar='NAME',help="Suite or test name or name of file with suite/test names to skip")
parser.add_argument('-c','--client',metavar='FILE',help="Use specified Firebird client library")
parser.add_argument('-t','--temp',metavar='PATH',help="Directory for temporary files")
parser.add_argument('-r','--results',metavar='FILE',help="Result file")
parser.set_defaults(rerun=False,untested=False,update=False,server=False,register=False,
remote=False,host='localhost',password='masterkey',
sequence=1,arch='SS',person=UNKNOWN)
sequence=1,arch='SS',person=UNKNOWN,
results=os.path.join(os.getcwd(),'results.trf'))

script_runner.run_tests(parser.parse_args())

Expand Down

0 comments on commit f627816

Please sign in to comment.