Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2aac150
Splitting test log
rchiodo Oct 7, 2020
bcd65e9
Fix problem with kernels ports being reused
rchiodo Oct 8, 2020
a908fe1
Make kernel launcher port round robin only for testing
rchiodo Oct 8, 2020
629e881
Make formatters change only apply during testing
rchiodo Oct 8, 2020
e64ff0b
Add news entry
rchiodo Oct 8, 2020
30aaacd
Apply black formatting
rchiodo Oct 8, 2020
cd0fe62
Code review feedback and skip flakey remote password test
rchiodo Oct 8, 2020
d4e19f7
Another flakey test
rchiodo Oct 8, 2020
56076da
More CR feedback
rchiodo Oct 8, 2020
688fb58
Missed a spot
rchiodo Oct 8, 2020
64ff3ef
Merge remote-tracking branch 'origin/main' into rchiodo/more_flake_fa…
rchiodo Oct 9, 2020
e922c10
Some more log parser changes and try to get interrupt to be less flakey
rchiodo Oct 9, 2020
47b34a9
Fix interrupt killing kernel and add more logging for export
rchiodo Oct 9, 2020
24ef1ef
More logging
rchiodo Oct 9, 2020
908f7b0
See if updating fixes the problem
rchiodo Oct 9, 2020
7b78058
Dont delete temp files
rchiodo Oct 9, 2020
2095505
Upload webview output to figure out trust failure
rchiodo Oct 9, 2020
1177f3e
Add name to step
rchiodo Oct 9, 2020
58e2469
Merge remote-tracking branch 'origin/main' into rchiodo/more_flake_fa…
rchiodo Oct 9, 2020
3763991
Try another way to upload
rchiodo Oct 9, 2020
c6a08e7
Upload doesn't seem to work
rchiodo Oct 9, 2020
3043960
Try a different way to upload
rchiodo Oct 9, 2020
97183b9
Try without webview logging as this makes the test pass
rchiodo Oct 9, 2020
2c3decc
Try fixing test another way. Any logging is making the test pass
rchiodo Oct 9, 2020
f1765f9
Compile error
rchiodo Oct 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply black formatting
  • Loading branch information
rchiodo committed Oct 8, 2020
commit 30aaacd8d6c6d64e4bd641f533bcbb75ae44de57
55 changes: 32 additions & 23 deletions pythonFiles/vscode_datascience_helpers/tests/logParser.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
import sys
import argparse
import os

os.system("color")
from pathlib import Path
import re

parser = argparse.ArgumentParser(description='Parse a test log into its parts')
parser.add_argument('testlog', type=str, nargs=1, help='Log to parse')
parser.add_argument('--testoutput', action='store_true', help='Show all failures and passes')
parser.add_argument('--split', action='store_true', help='Split into per process files. Each file will have the pid appended')
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
pid_regex = re.compile(r'(\d+).*')
parser = argparse.ArgumentParser(description="Parse a test log into its parts")
parser.add_argument("testlog", type=str, nargs=1, help="Log to parse")
parser.add_argument(
"--testoutput", action="store_true", help="Show all failures and passes"
)
parser.add_argument(
"--split",
action="store_true",
help="Split into per process files. Each file will have the pid appended",
)
ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
pid_regex = re.compile(r"(\d+).*")


def printTestOutput(testlog):
# Find all the lines that don't have a PID in them. These are the test output
p = Path(testlog[0])
with p.open() as f:
for line in f.readlines():
stripped = line.strip()
if (len(stripped) > 2 and stripped[0] == '\x1B' and stripped[1] == '['):
print(line.rstrip()) # Should be a test line as it has color encoding
if len(stripped) > 2 and stripped[0] == "\x1B" and stripped[1] == "[":
print(line.rstrip()) # Should be a test line as it has color encoding


def splitByPid(testlog):
# Split testlog into prefixed logs based on pid
Expand All @@ -30,46 +39,46 @@ def splitByPid(testlog):
pid = None
with p.open() as f:
for line in f.readlines():
stripped = ansi_escape.sub('', line.strip())
stripped = ansi_escape.sub("", line.strip())
# See if starts with a pid
if (len(stripped) > 0 and stripped[0] <= '9' and stripped[0] >= '0'):
if len(stripped) > 0 and stripped[0] <= "9" and stripped[0] >= "0":
# Pull out the pid
match = pid_regex.match(stripped)

# Pids are at least two digits
if (match != None and len(match.group(1)) > 2):
if match != None and len(match.group(1)) > 2:
# Pid is found
pid = int(match.group(1))

# See if we've created a log for this pid or not
if (not pid in pids):
if not pid in pids:
pids.add(pid)
logFile = '{}_{}.log'.format(baseFile, pid)
print('Writing to new log: ' + logFile)
logFile = "{}_{}.log".format(baseFile, pid)
print("Writing to new log: " + logFile)
logs[pid] = Path(logFile).open(mode="w")

# Add this line to the log
if (pid != None):
if pid != None:
logs[pid].write(line)
# Close all of the open logs
for key in logs:
logs[key].close()




def doWork(args):
if (not args.testlog):
print('Test log should be passed')
elif (args.testoutput):
if not args.testlog:
print("Test log should be passed")
elif args.testoutput:
printTestOutput(args.testlog)
elif (args.split):
elif args.split:
splitByPid(args.testlog)
else:
parser.print_usage()


def main():
doWork(parser.parse_args())


if __name__ == "__main__":
main()
main()