-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carl Delsey
committed
Aug 23, 2019
1 parent
cb3f76e
commit 18bf2a6
Showing
2 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/python3 | ||
|
||
# To use this script, run the `test_updown_reliablity` script and log the output | ||
# > ./test_updown_reliablity |& tee /tmp/updown.log | ||
# When the test is completed, pipe the log to this script to get a summary of the | ||
# results | ||
# > ./updownresults.py < /tmp/updown.log | ||
# | ||
# This reports the number of successful tests, but also the number of times the | ||
# tests were able to make it to the active state as well as the shutdown state. | ||
# It can frequently occur that the system makes all the lifecycle state transitions | ||
# but has an error during the final process termination. | ||
|
||
import sys | ||
|
||
def main(): | ||
log = sys.stdin | ||
test_count = 0 | ||
fail_count = 0 | ||
successful_bringup_count = 0 | ||
successful_shutdown_count = 0 | ||
for line in log.readlines(): | ||
if line.startswith('======= START OF RUN:'): | ||
test_successful = True | ||
shutdown_successful = False | ||
bringup_successful = False | ||
|
||
if line.startswith('======== END OF RUN:'): | ||
test_count += 1 | ||
conclusion = "" | ||
if bringup_successful: | ||
successful_bringup_count += 1 | ||
conclusion = " but bringup was successful" | ||
if shutdown_successful: | ||
successful_shutdown_count +=1 | ||
conclusion = " but shutdown was successful" | ||
if not test_successful: | ||
fail_count += 1 | ||
print("Failure in test ", test_count, conclusion) | ||
|
||
if '[ERROR]' in line: | ||
test_successful = False | ||
|
||
if 'The system is active' in line: | ||
bringup_successful = True | ||
|
||
if 'The system has been sucessfully shut down' in line: | ||
shutdown_successful = True | ||
|
||
print("Number of tests: ", test_count) | ||
print("Number of successes: ", test_count-fail_count) | ||
print("Number of successful bringups", successful_bringup_count) | ||
print("Number of successful shutdowns", successful_shutdown_count) | ||
|
||
if __name__ == '__main__': | ||
main() |