scripts: Prefer 1;30-37m ansi codes over 90-97m
Reading Wikipedia: > Later terminals added the ability to directly specify the "bright" > colors with 90–97 and 100–107. So if we want to stick to one pattern, we should probably go with brightness as a separate modifier. This shouldn't noticeably change any script, unless your terminal interprets 90-97m colors differently from 1;30-37m, in which case things should be more consistent now.
This commit is contained in:
+9
-9
@@ -156,7 +156,7 @@ class BenchCase:
|
|||||||
|
|
||||||
for k in config.keys():
|
for k in config.keys():
|
||||||
print('%swarning:%s in %s, found unused key %r' % (
|
print('%swarning:%s in %s, found unused key %r' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[1;33m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
self.name,
|
self.name,
|
||||||
k),
|
k),
|
||||||
@@ -264,7 +264,7 @@ class BenchSuite:
|
|||||||
|
|
||||||
for k in config.keys():
|
for k in config.keys():
|
||||||
print('%swarning:%s in %s, found unused key %r' % (
|
print('%swarning:%s in %s, found unused key %r' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[1;33m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
self.name,
|
self.name,
|
||||||
k),
|
k),
|
||||||
@@ -305,7 +305,7 @@ def compile(bench_paths, **args):
|
|||||||
|
|
||||||
if len(pending_) == len(pending):
|
if len(pending_) == len(pending):
|
||||||
print('%serror:%s cycle detected in suite ordering: {%s}' % (
|
print('%serror:%s cycle detected in suite ordering: {%s}' % (
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
', '.join(suite.name for suite in pending.values())),
|
', '.join(suite.name for suite in pending.values())),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
@@ -319,7 +319,7 @@ def compile(bench_paths, **args):
|
|||||||
for suite in suites:
|
for suite in suites:
|
||||||
if suite.name in seen:
|
if suite.name in seen:
|
||||||
print('%swarning:%s conflicting suite %r, %s and %s' % (
|
print('%swarning:%s conflicting suite %r, %s and %s' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[1;33m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
suite.name,
|
suite.name,
|
||||||
suite.path,
|
suite.path,
|
||||||
@@ -333,7 +333,7 @@ def compile(bench_paths, **args):
|
|||||||
isinstance(seen[case.name], BenchSuite)
|
isinstance(seen[case.name], BenchSuite)
|
||||||
and seen[case.name].cases == [case]):
|
and seen[case.name].cases == [case]):
|
||||||
print('%swarning:%s conflicting case %r, %s and %s' % (
|
print('%swarning:%s conflicting case %r, %s and %s' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[1;33m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
case.name,
|
case.name,
|
||||||
case.path,
|
case.path,
|
||||||
@@ -345,7 +345,7 @@ def compile(bench_paths, **args):
|
|||||||
if not args.get('source'):
|
if not args.get('source'):
|
||||||
if len(suites) > 1:
|
if len(suites) > 1:
|
||||||
print('%serror:%s compiling more than one bench suite? (%r)' % (
|
print('%serror:%s compiling more than one bench suite? (%r)' % (
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
bench_paths),
|
bench_paths),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
@@ -893,7 +893,7 @@ def find_ids(runner, bench_ids=[], **args):
|
|||||||
# no suite/case found? error
|
# no suite/case found? error
|
||||||
if not bench_ids__:
|
if not bench_ids__:
|
||||||
print('%serror:%s no benches match id %r?' % (
|
print('%serror:%s no benches match id %r?' % (
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
id),
|
id),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
@@ -1409,7 +1409,7 @@ def run(runner, bench_ids=[], **args):
|
|||||||
print('%s%s:%d:%sfailure:%s %s%s failed' % (
|
print('%s%s:%d:%sfailure:%s %s%s failed' % (
|
||||||
'\x1b[01m' if args['color'] else '',
|
'\x1b[01m' if args['color'] else '',
|
||||||
path, lineno,
|
path, lineno,
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
failure.id,
|
failure.id,
|
||||||
' (%s)' % ', '.join('%s=%s' % (k,v)
|
' (%s)' % ', '.join('%s=%s' % (k,v)
|
||||||
@@ -1428,7 +1428,7 @@ def run(runner, bench_ids=[], **args):
|
|||||||
print('%s%s:%d:%sassert:%s %s' % (
|
print('%s%s:%d:%sassert:%s %s' % (
|
||||||
'\x1b[01m' if args['color'] else '',
|
'\x1b[01m' if args['color'] else '',
|
||||||
path, lineno,
|
path, lineno,
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
message))
|
message))
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ COLORS = {
|
|||||||
'data': '32',
|
'data': '32',
|
||||||
'corrupt': '31',
|
'corrupt': '31',
|
||||||
'conflict': '30;41',
|
'conflict': '30;41',
|
||||||
'unused': '90',
|
'unused': '1;30',
|
||||||
}
|
}
|
||||||
|
|
||||||
# give more interesting objects a higher priority
|
# give more interesting objects a higher priority
|
||||||
|
|||||||
+1
-1
@@ -1504,7 +1504,7 @@ class TreeArt:
|
|||||||
trunk.append('%s%s%s%s' % (
|
trunk.append('%s%s%s%s' % (
|
||||||
'\x1b[33m' if color and c == 'y'
|
'\x1b[33m' if color and c == 'y'
|
||||||
else '\x1b[31m' if color and c == 'r'
|
else '\x1b[31m' if color and c == 'r'
|
||||||
else '\x1b[90m' if color and c == 'b'
|
else '\x1b[1;30m' if color and c == 'b'
|
||||||
else '',
|
else '',
|
||||||
t,
|
t,
|
||||||
('>' if was else ' ') if d == self.depth-1 else '',
|
('>' if was else ' ') if d == self.depth-1 else '',
|
||||||
|
|||||||
+3
-3
@@ -3800,7 +3800,7 @@ class TreeArt:
|
|||||||
trunk.append('%s%s%s%s' % (
|
trunk.append('%s%s%s%s' % (
|
||||||
'\x1b[33m' if color and c == 'y'
|
'\x1b[33m' if color and c == 'y'
|
||||||
else '\x1b[31m' if color and c == 'r'
|
else '\x1b[31m' if color and c == 'r'
|
||||||
else '\x1b[90m' if color and c == 'b'
|
else '\x1b[1;30m' if color and c == 'b'
|
||||||
else '',
|
else '',
|
||||||
t,
|
t,
|
||||||
('>' if was else ' ') if d == self.depth-1 else '',
|
('>' if was else ' ') if d == self.depth-1 else '',
|
||||||
@@ -4066,7 +4066,7 @@ def dbg_gstate(lfs, *,
|
|||||||
if args.get('gdelta'):
|
if args.get('gdelta'):
|
||||||
for mid, gdelta in gstate.gdeltas:
|
for mid, gdelta in gstate.gdeltas:
|
||||||
print('%s%12s %*s %-*s %s%s' % (
|
print('%s%12s %*s %-*s %s%s' % (
|
||||||
'\x1b[90m' if color else '',
|
'\x1b[1;30m' if color else '',
|
||||||
'{%s}:' % ','.join('%04x' % block
|
'{%s}:' % ','.join('%04x' % block
|
||||||
for block in gdelta.blocks),
|
for block in gdelta.blocks),
|
||||||
2*w_width+1, mid.repr(),
|
2*w_width+1, mid.repr(),
|
||||||
@@ -4185,7 +4185,7 @@ def dbg_files(lfs, paths, *,
|
|||||||
print('%s%12s %*s %-*s %s%s%s' % (
|
print('%s%12s %*s %-*s %s%s%s' % (
|
||||||
'\x1b[31m'
|
'\x1b[31m'
|
||||||
if color and not file.grmed and notes
|
if color and not file.grmed and notes
|
||||||
else '\x1b[90m'
|
else '\x1b[1;30m'
|
||||||
if color and (file.grmed or file.internal)
|
if color and (file.grmed or file.internal)
|
||||||
else '',
|
else '',
|
||||||
'{%s}:' % ','.join('%04x' % block
|
'{%s}:' % ','.join('%04x' % block
|
||||||
|
|||||||
+1
-1
@@ -2399,7 +2399,7 @@ class TreeArt:
|
|||||||
trunk.append('%s%s%s%s' % (
|
trunk.append('%s%s%s%s' % (
|
||||||
'\x1b[33m' if color and c == 'y'
|
'\x1b[33m' if color and c == 'y'
|
||||||
else '\x1b[31m' if color and c == 'r'
|
else '\x1b[31m' if color and c == 'r'
|
||||||
else '\x1b[90m' if color and c == 'b'
|
else '\x1b[1;30m' if color and c == 'b'
|
||||||
else '',
|
else '',
|
||||||
t,
|
t,
|
||||||
('>' if was else ' ') if d == self.depth-1 else '',
|
('>' if was else ' ') if d == self.depth-1 else '',
|
||||||
|
|||||||
+6
-6
@@ -970,7 +970,7 @@ class JumpArt:
|
|||||||
c_start = (
|
c_start = (
|
||||||
'\x1b[33m' if color and c == 'y'
|
'\x1b[33m' if color and c == 'y'
|
||||||
else '\x1b[31m' if color and c == 'r'
|
else '\x1b[31m' if color and c == 'r'
|
||||||
else '\x1b[90m' if color
|
else '\x1b[1;30m' if color
|
||||||
else '')
|
else '')
|
||||||
c_stop = '\x1b[m' if color else ''
|
c_stop = '\x1b[m' if color else ''
|
||||||
|
|
||||||
@@ -1451,7 +1451,7 @@ class TreeArt:
|
|||||||
trunk.append('%s%s%s%s' % (
|
trunk.append('%s%s%s%s' % (
|
||||||
'\x1b[33m' if color and c == 'y'
|
'\x1b[33m' if color and c == 'y'
|
||||||
else '\x1b[31m' if color and c == 'r'
|
else '\x1b[31m' if color and c == 'r'
|
||||||
else '\x1b[90m' if color and c == 'b'
|
else '\x1b[1;30m' if color and c == 'b'
|
||||||
else '',
|
else '',
|
||||||
t,
|
t,
|
||||||
('>' if was else ' ') if d == self.depth-1 else '',
|
('>' if was else ' ') if d == self.depth-1 else '',
|
||||||
@@ -1575,13 +1575,13 @@ def dbg_log(rbyd, *,
|
|||||||
|
|
||||||
# show human-readable tag representation
|
# show human-readable tag representation
|
||||||
print('%s%08x:%s %*s%s%*s %-*s%s%s%s' % (
|
print('%s%08x:%s %*s%s%*s %-*s%s%s%s' % (
|
||||||
'\x1b[90m' if color and j >= rbyd.eoff else '',
|
'\x1b[1;30m' if color and j >= rbyd.eoff else '',
|
||||||
j,
|
j,
|
||||||
'\x1b[m' if color and j >= rbyd.eoff else '',
|
'\x1b[m' if color and j >= rbyd.eoff else '',
|
||||||
l_width, lifetimeart.repr(j, color)
|
l_width, lifetimeart.repr(j, color)
|
||||||
if args.get('lifetimes')
|
if args.get('lifetimes')
|
||||||
else '',
|
else '',
|
||||||
'\x1b[90m' if color and j >= rbyd.eoff else '',
|
'\x1b[1;30m' if color and j >= rbyd.eoff else '',
|
||||||
2*w_width+1, '' if (tag & 0xe000) != 0x0000
|
2*w_width+1, '' if (tag & 0xe000) != 0x0000
|
||||||
else '%d-%d' % (rid-(w-1), rid) if w > 1
|
else '%d-%d' % (rid-(w-1), rid) if w > 1
|
||||||
else rid,
|
else rid,
|
||||||
@@ -1602,7 +1602,7 @@ def dbg_log(rbyd, *,
|
|||||||
if args.get('raw'):
|
if args.get('raw'):
|
||||||
for o, line in enumerate(xxd(data[j:j+d])):
|
for o, line in enumerate(xxd(data[j:j+d])):
|
||||||
print('%s%8s: %*s%*s %s%s' % (
|
print('%s%8s: %*s%*s %s%s' % (
|
||||||
'\x1b[90m' if color and j >= rbyd.eoff else '',
|
'\x1b[1;30m' if color and j >= rbyd.eoff else '',
|
||||||
'%04x' % (j + o*16),
|
'%04x' % (j + o*16),
|
||||||
l_width, '',
|
l_width, '',
|
||||||
2*w_width+1, '',
|
2*w_width+1, '',
|
||||||
@@ -1612,7 +1612,7 @@ def dbg_log(rbyd, *,
|
|||||||
if not tag & TAG_ALT:
|
if not tag & TAG_ALT:
|
||||||
for o, line in enumerate(xxd(data[j+d:j+d+size])):
|
for o, line in enumerate(xxd(data[j+d:j+d+size])):
|
||||||
print('%s%8s: %*s%*s %s%s' % (
|
print('%s%8s: %*s%*s %s%s' % (
|
||||||
'\x1b[90m' if color and j >= rbyd.eoff else '',
|
'\x1b[1;30m' if color and j >= rbyd.eoff else '',
|
||||||
'%04x' % (j+d + o*16),
|
'%04x' % (j+d + o*16),
|
||||||
l_width, '',
|
l_width, '',
|
||||||
2*w_width+1, '',
|
2*w_width+1, '',
|
||||||
|
|||||||
+9
-9
@@ -162,7 +162,7 @@ class TestCase:
|
|||||||
|
|
||||||
for k in config.keys():
|
for k in config.keys():
|
||||||
print('%swarning:%s in %s, found unused key %r' % (
|
print('%swarning:%s in %s, found unused key %r' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[1;33m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
self.name,
|
self.name,
|
||||||
k),
|
k),
|
||||||
@@ -276,7 +276,7 @@ class TestSuite:
|
|||||||
|
|
||||||
for k in config.keys():
|
for k in config.keys():
|
||||||
print('%swarning:%s in %s, found unused key %r' % (
|
print('%swarning:%s in %s, found unused key %r' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[1;33m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
self.name,
|
self.name,
|
||||||
k),
|
k),
|
||||||
@@ -317,7 +317,7 @@ def compile(test_paths, **args):
|
|||||||
|
|
||||||
if len(pending_) == len(pending):
|
if len(pending_) == len(pending):
|
||||||
print('%serror:%s cycle detected in suite ordering: {%s}' % (
|
print('%serror:%s cycle detected in suite ordering: {%s}' % (
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
', '.join(suite.name for suite in pending.values())),
|
', '.join(suite.name for suite in pending.values())),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
@@ -331,7 +331,7 @@ def compile(test_paths, **args):
|
|||||||
for suite in suites:
|
for suite in suites:
|
||||||
if suite.name in seen:
|
if suite.name in seen:
|
||||||
print('%swarning:%s conflicting suite %r, %s and %s' % (
|
print('%swarning:%s conflicting suite %r, %s and %s' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[1;33m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
suite.name,
|
suite.name,
|
||||||
suite.path,
|
suite.path,
|
||||||
@@ -345,7 +345,7 @@ def compile(test_paths, **args):
|
|||||||
isinstance(seen[case.name], TestSuite)
|
isinstance(seen[case.name], TestSuite)
|
||||||
and seen[case.name].cases == [case]):
|
and seen[case.name].cases == [case]):
|
||||||
print('%swarning:%s conflicting case %r, %s and %s' % (
|
print('%swarning:%s conflicting case %r, %s and %s' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[1;33m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
case.name,
|
case.name,
|
||||||
case.path,
|
case.path,
|
||||||
@@ -357,7 +357,7 @@ def compile(test_paths, **args):
|
|||||||
if not args.get('source'):
|
if not args.get('source'):
|
||||||
if len(suites) > 1:
|
if len(suites) > 1:
|
||||||
print('%serror:%s compiling more than one test suite? (%r)' % (
|
print('%serror:%s compiling more than one test suite? (%r)' % (
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
test_paths),
|
test_paths),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
@@ -913,7 +913,7 @@ def find_ids(runner, test_ids=[], **args):
|
|||||||
# no suite/case found? error
|
# no suite/case found? error
|
||||||
if not test_ids__:
|
if not test_ids__:
|
||||||
print('%serror:%s no tests match id %r?' % (
|
print('%serror:%s no tests match id %r?' % (
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
id),
|
id),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
@@ -1381,7 +1381,7 @@ def run(runner, test_ids=[], **args):
|
|||||||
print('%s%s:%d:%sfailure:%s %s%s failed' % (
|
print('%s%s:%d:%sfailure:%s %s%s failed' % (
|
||||||
'\x1b[01m' if args['color'] else '',
|
'\x1b[01m' if args['color'] else '',
|
||||||
path, lineno,
|
path, lineno,
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
failure.id,
|
failure.id,
|
||||||
' (%s)' % ', '.join('%s=%s' % (k,v)
|
' (%s)' % ', '.join('%s=%s' % (k,v)
|
||||||
@@ -1400,7 +1400,7 @@ def run(runner, test_ids=[], **args):
|
|||||||
print('%s%s:%d:%sassert:%s %s' % (
|
print('%s%s:%d:%sassert:%s %s' % (
|
||||||
'\x1b[01m' if args['color'] else '',
|
'\x1b[01m' if args['color'] else '',
|
||||||
path, lineno,
|
path, lineno,
|
||||||
'\x1b[01;31m' if args['color'] else '',
|
'\x1b[1;31m' if args['color'] else '',
|
||||||
'\x1b[m' if args['color'] else '',
|
'\x1b[m' if args['color'] else '',
|
||||||
message))
|
message))
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
|
|||||||
+2
-3
@@ -40,13 +40,12 @@ COLORS = {
|
|||||||
'read': '32',
|
'read': '32',
|
||||||
'prog': '35',
|
'prog': '35',
|
||||||
'erase': '34',
|
'erase': '34',
|
||||||
'noop': '90',
|
'noop': '1;30',
|
||||||
}
|
}
|
||||||
|
|
||||||
# assign chars/colors to varying levels of wear
|
# assign chars/colors to varying levels of wear
|
||||||
WEAR_CHARS = '0123456789'
|
WEAR_CHARS = '0123456789'
|
||||||
# TODO adopt 9x for all of these?
|
WEAR_COLORS = ['1;30', '1;30', '1;30', '', '', '', '', '31', '31', '1;31']
|
||||||
WEAR_COLORS = ['90', '90', '90', '', '', '', '', '31', '31', '91']
|
|
||||||
|
|
||||||
# give more interesting operations a higher priority
|
# give more interesting operations a higher priority
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user