Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SystemReady
edk2-test-parser
Commits
5e373f5f
Commit
5e373f5f
authored
Aug 27, 2020
by
Jeff Booher-Kaeding
Browse files
fixed issue with Command line argument off by 1
parent
769bfa14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Parser.py
View file @
5e373f5f
#SCT log parser
###Dict structure:
#tests = {
# <guid> : test_dict
# <guid2> : test_dict2...
#}
#test_dict = {
# "name": "some test",
# "result": "pass/fail",
# "group": "some group",
# "test set": "some set",
# "sub set": "some subset",
# "set guid": "XXXXXX",
# "guid": "XXXXXX",
# "comment": "some comment"
# "log": "full log output"
#}
import
sys
#based loosley on https://stackoverflow.com/a/4391978
...
...
@@ -119,15 +100,15 @@ def seq_parser(file):
def
main
():
#Command line argument 1, file to open, else open sample
file
=
sys
.
argv
[
2
]
if
len
(
sys
.
argv
)
>=
2
else
"sample.ekl"
file
=
sys
.
argv
[
1
]
if
len
(
sys
.
argv
)
>=
2
else
"sample.ekl"
db
=
{}
#files are encoded in utf-16
with
open
(
file
,
"r"
,
encoding
=
"utf-16"
)
as
f
:
db
=
ekl_parser
(
f
.
readlines
())
#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"
find_key
=
sys
.
argv
[
2
]
if
len
(
sys
.
argv
)
>=
4
else
"result"
find_value
=
sys
.
argv
[
3
]
if
len
(
sys
.
argv
)
>=
4
else
"WARNING"
#if default search for Warnings
found
=
key_value_find
(
db
,
find_key
,
find_value
)
...
...
@@ -166,6 +147,13 @@ def main():
temp_dict
=
key_value_find
(
db
,
"set guid"
,
x
)
if
not
(
temp_dict
):
print
(
"test set"
,
db2
[
x
][
"name"
],
"was not found, possible silent drop"
)
#TODO: add structure to generate CSV summary
#including
# pass/fail
# failed test sets
# dropped tests sets
# failed tests info
# all tests
main
()
example_dicts.txt
0 → 100644
View file @
5e373f5f
###Dict structure:
tests = {
<guid> : test_dict
<guid2> : test_dict2...
}
test_dict = {
"name": "some test",
"result": "pass/fail",
"group": "some group",
"test set": "some set",
"sub set": "some subset",
"set guid": "XXXXXX",
"guid": "XXXXXX",
"comment": "some comment"
"log": "full log output"
}
seqs = {
<guid> : seq_dict
<guid2> : seq_dict2...
}
seq_dict = {
"name": "set name",
"guid": "set guid",
"Iteration": "some hex/num of how many times to run",
"rev": "some hex/numb",
"Order": "some hex/num"
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment