@@ -401,69 +401,82 @@ println("Testing finished in $elapsed")
401401
402402# construct a testset to render the test results
403403o_ts = Test. DefaultTestSet (" Overall" )
404- Test. push_testset (o_ts)
405- completed_tests = Set {String} ()
406- for (testname, (resp,)) in results
407- push! (completed_tests, testname)
408- if isa (resp, Test. DefaultTestSet)
409- Test. push_testset (resp)
410- Test. record (o_ts, resp)
411- Test. pop_testset ()
412- elseif isa (resp, Tuple{Int,Int})
413- fake = Test. DefaultTestSet (testname)
414- for i in 1 : resp[1 ]
415- Test. record (fake, Test. Pass (:test , nothing , nothing , nothing , nothing ))
416- end
417- for i in 1 : resp[2 ]
418- Test. record (fake, Test. Broken (:test , nothing ))
419- end
420- Test. push_testset (fake)
421- Test. record (o_ts, fake)
422- Test. pop_testset ()
423- elseif isa (resp, RemoteException) && isa (resp. captured. ex, Test. TestSetException)
424- println (" Worker $(resp. pid) failed running test $(testname) :" )
425- Base. showerror (stdout , resp. captured)
426- println ()
427- fake = Test. DefaultTestSet (testname)
428- for i in 1 : resp. captured. ex. pass
429- Test. record (fake, Test. Pass (:test , nothing , nothing , nothing , nothing ))
430- end
431- for i in 1 : resp. captured. ex. broken
432- Test. record (fake, Test. Broken (:test , nothing ))
433- end
434- for t in resp. captured. ex. errors_and_fails
435- Test. record (fake, t)
436- end
437- Test. push_testset (fake)
438- Test. record (o_ts, fake)
439- Test. pop_testset ()
404+ function with_testset (f, testset)
405+ @static if VERSION >= v " 1.13.0-DEV.1044"
406+ Test. @with_testset testset f ()
440407 else
441- if ! isa (resp, Exception)
442- resp = ErrorException (string (" Unknown result type : " , typeof (resp)))
408+ Test. push_testset (testset)
409+ try
410+ f ()
411+ finally
412+ Test. pop_testset ()
443413 end
444- # If this test raised an exception that is not a remote testset exception,
445- # i.e. not a RemoteException capturing a TestSetException that means
446- # the test runner itself had some problem, so we may have hit a segfault,
447- # deserialization errors or something similar. Record this testset as Errored.
448- fake = Test. DefaultTestSet (testname)
449- Test. record (fake, Test. Error (:nontest_error , testname, nothing , Any[(resp, [])], LineNumberNode (1 )))
450- Test. push_testset (fake)
451- Test. record (o_ts, fake)
452- Test. pop_testset ()
453414 end
454415end
455- for test in all_tests
456- (test in completed_tests) && continue
457- fake = Test. DefaultTestSet (test)
458- Test. record (fake, Test. Error (:test_interrupted , test, nothing ,
459- [(" skipped" , [])], LineNumberNode (1 )))
460- Test. push_testset (fake)
461- Test. record (o_ts, fake)
462- Test. pop_testset ()
416+ with_testset (o_ts) do
417+ completed_tests = Set {String} ()
418+ for (testname, (resp,)) in results
419+ push! (completed_tests, testname)
420+ if isa (resp, Test. DefaultTestSet)
421+ with_testset (resp) do
422+ Test. record (o_ts, resp)
423+ end
424+ elseif isa (resp, Tuple{Int,Int})
425+ fake = Test. DefaultTestSet (testname)
426+ for i in 1 : resp[1 ]
427+ Test. record (fake, Test. Pass (:test , nothing , nothing , nothing , nothing ))
428+ end
429+ for i in 1 : resp[2 ]
430+ Test. record (fake, Test. Broken (:test , nothing ))
431+ end
432+ with_testset (fake) do
433+ Test. record (o_ts, fake)
434+ end
435+ elseif isa (resp, RemoteException) && isa (resp. captured. ex, Test. TestSetException)
436+ println (" Worker $(resp. pid) failed running test $(testname) :" )
437+ Base. showerror (stdout , resp. captured)
438+ println ()
439+ fake = Test. DefaultTestSet (testname)
440+ for i in 1 : resp. captured. ex. pass
441+ Test. record (fake, Test. Pass (:test , nothing , nothing , nothing , nothing ))
442+ end
443+ for i in 1 : resp. captured. ex. broken
444+ Test. record (fake, Test. Broken (:test , nothing ))
445+ end
446+ for t in resp. captured. ex. errors_and_fails
447+ Test. record (fake, t)
448+ end
449+ with_testset (fake) do
450+ Test. record (o_ts, fake)
451+ end
452+ else
453+ if ! isa (resp, Exception)
454+ resp = ErrorException (string (" Unknown result type : " , typeof (resp)))
455+ end
456+ # If this test raised an exception that is not a remote testset exception,
457+ # i.e. not a RemoteException capturing a TestSetException that means
458+ # the test runner itself had some problem, so we may have hit a segfault,
459+ # deserialization errors or something similar. Record this testset as Errored.
460+ fake = Test. DefaultTestSet (testname)
461+ Test. record (fake, Test. Error (:nontest_error , testname, nothing , Base. ExceptionStack ([(exception= resp,backtrace= [])]), LineNumberNode (1 )))
462+ with_testset (fake) do
463+ Test. record (o_ts, fake)
464+ end
465+ end
466+ end
467+ for test in all_tests
468+ (test in completed_tests) && continue
469+ fake = Test. DefaultTestSet (test)
470+ Test. record (fake, Test. Error (:test_interrupted , test, nothing , Base. ExceptionStack ([(exception= " skipped" ,backtrace= [])]), LineNumberNode (1 )))
471+ with_testset (fake) do
472+ Test. record (o_ts, fake)
473+ end
474+ end
463475end
464476println ()
465477Test. print_test_results (o_ts, 1 )
466- if ! o_ts. anynonpass
478+ if (VERSION >= v " 1.13.0-DEV.1037" && ! Test. anynonpass (o_ts)) ||
479+ (VERSION < v " 1.13.0-DEV.1037" && ! o_ts. anynonpass)
467480 println (" \0 33[32;1mSUCCESS\0 33[0m" )
468481else
469482 println (" \0 33[31;1mFAILURE\0 33[0m\n " )
0 commit comments