os.test.ListCmd: Add response output convenience symlink

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2023-01-17 11:54:33 +01:00
commit f7542eff89

View file

@ -8,6 +8,7 @@ import traceback
from operator import itemgetter from operator import itemgetter
from functools import total_ordering from functools import total_ordering
from jwutils.log import * from jwutils.log import *
from jwutils.misc import update_symlink
from jwutils import Options from jwutils import Options
from devtest.os import * from devtest.os import *
from devtest.os.test import * from devtest.os.test import *
@ -374,7 +375,9 @@ class ListCmd(TestCase): # export
if self.__write_response and (len(missing) or len(too_many)): if self.__write_response and (len(missing) or len(too_many)):
feature_diff = set(features) - last_features # if len(feature_diff) ? feature_diff = set(features) - last_features # if len(feature_diff) ?
response_path = self.refpath[0] + '.bad' response_path = self.refpath[0] + '.bad'
link_path = None
if tstamp is not None: if tstamp is not None:
link_path = response_path
response_path += '-' + tstamp response_path += '-' + tstamp
feature_diff_str = ', '.join(['"{}"'.format(f) for f in feature_diff]) feature_diff_str = ', '.join(['"{}"'.format(f) for f in feature_diff])
with open(response_path, "w") as f: with open(response_path, "w") as f:
@ -390,6 +393,8 @@ class ListCmd(TestCase): # export
for row in too_many: for row in too_many:
f.write(row.line.strip() + f.write(row.line.strip() +
' # "needed": [{}], "bad": ["default"]\n'.format(feature_diff_str)) ' # "needed": [{}], "bad": ["default"]\n'.format(feature_diff_str))
if link_path is not None:
update_symlink(response_path, link_path)
return and_str.join(r) return and_str.join(r)
async def _run(self, env, machine, phase): async def _run(self, env, machine, phase):
@ -413,4 +418,4 @@ class ListCmd(TestCase): # export
slog(NOTICE, "{}".format(l), caller=caller) slog(NOTICE, "{}".format(l), caller=caller)
def test(self, output, features): def test(self, output, features):
self._eval(output, features) return self._eval(output, features)