Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group GitHub Actions logging messages #235

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ check: qtest

test: qtest scripts/driver.py
$(Q)scripts/check-repo.sh
scripts/driver.py -c
$(Q)if [ -n "$$GITHUB_ACTIONS" ]; then \
scripts/driver.py -c --group-output; \
else \
scripts/driver.py -c; \
fi
Comment on lines +65 to +69
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do this. The test driver should be aware of the environments.


valgrind_existence:
@which valgrind 2>&1 > /dev/null || (echo "FATAL: valgrind not found"; exit 1)
Expand Down
19 changes: 15 additions & 4 deletions scripts/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Tracer:
autograde = False
useValgrind = False
colored = False
groupOutput = False

traceDict = {
1: "trace-01-ops",
Expand Down Expand Up @@ -69,13 +70,15 @@ def __init__(self,
verbLevel=0,
autograde=False,
useValgrind=False,
colored=False):
colored=False,
groupOutput=False):
if qtest != "":
self.qtest = qtest
self.verbLevel = verbLevel
self.autograde = autograde
self.useValgrind = useValgrind
self.colored = colored
self.groupOutput = groupOutput

def printInColor(self, text, color):
if self.colored == False:
Expand Down Expand Up @@ -117,9 +120,13 @@ def run(self, tid=0):
tname = self.traceDict[t]
if self.verbLevel > 0:
print("+++ TESTING trace %s:" % tname)
if self.groupOutput:
print("::group::Trace %s" % tname, flush=True)
ok = self.runTrace(t)
maxval = self.maxScores[t]
tval = maxval if ok else 0
if self.groupOutput:
print("::endgroup::", flush=True)
if tval < maxval:
self.printInColor("---\t%s\t%d/%d" % (tname, tval, maxval), self.RED)
else:
Expand All @@ -146,7 +153,7 @@ def run(self, tid=0):
sys.exit(1)

def usage(name):
print("Usage: %s [-h] [-p PROG] [-t TID] [-v LEVEL] [--valgrind] [-c]" % name)
print("Usage: %s [-h] [-p PROG] [-t TID] [-v LEVEL] [--valgrind] [-c] [--group-output]" % name)
print(" -h Print this message")
print(" -p PROG Program to test")
print(" -t TID Trace ID to test")
Expand All @@ -163,8 +170,9 @@ def run(name, args):
autograde = False
useValgrind = False
colored = False
groupOutput = False

optlist, args = getopt.getopt(args, 'hp:t:v:A:c', ['valgrind'])
optlist, args = getopt.getopt(args, 'hp:t:v:A:c', ['valgrind', 'group-output'])
for (opt, val) in optlist:
if opt == '-h':
usage(name)
Expand All @@ -181,6 +189,8 @@ def run(name, args):
useValgrind = True
elif opt == '-c':
colored = True
elif opt == '--group-output':
groupOutput = True
else:
print("Unrecognized option '%s'" % opt)
usage(name)
Expand All @@ -190,7 +200,8 @@ def run(name, args):
verbLevel=vlevel,
autograde=autograde,
useValgrind=useValgrind,
colored=colored)
colored=colored,
groupOutput=groupOutput)
t.run(tid)


Expand Down
Loading