Changeset 0a1a680 for src/tests


Ignore:
Timestamp:
Jan 30, 2017, 12:28:04 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
f97b614
Parents:
8804701
Message:

Tests no longer print screen fulls of stack traces when being interrupted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    r8804701 r0a1a680  
    168168
    169169def run_test_instance(t, generate, dry_run, debug) :
    170         # print formated name
    171         name_txt = "%20s  " % t.name
    172 
    173         #run the test instance and collect the result
    174         test_failed, error = run_single_test(t, generate, dry_run, debug)
    175 
    176         # update output based on current action
    177         if generate :
    178                 failed_txt = "ERROR"
    179                 success_txt = "Done"
    180         else :
    181                 failed_txt = "FAILED"
    182                 success_txt = "PASSED"
    183 
    184         #print result with error if needed
    185         text = name_txt + (failed_txt if test_failed else success_txt)
    186         out = sys.stdout
    187         if error :
    188                 text = text + "\n" + error
    189                 out = sys.stderr
    190 
    191         print(text, file = out);
    192         sys.stdout.flush()
    193         sys.stderr.flush()
    194 
    195         return test_failed
     170        try :
     171                # print formated name
     172                name_txt = "%20s  " % t.name
     173
     174                #run the test instance and collect the result
     175                test_failed, error = run_single_test(t, generate, dry_run, debug)
     176
     177                # update output based on current action
     178                if generate :
     179                        failed_txt = "ERROR"
     180                        success_txt = "Done"
     181                else :
     182                        failed_txt = "FAILED"
     183                        success_txt = "PASSED"
     184
     185                #print result with error if needed
     186                text = name_txt + (failed_txt if test_failed else success_txt)
     187                out = sys.stdout
     188                if error :
     189                        text = text + "\n" + error
     190                        out = sys.stderr
     191
     192                print(text, file = out);
     193                sys.stdout.flush()
     194                sys.stderr.flush()
     195                return test_failed
     196       
     197        except KeyboardInterrupt:
     198                test_failed = True
     199
    196200
    197201# run the given list of tests with the given parameters
     
    209213        pool = Pool(jobs)
    210214        try :
    211                 results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run, debug=debug), tests ).get(99999999)
     215                results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run, debug=debug), tests )
     216                results.get(9999)
    212217        except KeyboardInterrupt:
    213218                pool.terminate()
Note: See TracChangeset for help on using the changeset viewer.