From 09de774dcc1a5abc1c8f3a00fdb039aa3c522f52 Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Wed, 4 Mar 2020 17:46:36 +0100 Subject: SOPA Initial Commit --- test-cli/test/helpers/testsrv_db.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 94181f9..f08cb17 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -19,12 +19,12 @@ class TestSrv_Database(object): def __init__(self): pass - def open (self, filename): - '''Open database connection''' - self.__xml_setup = XMLSetup(filename) + def open (self, xmlObj): + self.__xml_setup = xmlObj; self.__sqlObject = PgSQLConnection() return self.__sqlObject.db_connect(self.__xml_setup.getdbConnectionStr()) + def create_board(self, processor_id, model_id, variant, bmac = None): '''create a new board''' if bmac is None: @@ -95,7 +95,20 @@ class TestSrv_Database(object): def getboard_comp_test_list(self, board_uuid): '''get the board test list''' - sql = "SELECT isee.gettestcompletelist('{}')".format(board_uuid) + sql = "SELECT * FROM isee.gettestcompletelist('{}')".format(board_uuid) + #print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + #print(res) + return res; + except Exception as err: + r = find_between(str(err), '#', '#') + #print(r) + return None + + def getboard_test_variables(self, board_uuid, testdefid): + '''get the board test list''' + sql = "SELECT * FROM isee.getboardtestvariables('{}', '{}')".format(board_uuid, testdefid) #print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) @@ -159,18 +172,4 @@ class TestSrv_Database(object): except Exception as err: r = find_between(str(err), '#', '#') #print(r) - return None - - def getboard_eeprom(self, board_uuid): - '''get the board eeprom struct ''' - sql = "SELECT isee.getboard_eeprom('{}')".format(board_uuid) - #print('>>>' + sql) - try: - res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res; - except Exception as err: - r = find_between(str(err), '#', '#') - #print(r) - return None - \ No newline at end of file + return None \ No newline at end of file -- cgit v1.1 From 7490324bc98248fc82be814920e2deff4114acc8 Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Wed, 4 Mar 2020 19:38:10 +0100 Subject: Added station --- test-cli/test/helpers/testsrv_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index f08cb17..7ed02f3 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -119,9 +119,9 @@ class TestSrv_Database(object): #print(r) return None - def open_testbatch(self, board_uuid): + def open_testbatch(self, board_uuid, station): '''get the board test list''' - sql = "SELECT isee.open_testbatch('{}')".format(board_uuid) + sql = "SELECT * FROM isee.open_testbatch('{}','{}')".format(board_uuid, station) #print('>>>' + sql) try: res = str(self.__sqlObject.db_execute_query(sql)[0]) -- cgit v1.1 From dd9ffc52507c391271d0821636c683fd7562b46a Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Thu, 5 Mar 2020 18:50:47 +0100 Subject: Modified postgre functions. --- test-cli/test/helpers/testsrv_db.py | 155 ++++++++++-------------------------- 1 file changed, 44 insertions(+), 111 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 7ed02f3..b7b75b1 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -1,10 +1,10 @@ from test.helpers.psqldb import PgSQLConnection -from test.helpers.setup_xml import XMLSetup -def find_between( s, first, last ): + +def find_between(s, first, last): try: - start = s.index( first ) + len( first ) - end = s.index( last, start ) + start = s.index(first) + len(first) + end = s.index(last, start) return s[start:end] except ValueError: return "" @@ -19,157 +19,90 @@ class TestSrv_Database(object): def __init__(self): pass - def open (self, xmlObj): - self.__xml_setup = xmlObj; + def open(self, xmlObj): + self.__xml_setup = xmlObj self.__sqlObject = PgSQLConnection() return self.__sqlObject.db_connect(self.__xml_setup.getdbConnectionStr()) - - def create_board(self, processor_id, model_id, variant, bmac = None): + def create_board(self, processor_id, model_id, variant, station, bmac=None): '''create a new board''' if bmac is None: - sql = "SELECT isee.create_board('{}', '{}', '{}', NULL);".format(processor_id, model_id, variant) + sql = "SELECT isee.f_create_board('{}', '{}', '{}', NULL, '{}');".format(processor_id, model_id, variant, + station) else: - sql = "SELECT isee.create_board('{}', '{}', '{}', '{}');".format(processor_id, model_id, variant, bmac) - #print('>>>' + sql) - try: - res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res[0][0]; - except Exception as err: - r = find_between(str(err), '#', '#') - #print(r) - return None - - def create_model(self, modid, variant, descr, tgid): - '''create new model''' - sql = "SELECT isee.create_model('{}', '{}', '{}', '{}')".format(modid, variant, descr, tgid) - #print('>>>' + sql) - try: - res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res[0][0]; - except Exception as err: - r = find_between(str(err), '#', '#') - #print(r) - return None - - def create_test_definition(self, testname, testdesc, testfunc): - '''Create a new definition and return definition id on fail (testname already exist) return -1''' - sql = "SELECT isee.define_test('{}', '{}', '{}')".format(testname, testdesc, testfunc) - #print('>>>' + sql) - try: - res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res[0][0]; - except Exception as err: - r = find_between(str(err), '#', '#') - #print(r) - return None - - def add_testdef_to_group(self, testgroupid, testname, testparam): - '''Assign definition to group test return true on success or false if it fails''' - sql = "SELECT isee.add_test_to_group('{}', '{}', '{}')".format(testgroupid, testname, testparam) - #print('>>>' + sql) + sql = "SELECT isee.f_create_board('{}', '{}', '{}', '{}', '{}');".format(processor_id, model_id, variant, + bmac, station) + # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res[0][0]; + # print(res) + return res[0][0] except Exception as err: r = find_between(str(err), '#', '#') - #print(r) + # print(r) return None - def getboard_test_list(self, board_uuid): + def get_tests_list(self, board_uuid): '''get the board test list''' - sql = "SELECT isee.gettestlist('{}')".format(board_uuid) - #print('>>>' + sql) + sql = "SELECT * FROM isee.f_get_tests_list('{}')".format(board_uuid) + # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) - #print(res) + # print(res) return res; except Exception as err: r = find_between(str(err), '#', '#') - #print(r) + # print(r) return None - def getboard_comp_test_list(self, board_uuid): + def get_test_params_list(self, testid): '''get the board test list''' - sql = "SELECT * FROM isee.gettestcompletelist('{}')".format(board_uuid) - #print('>>>' + sql) + sql = "SELECT * FROM isee.f_get_test_params_list('{}')".format(testid) + # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res; + # print(res) + return res except Exception as err: r = find_between(str(err), '#', '#') - #print(r) + # print(r) return None - def getboard_test_variables(self, board_uuid, testdefid): + def open_test(self, board_uuid): '''get the board test list''' - sql = "SELECT * FROM isee.getboardtestvariables('{}', '{}')".format(board_uuid, testdefid) - #print('>>>' + sql) + sql = "SELECT * FROM isee.f_open_test('{}')".format(board_uuid) + # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res; - except Exception as err: - r = find_between(str(err), '#', '#') - #print(r) - return None - - def open_testbatch(self, board_uuid, station): - '''get the board test list''' - sql = "SELECT * FROM isee.open_testbatch('{}','{}')".format(board_uuid, station) - #print('>>>' + sql) - try: - res = str(self.__sqlObject.db_execute_query(sql)[0]) - res = res.replace('(', '') - res = res.replace(')', '') - res = res.replace(',', '') - #print(res) - return res; + # print(res) + return res except Exception as err: r = find_between(str(err), '#', '#') - #print(r) + # print(r) return None - def add_test_to_batch(self, board_uuid, testid, testid_ctl, result, groupid, data): + def run_test(self, testid_ctl, testid): '''get the board test list''' - sql = "SELECT isee.add_test_to_batch_c('{}','{}','{}','{}','{}','{}')".format(board_uuid, testid, testid_ctl, result, groupid, data) - #print('>>>' + sql) + sql = "SELECT * FROM isee.f_run_test('{}','{}')".format(testid_ctl, testid) + # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res; + # print(res) + return res except Exception as err: r = find_between(str(err), '#', '#') - #print(r) + # print(r) return None - def close_testbatch(self, board_uuid, testid_ctl): + def finish_test(self, testid_ctl, testid, newstatus): '''get the board test list''' - sql = "SELECT isee.close_testbatch('{}','{}')".format(board_uuid, testid_ctl) - #print('>>>' + sql) + sql = "SELECT * FROM isee.f_finish_test('{}','{}','{}')".format(testid_ctl, testid, newstatus) + # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res; + # print(res) + return res except Exception as err: r = find_between(str(err), '#', '#') - #print(r) + # print(r) return None - - def update_set_test_row(self, nstation, testid_ctl, board_uuid, ctest, cstatus): - '''get the board test list''' - sql = "SELECT isee.update_set_test_row('{}','{}','{}','{}','{}')".format(nstation, testid_ctl ,board_uuid, ctest, cstatus) - #print('>>>' + sql) - try: - res = self.__sqlObject.db_execute_query(sql) - #print(res) - return res; - except Exception as err: - r = find_between(str(err), '#', '#') - #print(r) - return None \ No newline at end of file -- cgit v1.1 From 9f07a57d89a927aa9b172c1bf20c7ab563658c73 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Fri, 6 Mar 2020 12:46:27 +0100 Subject: Fixed multiple errors. --- test-cli/test/helpers/testsrv_db.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index b7b75b1..d937d3e 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -27,11 +27,13 @@ class TestSrv_Database(object): def create_board(self, processor_id, model_id, variant, station, bmac=None): '''create a new board''' if bmac is None: - sql = "SELECT isee.f_create_board('{}', '{}', '{}', NULL, '{}');".format(processor_id, model_id, variant, - station) + sql = "SELECT * FROM isee.f_create_board('{}', '{}', '{}', NULL, '{}');".format(processor_id, model_id, + variant, + station) else: - sql = "SELECT isee.f_create_board('{}', '{}', '{}', '{}', '{}');".format(processor_id, model_id, variant, - bmac, station) + sql = "SELECT * FROM isee.f_create_board('{}', '{}', '{}', '{}', '{}');".format(processor_id, model_id, + variant, + bmac, station) # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) @@ -57,7 +59,7 @@ class TestSrv_Database(object): def get_test_params_list(self, testid): '''get the board test list''' - sql = "SELECT * FROM isee.f_get_test_params_list('{}')".format(testid) + sql = "SELECT * FROM isee.f_get_test_params_list({})".format(testid) # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) @@ -75,7 +77,7 @@ class TestSrv_Database(object): try: res = self.__sqlObject.db_execute_query(sql) # print(res) - return res + return res[0][0] except Exception as err: r = find_between(str(err), '#', '#') # print(r) @@ -83,12 +85,10 @@ class TestSrv_Database(object): def run_test(self, testid_ctl, testid): '''get the board test list''' - sql = "SELECT * FROM isee.f_run_test('{}','{}')".format(testid_ctl, testid) + sql = "SELECT isee.f_run_test({},{})".format(testid_ctl, testid) # print('>>>' + sql) try: - res = self.__sqlObject.db_execute_query(sql) - # print(res) - return res + self.__sqlObject.db_execute_query(sql) except Exception as err: r = find_between(str(err), '#', '#') # print(r) @@ -96,12 +96,10 @@ class TestSrv_Database(object): def finish_test(self, testid_ctl, testid, newstatus): '''get the board test list''' - sql = "SELECT * FROM isee.f_finish_test('{}','{}','{}')".format(testid_ctl, testid, newstatus) + sql = "SELECT isee.f_finish_test({},{},'{}')".format(testid_ctl, testid, newstatus) # print('>>>' + sql) try: - res = self.__sqlObject.db_execute_query(sql) - # print(res) - return res + self.__sqlObject.db_execute_query(sql) except Exception as err: r = find_between(str(err), '#', '#') # print(r) -- cgit v1.1 From d38c92bfd7b6abe3a52b51b87b1a2949b857d9b4 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Mon, 9 Mar 2020 19:16:08 +0100 Subject: Created function to flash the eeprom memory. --- test-cli/test/helpers/testsrv_db.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index d937d3e..9fb61fd 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -104,3 +104,16 @@ class TestSrv_Database(object): r = find_between(str(err), '#', '#') # print(r) return None + + def get_board_variables(self, board_uuid): + sql = "SELECT * FROM isee.f_get_boardvariables('{}')".format(board_uuid) + # print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + -- cgit v1.1 From e74e0a36d9ad6a01c04500f3a24cb0ef5dd0b283 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Fri, 13 Mar 2020 12:17:51 +0100 Subject: Added final flashing tasks: eeprom and nand. --- test-cli/test/helpers/testsrv_db.py | 49 +++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 9fb61fd..c9372fc 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -51,14 +51,13 @@ class TestSrv_Database(object): try: res = self.__sqlObject.db_execute_query(sql) # print(res) - return res; + return res except Exception as err: r = find_between(str(err), '#', '#') # print(r) return None def get_test_params_list(self, testid): - '''get the board test list''' sql = "SELECT * FROM isee.f_get_test_params_list({})".format(testid) # print('>>>' + sql) try: @@ -71,7 +70,6 @@ class TestSrv_Database(object): return None def open_test(self, board_uuid): - '''get the board test list''' sql = "SELECT * FROM isee.f_open_test('{}')".format(board_uuid) # print('>>>' + sql) try: @@ -84,7 +82,6 @@ class TestSrv_Database(object): return None def run_test(self, testid_ctl, testid): - '''get the board test list''' sql = "SELECT isee.f_run_test({},{})".format(testid_ctl, testid) # print('>>>' + sql) try: @@ -95,7 +92,6 @@ class TestSrv_Database(object): return None def finish_test(self, testid_ctl, testid, newstatus): - '''get the board test list''' sql = "SELECT isee.f_finish_test({},{},'{}')".format(testid_ctl, testid, newstatus) # print('>>>' + sql) try: @@ -117,3 +113,46 @@ class TestSrv_Database(object): # print(r) return None + def get_board_macaddr(self, board_uuid): + sql = "SELECT * FROM isee.f_get_board_macaddr('{}')".format(board_uuid) + # print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res[0][0] + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + + def create_process(self, testid_ctl): + sql = "SELECT * FROM isee.f_create_process({})".format(testid_ctl) + # print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res[0][0] + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + + def create_task_result(self, taskid_ctl, name, newstatus): + sql = "SELECT isee.f_create_task_result({},'{}','{}')".format(taskid_ctl, name, newstatus) + # print('>>>' + sql) + try: + self.__sqlObject.db_execute_query(sql) + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + + def update_taskctl_status(self, taskid_ctl, newstatus): + sql = "SELECT isee.f_update_taskctl_status({},'{}')".format(taskid_ctl, newstatus) + # print('>>>' + sql) + try: + self.__sqlObject.db_execute_query(sql) + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None -- cgit v1.1 From 71d9a1f0b6bb4389cb9b0760ce4e847574fdcd45 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Fri, 13 Mar 2020 12:36:14 +0100 Subject: SOPA0000 test: Saved the variable data used during the eeprom and nand flashing. --- test-cli/test/helpers/testsrv_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index c9372fc..a6a5545 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -137,8 +137,8 @@ class TestSrv_Database(object): # print(r) return None - def create_task_result(self, taskid_ctl, name, newstatus): - sql = "SELECT isee.f_create_task_result({},'{}','{}')".format(taskid_ctl, name, newstatus) + def create_task_result(self, taskid_ctl, name, newstatus, info=None): + sql = "SELECT isee.f_create_task_result({},'{}','{}','{}')".format(taskid_ctl, name, newstatus, info) # print('>>>' + sql) try: self.__sqlObject.db_execute_query(sql) -- cgit v1.1 From a85534544fad3c51d8af8d65e7fde6cb5d07978b Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Fri, 13 Mar 2020 14:30:21 +0100 Subject: Changed tasks to be independent of tests. --- test-cli/test/helpers/testsrv_db.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index a6a5545..27024ce 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -101,8 +101,8 @@ class TestSrv_Database(object): # print(r) return None - def get_board_variables(self, board_uuid): - sql = "SELECT * FROM isee.f_get_boardvariables('{}')".format(board_uuid) + def get_task_variables_list(self, board_uuid): + sql = "SELECT * FROM isee.f_get_task_variables_list('{}')".format(board_uuid) # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) @@ -125,8 +125,8 @@ class TestSrv_Database(object): # print(r) return None - def create_process(self, testid_ctl): - sql = "SELECT * FROM isee.f_create_process({})".format(testid_ctl) + def open_task(self, uuid): + sql = "SELECT * FROM isee.f_open_task('{}')".format(uuid) # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) -- cgit v1.1 From 686893803c05fedd38a24bb1f661f8aeb7c652fe Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Thu, 19 Mar 2020 16:33:53 +0100 Subject: Fixed problem generating dataepprom string. --- test-cli/test/helpers/testsrv_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 27024ce..bf51acf 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -137,8 +137,8 @@ class TestSrv_Database(object): # print(r) return None - def create_task_result(self, taskid_ctl, name, newstatus, info=None): - sql = "SELECT isee.f_create_task_result({},'{}','{}','{}')".format(taskid_ctl, name, newstatus, info) + def create_task_result(self, taskid_ctl, name, newstatus, newinfo=None): + sql = "SELECT isee.f_create_task_result({},'{}','{}','{}')".format(taskid_ctl, name, newstatus, newinfo) # print('>>>' + sql) try: self.__sqlObject.db_execute_query(sql) -- cgit v1.1 From 0c610ebbef5928f17ec8c14d872b4d4298d3c4fb Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Wed, 1 Apr 2020 11:45:07 +0200 Subject: Modificada la IP del servidor. Arreglado error al enviar los datos de la eeprom grabada a la BD. --- test-cli/test/helpers/testsrv_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index bf51acf..d563e74 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -139,12 +139,12 @@ class TestSrv_Database(object): def create_task_result(self, taskid_ctl, name, newstatus, newinfo=None): sql = "SELECT isee.f_create_task_result({},'{}','{}','{}')".format(taskid_ctl, name, newstatus, newinfo) - # print('>>>' + sql) + print('>>>' + sql) try: self.__sqlObject.db_execute_query(sql) except Exception as err: r = find_between(str(err), '#', '#') - # print(r) + print(r) return None def update_taskctl_status(self, taskid_ctl, newstatus): -- cgit v1.1 From f86887baef80509460da0bff8f48b2900a627282 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Mon, 13 Apr 2020 09:49:51 +0200 Subject: Added new DB functions. Added Qrreader.py file. --- test-cli/test/helpers/testsrv_db.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index d563e74..dc4fb55 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -139,12 +139,12 @@ class TestSrv_Database(object): def create_task_result(self, taskid_ctl, name, newstatus, newinfo=None): sql = "SELECT isee.f_create_task_result({},'{}','{}','{}')".format(taskid_ctl, name, newstatus, newinfo) - print('>>>' + sql) + # print('>>>' + sql) try: self.__sqlObject.db_execute_query(sql) except Exception as err: r = find_between(str(err), '#', '#') - print(r) + # print(r) return None def update_taskctl_status(self, taskid_ctl, newstatus): @@ -156,3 +156,24 @@ class TestSrv_Database(object): r = find_between(str(err), '#', '#') # print(r) return None + + def set_factorycode(self, uuid, factorycode): + sql = "SELECT isee.f_set_factorycode('{}','{}')".format(uuid, factorycode) + # print('>>>' + sql) + try: + self.__sqlObject.db_execute_query(sql) + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + + def bond_to_station(self, uuid, station): + sql = "SELECT station.bond_to_station('{}','{}')".format(uuid, station) + # print('>>>' + sql) + try: + self.__sqlObject.db_execute_query(sql) + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + -- cgit v1.1 From 09b3bb38fc7305c9b47c29bc90ebc9c636827307 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Wed, 17 Jun 2020 09:44:56 +0200 Subject: SOPA0000: Added support for saving results (strings or files) in the DB. It also saves a final DMESG file. --- test-cli/test/helpers/testsrv_db.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index dc4fb55..dfb4d15 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -101,6 +101,42 @@ class TestSrv_Database(object): # print(r) return None + def upload_result_string(self, testid_ctl, testid, descrip, strdata): + sql = "SELECT isee.f_upload_result_string({},{},'{}','{}')".format(testid_ctl, testid, descrip, strdata) + # print('>>>' + sql) + try: + self.__sqlObject.db_execute_query(sql) + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + + def upload_result_file(self, testid_ctl, testid, descrip, filepath): + try: + # generate a new oid + fileoid = self.__sqlObject.db_upload_large_file(filepath) + # insert into a table + sql = "SELECT isee.f_upload_result_file({},{},'{}','{}')".format(testid_ctl, testid, descrip, fileoid) + # print('>>>' + sql) + self.__sqlObject.db_execute_query(sql) + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + + def upload_dmesg(self, testid_ctl, filepath): + try: + # generate a new oid + fileoid = self.__sqlObject.db_upload_large_file(filepath) + # insert into a table + sql = "SELECT isee.f_upload_dmesg_file({},'{}')".format(testid_ctl, fileoid) + # print('>>>' + sql) + self.__sqlObject.db_execute_query(sql) + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + def get_task_variables_list(self, board_uuid): sql = "SELECT * FROM isee.f_get_task_variables_list('{}')".format(board_uuid) # print('>>>' + sql) @@ -176,4 +212,3 @@ class TestSrv_Database(object): r = find_between(str(err), '#', '#') # print(r) return None - -- cgit v1.1 From db3b1e45c47a1ef23c1ad67114a09cbec0976681 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Thu, 25 Jun 2020 11:45:31 +0200 Subject: Solved bugs. Adapted to DB changes. --- test-cli/test/helpers/testsrv_db.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index dfb4d15..637d45c 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -202,9 +202,21 @@ class TestSrv_Database(object): r = find_between(str(err), '#', '#') # print(r) return None - - def bond_to_station(self, uuid, station): - sql = "SELECT station.bond_to_station('{}','{}')".format(uuid, station) + + def read_station_state(self, station): + sql = "SELECT * FROM station.getmystate('{}');".format(station) + # print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res[0][0] + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None + + def change_station_state(self, station, newstate): + sql = "SELECT station.setmystate('{}', '{}', NULL)".format(newstate, station) # print('>>>' + sql) try: self.__sqlObject.db_execute_query(sql) -- cgit v1.1 From 34df86b37d6838b115e65e5f3a332344afeb86b8 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Wed, 1 Jul 2020 10:45:34 +0200 Subject: Changes to adapt to new way to save results in DB. Created audio test. Added protections against unexpected status in DB. --- test-cli/test/helpers/testsrv_db.py | 44 ++++++++++++++----------------------- 1 file changed, 17 insertions(+), 27 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 637d45c..7eeefb3 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -91,8 +91,8 @@ class TestSrv_Database(object): # print(r) return None - def finish_test(self, testid_ctl, testid, newstatus): - sql = "SELECT isee.f_finish_test({},{},'{}')".format(testid_ctl, testid, newstatus) + def finish_test(self, testid_ctl, testid, newstatus, textresult): + sql = "SELECT isee.f_finish_test({},{},'{}','{}')".format(testid_ctl, testid, newstatus, textresult) # print('>>>' + sql) try: self.__sqlObject.db_execute_query(sql) @@ -101,35 +101,13 @@ class TestSrv_Database(object): # print(r) return None - def upload_result_string(self, testid_ctl, testid, descrip, strdata): - sql = "SELECT isee.f_upload_result_string({},{},'{}','{}')".format(testid_ctl, testid, descrip, strdata) - # print('>>>' + sql) - try: - self.__sqlObject.db_execute_query(sql) - except Exception as err: - r = find_between(str(err), '#', '#') - # print(r) - return None - - def upload_result_file(self, testid_ctl, testid, descrip, filepath): + def upload_result_file(self, testid_ctl, testid, desc, filepath, mimetype): try: # generate a new oid fileoid = self.__sqlObject.db_upload_large_file(filepath) # insert into a table - sql = "SELECT isee.f_upload_result_file({},{},'{}','{}')".format(testid_ctl, testid, descrip, fileoid) - # print('>>>' + sql) - self.__sqlObject.db_execute_query(sql) - except Exception as err: - r = find_between(str(err), '#', '#') - # print(r) - return None - - def upload_dmesg(self, testid_ctl, filepath): - try: - # generate a new oid - fileoid = self.__sqlObject.db_upload_large_file(filepath) - # insert into a table - sql = "SELECT isee.f_upload_dmesg_file({},'{}')".format(testid_ctl, fileoid) + sql = "SELECT isee.f_upload_result_file({},{},'{}','{}','{}')".format(testid_ctl, testid, desc, fileoid, + mimetype) # print('>>>' + sql) self.__sqlObject.db_execute_query(sql) except Exception as err: @@ -224,3 +202,15 @@ class TestSrv_Database(object): r = find_between(str(err), '#', '#') # print(r) return None + + def get_setup_variable(self, skey): + sql = "SELECT * FROM admin.get_setupvar('{}')".format(skey) + # print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res[0][0] + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None -- cgit v1.1 From 9f89f02e7d6e2a3208b0b85d2567ebffd2515e09 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Tue, 7 Jul 2020 14:09:59 +0200 Subject: New way to check preivous state before changing to a new one. Solved some problems with audio test. --- test-cli/test/helpers/testsrv_db.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 7eeefb3..9579e7e 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -197,7 +197,9 @@ class TestSrv_Database(object): sql = "SELECT station.setmystate('{}', '{}', NULL)".format(newstate, station) # print('>>>' + sql) try: - self.__sqlObject.db_execute_query(sql) + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res[0][0] except Exception as err: r = find_between(str(err), '#', '#') # print(r) -- cgit v1.1 From d46bce422fd03cd57d1ba336361da17d6efb48db Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Fri, 31 Jul 2020 02:07:37 +0200 Subject: TEST restructure --- test-cli/test/helpers/testsrv_db.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 9579e7e..c2b2276 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -24,6 +24,9 @@ class TestSrv_Database(object): self.__sqlObject = PgSQLConnection() return self.__sqlObject.db_connect(self.__xml_setup.getdbConnectionStr()) + def getConfig(self): + return self.__sqlObject.getConfig() + def create_board(self, processor_id, model_id, variant, station, bmac=None): '''create a new board''' if bmac is None: @@ -41,7 +44,8 @@ class TestSrv_Database(object): return res[0][0] except Exception as err: r = find_between(str(err), '#', '#') - # print(r) + print(r) + print(str(err)) return None def get_tests_list(self, board_uuid): @@ -95,10 +99,11 @@ class TestSrv_Database(object): sql = "SELECT isee.f_finish_test({},{},'{}','{}')".format(testid_ctl, testid, newstatus, textresult) # print('>>>' + sql) try: + print('finish_test => SQL {}'.format(sql)) self.__sqlObject.db_execute_query(sql) except Exception as err: r = find_between(str(err), '#', '#') - # print(r) + print('finish_test => {}'.format(err)) return None def upload_result_file(self, testid_ctl, testid, desc, filepath, mimetype): @@ -195,6 +200,18 @@ class TestSrv_Database(object): def change_station_state(self, station, newstate): sql = "SELECT station.setmystate('{}', '{}', NULL)".format(newstate, station) + print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + print(res) + return res[0][0] + except Exception as err: + r = find_between(str(err), '#', '#') + print(r) + return None + + def get_setup_variable(self, skey): + sql = "SELECT * FROM admin.get_setupvar('{}')".format(skey) # print('>>>' + sql) try: res = self.__sqlObject.db_execute_query(sql) @@ -205,7 +222,7 @@ class TestSrv_Database(object): # print(r) return None - def get_setup_variable(self, skey): + def get_setup_variable(self, skey , default): sql = "SELECT * FROM admin.get_setupvar('{}')".format(skey) # print('>>>' + sql) try: @@ -215,4 +232,4 @@ class TestSrv_Database(object): except Exception as err: r = find_between(str(err), '#', '#') # print(r) - return None + return default -- cgit v1.1 From 227d9783fe8327b84ac3b0e032f012ba144816f8 Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Fri, 31 Jul 2020 13:58:41 +0200 Subject: IGEP0048: added plc test --- test-cli/test/helpers/testsrv_db.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index c2b2276..556c246 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -132,6 +132,19 @@ class TestSrv_Database(object): # print(r) return None + + def get_plc_macaddr(self, board_uuid): + sql = "SELECT * FROM isee.f_get_plcmac(\'{}\')".format(board_uuid) + # print('>>>' + sql) + try: + res = self.__sqlObject.db_execute_query(sql) + return res, '' + except Exception as err: + r = find_between(str(err), '#', '#') + print(r) + return None, r + + def get_board_macaddr(self, board_uuid): sql = "SELECT * FROM isee.f_get_board_macaddr('{}')".format(board_uuid) # print('>>>' + sql) -- cgit v1.1 From 293f0682dd8258a068e4b152f9fecb292d732b78 Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Mon, 5 Oct 2020 11:45:41 +0200 Subject: modify finish_test call, added execution without messsage if fails --- test-cli/test/helpers/testsrv_db.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test-cli/test/helpers/testsrv_db.py') diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 556c246..8e96e8c 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -101,10 +101,11 @@ class TestSrv_Database(object): try: print('finish_test => SQL {}'.format(sql)) self.__sqlObject.db_execute_query(sql) + return True except Exception as err: r = find_between(str(err), '#', '#') print('finish_test => {}'.format(err)) - return None + return False def upload_result_file(self, testid_ctl, testid, desc, filepath, mimetype): try: @@ -246,3 +247,14 @@ class TestSrv_Database(object): r = find_between(str(err), '#', '#') # print(r) return default + + def setDevelStationState(self, station, newState): + sql = "UPDATE station.station_state SET state = {} WHERE hostname={}".format(newState, station) + try: + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res[0][0] + except Exception as err: + r = find_between(str(err), '#', '#') + # print(r) + return None -- cgit v1.1