diff options
Diffstat (limited to 'test-cli/test/helpers')
-rw-r--r-- | test-cli/test/helpers/int_registers.py (renamed from test-cli/test/helpers/get_dieid.py) | 46 | ||||
-rw-r--r-- | test-cli/test/helpers/testsrv_db.py | 26 |
2 files changed, 41 insertions, 31 deletions
diff --git a/test-cli/test/helpers/get_dieid.py b/test-cli/test/helpers/int_registers.py index 48e724e..cf2e35b 100644 --- a/test-cli/test/helpers/get_dieid.py +++ b/test-cli/test/helpers/int_registers.py @@ -21,24 +21,36 @@ def read(addr): os.close(fd) return "%08X" % retval[0] -def getRegisters(model): - if model.find("IGEP0046") == 0: + +def get_die_id(modelid): + dieid = "" + + # get registers + if modelid.find("IGEP0046") == 0: registers = [0x021BC420, 0x021BC410] - elif model.find("IGEP0034") == 0 or model.find("SOPA0000") == 0: + elif modelid.find("IGEP0034") == 0 or modelid.find("SOPA0000") == 0: + # registers: mac_id0_lo, mac_id0_hi, mac_id1_lo, mac_id1_hi registers = [0x44e10630, 0x44e10634, 0x44e10638, 0x44e1063C] - elif model.find("OMAP3") == 0: + elif modelid.find("OMAP3") == 0: registers = [0x4830A224, 0x4830A220, 0x4830A21C, 0x4830A218] - elif model.find("OMAP5") == 0: + elif modelid.find("OMAP5") == 0: registers = [0x4A002210, 0x4A00220C, 0x4A002208, 0x4A002200] - return registers - -def genDieid(modelid): - registers = getRegisters(modelid) - id = "" - for i in range(len(registers)): - id=id+(read(registers[i])) - return id - -#if __name__ == "__main__": - #registers = [0x021BC420, 0x021BC410] - #print(main(registers)) + else: + raise Exception('modelid not defined') + + for rg in registers: + dieid = dieid + read(rg) + return dieid + + +def get_mac(modelid): + mac = None + + if modelid.find("IGEP0034") == 0 or modelid.find("SOPA0000") == 0: + # registers: mac_id0_lo, mac_id0_hi + registers = [0x44e10630, 0x44e10634] + mac = "" + for rg in registers: + mac = mac + read(rg) + + return mac 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) |