"WHERE s.sr= %(sr)s AND d.sr_status_id = s.id ORDER BY d.id DESC"
)
-# print "SQL[sr][select_srinfo] : ", SQL['SR']['select_srinfo']
-# print "DINFO : ", DINFO
MYSQL['cursor'].execute( SQL['SR']['select_srinfo'], DINFO )
TEMP = MYSQL['cursor'].fetchall()
-
-
-
-
-
- #print( DINFO['sr'] )
- #pprint.pprint( CONFIG['RAW']['REF']['environment'] )
- #exit()
-
- #print( CONFIG['RAW']['REF']['environment']
-
-
-
SQL['REF'] = {}
# select ref
SQL['REF']['select'] = (
MYSQL['cursor'].execute( SQL['REF']['select'], CONFIG['RAW']['REF']['environment'] )
TEMP = MYSQL['cursor'].fetchall()
+ VALUES = {
+ 'total' : CONFIG['RAW']['REF']['COUNT']['total_case'],
+ 'pass' : CONFIG['RAW']['REF']['COUNT']['pass_case'],
+ 'fail' : CONFIG['RAW']['REF']['COUNT']['fail_case'],
+ 'block' : CONFIG['RAW']['REF']['COUNT']['block_case'],
+ 'na' : CONFIG['RAW']['REF']['COUNT']['na_case'],
+ 'pcnt' : round( (float(CONFIG['RAW']['REF']['COUNT']['pass_case'])/float(CONFIG['RAW']['REF']['COUNT']['total_case']))*100, 2 ),
+ 'plan_name' : CONFIG['RAW']['REF']['plan_name'],
+ 'time_start' : CONFIG['RAW']['REF']['start_at'],
+ 'time_end' : CONFIG['RAW']['REF']['end_at'],
+ 'build_id' : CONFIG['RAW']['REF']['environment']['build_id'],
+ 'device_id' : CONFIG['RAW']['REF']['environment']['device_id'],
+ 'device_model' : CONFIG['RAW']['REF']['environment']['device_model'],
+ 'device_name' : CONFIG['RAW']['REF']['environment']['device_name'],
+ 'device_host' : CONFIG['RAW']['REF']['environment']['device_host'],
+ 'manufacturer' : CONFIG['RAW']['REF']['environment']['manufacturer'],
+ 'tct_profile' : CONFIG['RAW']['REF']['environment']['tct_profile'],
+ 'tct_version' : CONFIG['RAW']['REF']['environment']['tct_version'],
+ 'url' : CONFIG['RAW']['REF']['url']
+ }
+
+ table = "trbs_ref"
+ sql = ""
+
# 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
if len( TEMP ) > 0:
DINFO['ref_id'] = TEMP[0]['id']
-
- print ("[INFO] MYSQL : Reference id = %(id)s, build_id = %(build_id)s" % TEMP[0])
+ sql = makeUpdateSQL( table, VALUES, DINFO['ref_id'] )
+ print ("[INFO] MYSQL : Can search Reference id = %(id)s, build_id = %(build_id)s" % TEMP[0])
+ print "[INFO] MYSQL : Updated Ref to", table, ", build_id =", VALUES['build_id']
else:
- print "[WARN] MYSQL : Can not search Reference TCT - ", CONFIG['RAW']['REF']['environment']['build_id']
+ print "[WARN] MYSQL : There is no Reference TCT result. Now, Inserting...", CONFIG['RAW']['REF']['environment']['build_id']
- #pprint.pprint( CONFIG['RAW']['REF'] )
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table, ", build_id =", VALUES['build_id']
- VALUES = {
- 'total' : CONFIG['RAW']['REF']['COUNT']['total_case'],
- 'pass' : CONFIG['RAW']['REF']['COUNT']['pass_case'],
- 'fail' : CONFIG['RAW']['REF']['COUNT']['fail_case'],
- 'block' : CONFIG['RAW']['REF']['COUNT']['block_case'],
- 'na' : CONFIG['RAW']['REF']['COUNT']['na_case'],
- 'pcnt' : round( (float(CONFIG['RAW']['REF']['COUNT']['pass_case'])/float(CONFIG['RAW']['REF']['COUNT']['total_case']))*100, 2 ),
- 'plan_name' : CONFIG['RAW']['REF']['plan_name'],
- 'time_start' : CONFIG['RAW']['REF']['start_at'],
- 'time_end' : CONFIG['RAW']['REF']['end_at'],
- 'build_id' : CONFIG['RAW']['REF']['environment']['build_id'],
- 'device_id' : CONFIG['RAW']['REF']['environment']['device_id'],
- 'device_model' : CONFIG['RAW']['REF']['environment']['device_model'],
- 'device_name' : CONFIG['RAW']['REF']['environment']['device_name'],
- 'device_host' : CONFIG['RAW']['REF']['environment']['device_host'],
- 'manufacturer' : CONFIG['RAW']['REF']['environment']['manufacturer'],
- 'tct_profile' : CONFIG['RAW']['REF']['environment']['tct_profile'],
- 'tct_version' : CONFIG['RAW']['REF']['environment']['tct_version'],
- 'url' : CONFIG['RAW']['REF']['url']
- }
+ try:
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
- #pprint.pprint( VALUES )
- table = "trbs_ref"
+ except MySQLdb.Error, e:
try:
- sql = makeInsertSQL( table, VALUES )
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
-
- print "[INFO] MYSQL : INSERT to", table, ", build_id =", VALUES['build_id']
-
-
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
-
-
- MYSQL['cursor'].execute( SQL['REF']['select'], CONFIG['RAW']['REF']['environment'] )
- TEMP = MYSQL['cursor'].fetchall()
-
- # 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
- if len( TEMP ) > 0:
- DINFO['ref_id'] = TEMP[0]['id']
- print ("[INFO] MYSQL : Reference id = %(id)s, build_id = %(build_id)s" % TEMP[0])
- else:
- print "[ERROR] MYSQL : Can not process reference TCT"
- exit(1)
-
-
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
+ MYSQL['cursor'].execute( SQL['REF']['select'], CONFIG['RAW']['REF']['environment'] )
+ TEMP = MYSQL['cursor'].fetchall()
+ # 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
+ if len( TEMP ) > 0:
+ DINFO['ref_id'] = TEMP[0]['id']
+ print ("[INFO] MYSQL : Reference id = %(id)s, build_id = %(build_id)s" % TEMP[0])
+ else:
+ print "[ERROR] MYSQL : Can not process reference TCT"
+ exit(1)
for suite in CONFIG['RAW']['REF']['SUITE'].keys():
- #pprint.pprint( CONFIG['RAW']['REF']['SUITE'][suite] )
- #pprint.pprint( DINFO )
- #exit()
-
VALUES = {
'trbs_ref_id' : DINFO['ref_id'],
'name' : suite,
'na_rate' : CONFIG['RAW']['REF']['SUITE'][suite]['na_rate']
}
-
-
SQL['REF']['select_suite'] = (
"SELECT * "
"FROM trbs_ref_suite "
MYSQL['cursor'].execute( SQL['REF']['select_suite'], VALUES )
TEMP = MYSQL['cursor'].fetchall()
- if len( TEMP ) > 0:
- print ("[WARN] MYSQL : Duplicate REF Suite, id = %(id)s, name = %(name)s" % TEMP[0])
-
- else:
-
-
- table = "trbs_ref_suite"
-
- try:
- sql = makeInsertSQL( table, VALUES )
-
- #print sql
- #exit()
-
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
-
- print "[INFO] MYSQL : INSERT to", table, ", trbs_ref_id =", DINFO['ref_id'], ", name =", suite
-
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
+ table = "trbs_ref_suite"
+ sql = ""
+ if len( TEMP ) > 0:
+ sql = makeUpdateSQL( table, VALUES , TEMP[0]['id'])
+ print ("[INFO] MYSQL : Updated REF Suite, id = %(id)s, name = %(name)s" % TEMP[0])
+ else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table, ", trbs_ref_id =", DINFO['ref_id'], ", name =", suite
+ try:
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
+ except MySQLdb.Error, e:
+ try:
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
SQL['TCT'] = {}
+
# select tct
SQL['TCT']['select'] = (
"SELECT * "
MYSQL['cursor'].execute( SQL['TCT']['select'], DINFO )
TEMP = MYSQL['cursor'].fetchall()
- if len( TEMP ) > 0:
- DINFO['trbs_tct_id'] = TEMP[0]['id']
- print ("[WARN] MYSQL : Duplicate TCT, id = %(id)s, sr_name = %(sr_name)s" % TEMP[0])
-
- else:
-
- #pprint.pprint( CONFIG['RAW']['TCT'] )
- #pprint.pprint( DINFO )
-
- VALUES = {
- 'sr_status_id' : DINFO['sr_status_id'],
- 'ref_id' : DINFO['ref_id'],
- 'sr_name' : DINFO['sr'],
- 'snapshot_num' : DINFO['snapshot_num'],
- 'profile' : CONFIG['RAW']['TCT']['environment']['tct_profile'],
- 'total' : CONFIG['RAW']['TCT']['COUNT']['total_case'],
- 'pass' : CONFIG['RAW']['TCT']['COUNT']['pass_case'],
- 'fail' : CONFIG['RAW']['TCT']['COUNT']['fail_case'],
- 'block' : CONFIG['RAW']['TCT']['COUNT']['block_case'],
- 'na' : CONFIG['RAW']['TCT']['COUNT']['na_case'],
- 'pcnt' : round( (float(CONFIG['RAW']['TCT']['COUNT']['pass_case'])/float(CONFIG['RAW']['TCT']['COUNT']['total_case']))*100, 2 ),
- 'plan_name' : CONFIG['RAW']['TCT']['plan_name'],
- 'time_start' : CONFIG['RAW']['TCT']['start_at'],
- 'time_end' : CONFIG['RAW']['TCT']['end_at'],
- 'build_id' : CONFIG['RAW']['TCT']['environment']['build_id'],
- 'device_id' : CONFIG['RAW']['TCT']['environment']['device_id'],
- 'device_model' : CONFIG['RAW']['TCT']['environment']['device_model'],
- 'device_name' : CONFIG['RAW']['TCT']['environment']['device_name'],
- 'device_host' : CONFIG['RAW']['TCT']['environment']['device_host'],
- 'manufacturer' : CONFIG['RAW']['TCT']['environment']['manufacturer'],
- 'tct_profile' : CONFIG['RAW']['TCT']['environment']['tct_profile'],
- 'tct_version' : CONFIG['RAW']['TCT']['environment']['tct_version'],
- 'url' : CONFIG['RAW']['TCT']['url']
- }
+ VALUES = {
+ 'sr_status_id' : DINFO['sr_status_id'],
+ 'ref_id' : DINFO['ref_id'],
+ 'sr_name' : DINFO['sr'],
+ 'snapshot_num' : DINFO['snapshot_num'],
+ 'profile' : CONFIG['RAW']['TCT']['environment']['tct_profile'],
+ 'total' : CONFIG['RAW']['TCT']['COUNT']['total_case'],
+ 'pass' : CONFIG['RAW']['TCT']['COUNT']['pass_case'],
+ 'fail' : CONFIG['RAW']['TCT']['COUNT']['fail_case'],
+ 'block' : CONFIG['RAW']['TCT']['COUNT']['block_case'],
+ 'na' : CONFIG['RAW']['TCT']['COUNT']['na_case'],
+ 'pcnt' : round( (float(CONFIG['RAW']['TCT']['COUNT']['pass_case'])/float(CONFIG['RAW']['TCT']['COUNT']['total_case']))*100, 2 ),
+ 'plan_name' : CONFIG['RAW']['TCT']['plan_name'],
+ 'time_start' : CONFIG['RAW']['TCT']['start_at'],
+ 'time_end' : CONFIG['RAW']['TCT']['end_at'],
+ 'build_id' : CONFIG['RAW']['TCT']['environment']['build_id'],
+ 'device_id' : CONFIG['RAW']['TCT']['environment']['device_id'],
+ 'device_model' : CONFIG['RAW']['TCT']['environment']['device_model'],
+ 'device_name' : CONFIG['RAW']['TCT']['environment']['device_name'],
+ 'device_host' : CONFIG['RAW']['TCT']['environment']['device_host'],
+ 'manufacturer' : CONFIG['RAW']['TCT']['environment']['manufacturer'],
+ 'tct_profile' : CONFIG['RAW']['TCT']['environment']['tct_profile'],
+ 'tct_version' : CONFIG['RAW']['TCT']['environment']['tct_version'],
+ 'url' : CONFIG['RAW']['TCT']['url']
+ }
- #pprint.pprint( VALUES )
-
- table = "trbs_tct"
-
- try:
- sql = makeInsertSQL( table, VALUES )
-
- #print sql
- #exit()
-
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
-
- print "[INFO] MYSQL : INSERT to", table, ", build_id =", VALUES['build_id']
-
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
-
+ table = "trbs_tct"
+ sql = ""
- MYSQL['cursor'].execute( SQL['TCT']['select'], DINFO )
- TEMP = MYSQL['cursor'].fetchall()
+ if len( TEMP ) > 0:
+ DINFO['trbs_tct_id'] = TEMP[0]['id']
+ sql = makeUpdateSQL( table, VALUES , DINFO['trbs_tct_id'])
+ print ("[Info] MYSQL : Updated TCT, id = %(id)s, sr_name = %(sr_name)s" % TEMP[0])
- # 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
- if len( TEMP ) > 0:
- DINFO['trbs_tct_id'] = TEMP[0]['id']
- print ("[INFO] MYSQL : TCT id = %(id)s, build_id = %(build_id)s" % TEMP[0])
- else:
- print "[ERROR] MYSQL : Can not process TCT"
- exit(1)
+ else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table, ", build_id =", VALUES['build_id']
+ try:
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
+ except MySQLdb.Error, e:
+ try:
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
+ MYSQL['cursor'].execute( SQL['TCT']['select'], DINFO )
+ TEMP = MYSQL['cursor'].fetchall()
+ # 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
+ if len( TEMP ) > 0:
+ DINFO['trbs_tct_id'] = TEMP[0]['id']
+ print ("[INFO] MYSQL : TCT id = %(id)s, build_id = %(build_id)s" % TEMP[0])
+ else:
+ print "[ERROR] MYSQL : Can not process TCT"
+ exit(1)
- #pprint.pprint( CONFIG['RAW']['TCT'] )
- #exit()
for suite in CONFIG['RAW']['TCT']['SUITE'].keys():
- #pprint.pprint( CONFIG['RAW']['TCT']['SUITE'][suite] )
- #pprint.pprint( DINFO )
- #exit()
-
VALUES = {
'trbs_tct_id' : DINFO['trbs_tct_id'],
'name' : suite,
'na_rate' : CONFIG['RAW']['TCT']['SUITE'][suite]['na_rate']
}
-
-
SQL['TCT']['select_suite'] = (
"SELECT * "
"FROM trbs_tct_suite "
MYSQL['cursor'].execute( SQL['TCT']['select_suite'], VALUES )
TEMP = MYSQL['cursor'].fetchall()
+ table = "trbs_tct_suite"
+ sql = ""
+
if len( TEMP ) > 0:
- print ("[WARN] MYSQL : Duplicate TCT Suite, id = %(id)s, name = %(name)s" % TEMP[0])
+ sql = makeUpdateSQL( table, VALUES, TEMP[0]['id'] )
+ print ("[INFO] MYSQL : Updated TCT Suite, id = %(id)s, name = %(name)s" % TEMP[0])
else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table, ", trbs_tct_id =", DINFO['trbs_tct_id'], ", name =", suite
+ try:
+ #print sql
+ #exit()
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
- table = "trbs_tct_suite"
+ except MySQLdb.Error, e:
try:
- sql = makeInsertSQL( table, VALUES )
-
- #print sql
- #exit()
-
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
-
- print "[INFO] MYSQL : INSERT to", table, ", trbs_tct_id =", DINFO['trbs_tct_id'], ", name =", suite
-
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
"WHERE sr_name = %(sr)s AND snapshot_num = %(snapshot_num)s ORDER BY id DESC"
)
+
+ VALUES = {
+ 'sr_status_id' : DINFO['sr_status_id'],
+ 'sr_name' : DINFO['sr'],
+ 'snapshot_num' : DINFO['snapshot_num'],
+ 'profile' : CONFIG['RAW']['TCT']['environment']['tct_profile'],
+ 'total' : CONFIG['RAW']['SMOKES']['COUNT']['total_case'],
+ 'pass' : CONFIG['RAW']['SMOKES']['COUNT']['pass_case'],
+ 'fail' : CONFIG['RAW']['SMOKES']['COUNT']['fail_case'],
+ 'pcnt' : round( (float(CONFIG['RAW']['SMOKES']['COUNT']['pass_case'])/float(CONFIG['RAW']['SMOKES']['COUNT']['total_case']))*100, 2 ),
+ 'time_start' : CONFIG['RAW']['TCT']['start_at'],
+ 'time_end' : CONFIG['RAW']['TCT']['start_at'],
+ 'url' : CONFIG['RAW']['TCT']['url']
+ }
+
MYSQL['cursor'].execute( SQL['SMOKES']['select'], DINFO )
TEMP = MYSQL['cursor'].fetchall()
+ table = "trbs_smoke"
+ sql = ""
+
if len( TEMP ) > 0:
DINFO['trbs_smoke_id'] = TEMP[0]['id']
- print ("[WARN] MYSQL : Duplicate SMOKE, id = %(id)s, sr_name = %(sr_name)s" % TEMP[0])
+ sql = makeUpdateSQL( table, VALUES, DINFO['trbs_smoke_id'] )
+ print ("[INFO] MYSQL : Updated SMOKE, id = %(id)s, sr_name = %(sr_name)s" % TEMP[0])
else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table
- #pprint.pprint( CONFIG['RAW']['SMOKES'] )
- #exit()
- VALUES = {
- 'sr_status_id' : DINFO['sr_status_id'],
- 'sr_name' : DINFO['sr'],
- 'snapshot_num' : DINFO['snapshot_num'],
- 'profile' : CONFIG['RAW']['TCT']['environment']['tct_profile'],
- 'total' : CONFIG['RAW']['SMOKES']['COUNT']['total_case'],
- 'pass' : CONFIG['RAW']['SMOKES']['COUNT']['pass_case'],
- 'fail' : CONFIG['RAW']['SMOKES']['COUNT']['fail_case'],
- 'pcnt' : round( (float(CONFIG['RAW']['SMOKES']['COUNT']['pass_case'])/float(CONFIG['RAW']['SMOKES']['COUNT']['total_case']))*100, 2 ),
- 'time_start' : CONFIG['RAW']['TCT']['start_at'],
- 'time_end' : CONFIG['RAW']['TCT']['start_at'],
- 'url' : CONFIG['RAW']['TCT']['url']
- }
-
-
- #pprint.pprint( VALUES )
- #exit()
-
- table = "trbs_smoke"
+ try:
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
+ except MySQLdb.Error, e:
try:
- sql = makeInsertSQL( table, VALUES )
-
- #print sql
- #exit()
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
- print "[INFO] MYSQL : INSERT to", table
-
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
-
-
-
- MYSQL['cursor'].execute( SQL['SMOKES']['select'], DINFO )
- TEMP = MYSQL['cursor'].fetchall()
-
- # 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
- if len( TEMP ) > 0:
- DINFO['trbs_smoke_id'] = TEMP[0]['id']
- print ("[INFO] MYSQL : SMOKE id = %(id)s" % TEMP[0])
- else:
- print "[ERROR] MYSQL : Can not process SMOKE"
- exit(1)
+ MYSQL['cursor'].execute( SQL['SMOKES']['select'], DINFO )
+ TEMP = MYSQL['cursor'].fetchall()
+ # 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
+ if len( TEMP ) > 0:
+ DINFO['trbs_smoke_id'] = TEMP[0]['id']
+ print ("[INFO] MYSQL : SMOKE id = %(id)s" % TEMP[0])
+ else:
+ print "[ERROR] MYSQL : Can not process SMOKE"
+ exit(1)
#pprint.pprint( CONFIG['RAW']['SMOKES'] )
#exit()
- for suite in CONFIG['RAW']['SMOKES']['SUITE'].keys():
- #pprint.pprint( CONFIG['RAW']['SMOKES']['SUITE'][suite] )
- #pprint.pprint( DINFO )
- #exit()
+
+ for suite in CONFIG['RAW']['SMOKES']['SUITE'].keys():
VALUES = {
'trbs_smoke_id' : DINFO['trbs_smoke_id'],
'fail' : CONFIG['RAW']['SMOKES']['SUITE'][suite]['COUNT']['fail_case'],
}
- #pprint.pprint( VALUES )
- #exit()
-
SQL['SMOKES']['select_suite'] = (
"SELECT * "
"FROM trbs_smoke_suite "
"WHERE trbs_smoke_id = %(trbs_smoke_id)s AND name = %(name)s"
)
+
MYSQL['cursor'].execute( SQL['SMOKES']['select_suite'], VALUES )
TEMP = MYSQL['cursor'].fetchall()
+
+ table = "trbs_smoke_suite"
+ sql = ""
+
if len( TEMP ) > 0:
DINFO['trbs_smoke_suite_id'] = TEMP[0]['id']
- print ("[WARN] MYSQL : Duplicate SMOKE Suite, id = %(id)s, name = %(name)s" % TEMP[0])
+ sql = makeUpdateSQL( table, VALUES , DINFO['trbs_smoke_suite_id'] )
+ print ("[INFO] MYSQL : Updated SMOKE Suite, id = %(id)s, name = %(name)s" % TEMP[0])
else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table, ", trbs_smoke_id =", DINFO['trbs_smoke_id'], ", name =", suite
+ try:
+ #print sql
+ #exit()
- table = "trbs_smoke_suite"
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
+ except MySQLdb.Error, e:
try:
- sql = makeInsertSQL( table, VALUES )
-
- #print sql
- #exit()
-
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
-
- print "[INFO] MYSQL : INSERT to", table, ", trbs_smoke_id =", DINFO['trbs_smoke_id'], ", name =", suite
-
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
-
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
- MYSQL['cursor'].execute( SQL['SMOKES']['select_suite'], VALUES )
- TEMP = MYSQL['cursor'].fetchall()
+ # check
+ MYSQL['cursor'].execute( SQL['SMOKES']['select_suite'], VALUES )
+ TEMP = MYSQL['cursor'].fetchall()
- if len( TEMP ) == 0:
- print "[ERROR] MYSQL : Can not process SMOKE Suite"
- else:
- DINFO['trbs_smoke_suite_id'] = TEMP[0]['id']
+ if len( TEMP ) == 0:
+ print "[ERROR] MYSQL : Can not process SMOKE Suite"
+ else:
+ DINFO['trbs_smoke_suite_id'] = TEMP[0]['id']
for testcase in CONFIG['RAW']['SMOKES']['SUITE'][suite]['TESTCASE'].keys():
MYSQL['cursor'].execute( SQL['SMOKES']['select_suite_test'], VALUES )
TEMP = MYSQL['cursor'].fetchall()
- if len( TEMP ) > 0:
- print ("[WARN] MYSQL : Duplicate SMOKE Suite Test, id = %(id)s, name = %(name)s" % TEMP[0])
- else:
-
- table = "trbs_smoke_suite_test"
-
- try:
- sql = makeInsertSQL( table, VALUES )
-
- #print sql
- #exit()
-
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
-
- print "[INFO] MYSQL : INSERT to", table, ", trbs_smoke_suite_id =", DINFO['trbs_smoke_suite_id'], ", name =", testcase
-
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
-
-
-
-
-
-
-
-
-
+ table = "trbs_smoke_suite_test"
+ sql = ""
+ if len( TEMP ) > 0:
+ sql = makeUpdateSQL( table, VALUES , TEMP[0]['id'] )
+ print ("[INFO] MYSQL : Updated SMOKE Suite Test, id = %(id)s, name = %(name)s" % TEMP[0])
+ else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table, ", trbs_smoke_suite_id =", DINFO['trbs_smoke_suite_id'], ", name =", testcase
+ try:
+ #print sql
+ #exit()
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
+ except MySQLdb.Error, e:
+ try:
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
MYSQL['cursor'].execute( SQL['PERFS']['select'], DINFO )
TEMP = MYSQL['cursor'].fetchall()
+
+ VALUES = {
+ 'sr_status_id' : DINFO['sr_status_id'],
+ 'sr_name' : DINFO['sr'],
+ 'snapshot_num' : DINFO['snapshot_num'],
+ 'profile' : CONFIG['RAW']['TCT']['environment']['tct_profile'],
+ 'device_core' : CONFIG['RAW']['PERFS']['DEVICE']['Core_Nums'],
+ 'device_dvfs' : CONFIG['RAW']['PERFS']['DEVICE']['Def._DVFS_governor'],
+ 'device_freq' : CONFIG['RAW']['PERFS']['DEVICE']['Frequency_range'],
+ 'device_kernel' : CONFIG['RAW']['PERFS']['DEVICE']['Kernel_ver.'],
+ 'device_platform' : CONFIG['RAW']['PERFS']['DEVICE']['Platform_ver.'],
+ 'total' : CONFIG['RAW']['PERFS']['COUNT']['total_case'],
+ 'pass' : CONFIG['RAW']['PERFS']['COUNT']['pass_case'],
+ 'fail' : CONFIG['RAW']['PERFS']['COUNT']['fail_case'],
+ 'pcnt' : round( (float(CONFIG['RAW']['PERFS']['COUNT']['pass_case'])/float(CONFIG['RAW']['PERFS']['COUNT']['total_case']))*100, 2 ),
+ 'time_start' : CONFIG['RAW']['TCT']['start_at'],
+ 'time_end' : CONFIG['RAW']['TCT']['start_at'],
+ 'url' : CONFIG['RAW']['TCT']['url']
+ }
+
+ table = "trbs_perf"
+ sql = ""
+
if len( TEMP ) > 0:
DINFO['trbs_perf_id'] = TEMP[0]['id']
- print ("[WARN] MYSQL : Duplicate PERF, id = %(id)s, sr_name = %(sr_name)s" % TEMP[0])
+ sql = makeUpdateSQL( table, VALUES,DINFO['trbs_perf_id'] )
+ print ("[INFO] MYSQL : Updated PERF, id = %(id)s, sr_name = %(sr_name)s" % TEMP[0])
else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table
- #pprint.pprint( CONFIG['RAW']['PERFS'] )
- #exit()
+ try:
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
- VALUES = {
- 'sr_status_id' : DINFO['sr_status_id'],
- 'sr_name' : DINFO['sr'],
- 'snapshot_num' : DINFO['snapshot_num'],
- 'profile' : CONFIG['RAW']['TCT']['environment']['tct_profile'],
- 'device_core' : CONFIG['RAW']['PERFS']['DEVICE']['Core_Nums'],
- 'device_dvfs' : CONFIG['RAW']['PERFS']['DEVICE']['Def._DVFS_governor'],
- 'device_freq' : CONFIG['RAW']['PERFS']['DEVICE']['Frequency_range'],
- 'device_kernel' : CONFIG['RAW']['PERFS']['DEVICE']['Kernel_ver.'],
- 'device_platform' : CONFIG['RAW']['PERFS']['DEVICE']['Platform_ver.'],
- 'total' : CONFIG['RAW']['PERFS']['COUNT']['total_case'],
- 'pass' : CONFIG['RAW']['PERFS']['COUNT']['pass_case'],
- 'fail' : CONFIG['RAW']['PERFS']['COUNT']['fail_case'],
- 'pcnt' : round( (float(CONFIG['RAW']['PERFS']['COUNT']['pass_case'])/float(CONFIG['RAW']['PERFS']['COUNT']['total_case']))*100, 2 ),
- 'time_start' : CONFIG['RAW']['TCT']['start_at'],
- 'time_end' : CONFIG['RAW']['TCT']['start_at'],
- 'url' : CONFIG['RAW']['TCT']['url']
- }
-
- #pprint.pprint( VALUES )
- #exit()
-
- table = "trbs_perf"
+ except MySQLdb.Error, e:
try:
- sql = makeInsertSQL( table, VALUES )
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
- #print sql
- #exit()
-
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
-
- print "[INFO] MYSQL : INSERT to", table
-
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
+ MYSQL['cursor'].execute( SQL['PERFS']['select'], DINFO )
+ TEMP = MYSQL['cursor'].fetchall()
- MYSQL['cursor'].execute( SQL['PERFS']['select'], DINFO )
- TEMP = MYSQL['cursor'].fetchall()
-
- # 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
- if len( TEMP ) > 0:
- DINFO['trbs_perf_id'] = TEMP[0]['id']
- print ("[INFO] MYSQL : PERF id = %(id)s" % TEMP[0])
- else:
- print "[ERROR] MYSQL : Can not process PERF"
- exit(1)
+ # 결과가 1개 이거나 아니면 latest 결과가 정답일 것이라 전제
+ if len( TEMP ) > 0:
+ DINFO['trbs_perf_id'] = TEMP[0]['id']
+ print ("[INFO] MYSQL : PERF id = %(id)s" % TEMP[0])
+ else:
+ print "[ERROR] MYSQL : Can not process PERF"
+ exit(1)
MYSQL['cursor'].execute( SQL['PERFS']['select_suite'], VALUES )
TEMP = MYSQL['cursor'].fetchall()
+ table = "trbs_perf_suite"
+ sql = ""
+
if len( TEMP ) > 0:
DINFO['trbs_perf_suite_id'] = TEMP[0]['id']
- print ("[WARN] MYSQL : Duplicate PERF Suite, id = %(id)s, name = %(name)s" % TEMP[0])
+ sql = makeUpdateSQL( table, VALUES, DINFO['trbs_perf_suite_id'] )
+ print ("[INFO] MYSQL : Updated PERF Suite, id = %(id)s, name = %(name)s" % TEMP[0])
else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table, ", trbs_perf_id =", DINFO['trbs_perf_id'], ", name =", suite
- table = "trbs_perf_suite"
-
- try:
- sql = makeInsertSQL( table, VALUES )
- #print sql
- #exit()
+ try:
+ #print sql
+ #exit()
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
- print "[INFO] MYSQL : INSERT to", table, ", trbs_perf_id =", DINFO['trbs_perf_id'], ", name =", suite
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
+ except MySQLdb.Error, e:
+ try:
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
+ MYSQL['cursor'].execute( SQL['PERFS']['select_suite'], VALUES )
+ TEMP = MYSQL['cursor'].fetchall()
- MYSQL['cursor'].execute( SQL['PERFS']['select_suite'], VALUES )
- TEMP = MYSQL['cursor'].fetchall()
+ if len( TEMP ) == 0:
+ print "[ERROR] MYSQL : Can not process PERF Suite"
+ else:
+ DINFO['trbs_perf_suite_id'] = TEMP[0]['id']
- if len( TEMP ) == 0:
- print "[ERROR] MYSQL : Can not process PERF Suite"
- else:
- DINFO['trbs_perf_suite_id'] = TEMP[0]['id']
for testcase in CONFIG['RAW']['PERFS']['SUITE'][suite]['TESTCASE'].keys():
MYSQL['cursor'].execute( SQL['PERFS']['select_suite_test'], VALUES )
TEMP = MYSQL['cursor'].fetchall()
+ table = "trbs_perf_suite_test"
+ sql = ""
+
if len( TEMP ) > 0:
- print ("[WARN] MYSQL : Duplicate PERF Suite Test, id = %(id)s, name = %(name)s" % TEMP[0])
+ sql = makeUpdateSQL( table, VALUES, TEMP[0]['id'] )
+ print ("[INFO] MYSQL : Updated PERF Suite Test, id = %(id)s, name = %(name)s" % TEMP[0])
else:
+ sql = makeInsertSQL( table, VALUES )
+ print "[INFO] MYSQL : INSERT to", table, ", trbs_perf_suite_id =", DINFO['trbs_perf_suite_id'], ", name =", testcase
- table = "trbs_perf_suite_test"
-
- try:
- sql = makeInsertSQL( table, VALUES )
-
- #print sql
- #exit()
-
- MYSQL['cursor'].execute( sql )
- MYSQL['connection'].commit()
-
- print "[INFO] MYSQL : INSERT to", table, ", trbs_perf_suite_id =", DINFO['trbs_perf_suite_id'], ", name =", testcase
- except MySQLdb.Error, e:
- try:
- print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
- except IndexError:
- print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
+ try:
+ MYSQL['cursor'].execute( sql )
+ MYSQL['connection'].commit()
+ except MySQLdb.Error, e:
+ try:
+ print "[ERROR] MYSQL : [%d]: %s (%s)" % (e.args[0], e.args[1], sql)
+ except IndexError:
+ print "[ERROR] MYSQL : %s (%s)" % (str(e), sql)
exit(0)