From 1a25e39f26bc3035891cb8f72b09e0e0609ea9b9 Mon Sep 17 00:00:00 2001 From: Leon Hiemstra <hiemstra@astron.nl> Date: Fri, 14 Nov 2014 16:02:19 +0000 Subject: [PATCH] better error handling --- .../unb1_test/tb/python/tc_unb1_test.py | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py b/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py index 170cd7a015..0a37c5ac14 100644 --- a/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py +++ b/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py @@ -133,9 +133,11 @@ def test_BG_to_DB(tc,io,cmd): # truncate: in 10GbE the data is only sized 700 - for s in tc.spNrs: - bg_ram[s][0] = bg_ram[s][0][:-(blocksize-700)] - db_ram[s][0] = db_ram[s][0][:-(blocksize-700)] + for bg in bg_ram: + bg[0] = bg[0][:-(blocksize-700)] + + for db in db_ram: + db[0] = db[0][:-(blocksize-700)] #bg_ram[s][0] = bg_ram[s][0][:-(blocksize-samples_per_packet)] #db_ram[s][0] = db_ram[s][0][:-(blocksize-samples_per_packet)] @@ -404,6 +406,7 @@ io = node_io.NodeIO(tc.nodeImages, tc.base_ip) ################################################################################################################## # Run tests +nof_errors = 0 rep = 0 while rep < tc.repeat: rep += 1 @@ -414,17 +417,28 @@ while rep < tc.repeat: for cmd in tc.sequence: tc.append_log(3, 'Next command: %s : %s: %s' % (cmd,Cmd[cmd][1],Cmd[cmd][2])) + + subtc = test_case.Testcase('SUBTB - ', '') + subtc.set_result('PASSED') + if cmd == 'INFO': # reload node_io: - io = Cmd[cmd][0](tc,io,cmd) + io = Cmd[cmd][0](subtc,io,cmd) else: - Cmd[cmd][0](tc,io,cmd) + Cmd[cmd][0](subtc,io,cmd) + + if subtc.get_result() == 'FAILED': + nof_errors+=1 + tc.append_log(3, 'This test FAILED') + tc.append_log(3, '>>>') + tc.set_result('FAILED') + except KeyError: print 'Unknown command:',cmd cmd='help' Cmd[cmd][0](tc,io,cmd) - except: - print 'Catched error:',sys.exc_info()[0] +# except: +# print 'Catched error:',sys.exc_info()[0] @@ -434,6 +448,7 @@ tc.set_section_id('') tc.append_log(3, '') tc.append_log(3, '>>>') tc.append_log(0, '>>> Test bench result: %s' % tc.get_result()) +tc.append_log(0, '>>> Number of errors=%d' % nof_errors) tc.append_log(3, '>>>') sys.exit(tc.get_result()) -- GitLab