Commit 97db24ed authored by Jeff Booher-Kaeding's avatar Jeff Booher-Kaeding
Browse files

basic seq parser done, might adjust key-value find funcition.

parent 27697bc5
......@@ -21,7 +21,7 @@ import sys
#based loosley on
# returns a filterd dict of dicts that meet some Key-value pair.
# I.E. key="result" value="FAILURE"
def find(group, key, value):
def key_value_find(group, key, value):
found = {}
for guid in group:
test = group[guid]
......@@ -44,11 +44,12 @@ def test_parser(string,current_group ="N/A",current_test_set="N/A"):
return test_dict["guid"], test_dict
#Parse the ekl file, and create a map of the tests
def ekl_parser (file):
#create our "database" dict
db_dict = dict()
#All tests are grouped by the "HEAD" line the procedes them.
current_group = "N/A"
current_set = "N/A"
......@@ -71,30 +72,68 @@ def ekl_parser (file):
elif split_line[0][0] != " ":
#deliminiate on ':' for tests
split_test = [new_string for old_string in split_line for new_string in old_string.split(':')]
#put the test into a dict, and then place that dict in another dict with GUID as key
guid,tmp_dict = test_parser(split_test,current_group,current_set)
return db_dict
def main():
def seq_parser(file):
db_dict = dict()
#a test in a seq file is 7 lines, if not mod7, something wrong..
if len(lines)%magic != 0:
sys.exit("seqfile cut short, should be mod7")
for x in range(0,len(lines),magic):
#[Test Case]
if not "0xFFFFFFFF" in lines[x+5]:
seq_dict = {
"name": lines[x+3][5:-1],#from after "Name=" to end (5char long)
"guid": lines[x+2][5:-1],#from after"Guid=" to the end, (5char long)
"Iteration": lines[x+5][11:-1],#from after "Iterations=" (11char long)
"rev": lines[x+1][9:-1],#from after "Revision=" (9char long)
"Order": lines[x+4][6:-1]#from after "Order=" (6char long)
return db_dict
def main():
#Command line argument 1, file to open, else open sample
file = sys.argv[2] if len(sys.argv) >= 2 else "sample.ekl"
db = {}
with open(file,"r",encoding="utf-16") as f:
db = ekl_parser(f.readlines())
#print the final dict,
#print entries
#find all passing tests,
find_key = sys.argv[3] if len(sys.argv) >= 4 else "result"
find_value = sys.argv[4] if len(sys.argv) >= 4 else "WARNING"
passes = find(db,find_key,find_value)
#print the dict
# print number of passing
#print the final dict,
#print entries
#command line argument 2&3, key and value to find.
find_key = sys.argv[3] if len(sys.argv) >= 4 else "result"
find_value = sys.argv[4] if len(sys.argv) >= 4 else "WARNING"
passes = key_value_find(db,find_key,find_value)
#print the dict
#print number of passing
file2 = "sample.seq"
db2 = {}
with open(file2,"r",encoding="utf-16") as f:
db2 = seq_parser(f)
\ No newline at end of file
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment