summaryrefslogtreecommitdiff
path: root/cts
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-07-14 14:19:14 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-26 19:43:40 +0000
commitf37d95b3edc6ff7bbda96fe7a4147273db66c306 (patch)
treeaaf408cfa525efce460cddb4153101b1db492109 /cts
parent160af3cb3634f645ef0ca1a3c312c68cc3316869 (diff)
downloadchrome-ec-f37d95b3edc6ff7bbda96fe7a4147273db66c306.tar.gz
ec: Switch black to 80 cols and reformat files
Add pyproject.toml config file to set black to 80 columns. Remove column length overrides from other config files. Reformat python files to 80 cols. BRANCH=None BUG=b:238434058 TEST=presubmit/CQ Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I870a68f1bb751f4bad97024045f6e3075489e80f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3764071 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'cts')
-rw-r--r--cts/common/board.py15
-rwxr-xr-xcts/cts.py37
2 files changed, 41 insertions, 11 deletions
diff --git a/cts/common/board.py b/cts/common/board.py
index 68071f0b28..19b39c07cb 100644
--- a/cts/common/board.py
+++ b/cts/common/board.py
@@ -271,7 +271,14 @@ class Board(six.with_metaclass(ABCMeta, object)):
for device in com_devices:
self.tty_port = os.path.join(dev_dir, device)
properties = sp.check_output(
- ["udevadm", "info", "-a", "-n", self.tty_port, "--query=property"],
+ [
+ "udevadm",
+ "info",
+ "-a",
+ "-n",
+ self.tty_port,
+ "--query=property",
+ ],
**get_subprocess_args()
)
for line in [l.strip() for l in properties.split("\n")]:
@@ -394,7 +401,11 @@ class DeviceUnderTest(Board):
# If len(dut) is 0 then your dut doesn't use an st-link device, so we
# don't have to worry about its serial number
if not dut:
- msg = "Failed to find serial for DUT.\nIs " + self.board + " connected?"
+ msg = (
+ "Failed to find serial for DUT.\nIs "
+ + self.board
+ + " connected?"
+ )
raise RuntimeError(msg)
if len(dut) > 1:
msg = (
diff --git a/cts/cts.py b/cts/cts.py
index b29c849c0c..27620dd894 100755
--- a/cts/cts.py
+++ b/cts/cts.py
@@ -81,10 +81,14 @@ class Cts(object):
"""Build images for DUT and TH."""
print("Building DUT image...")
if not self.dut.build(self.ec_dir):
- raise RuntimeError("Building module %s for DUT failed" % (self.module))
+ raise RuntimeError(
+ "Building module %s for DUT failed" % (self.module)
+ )
print("Building TH image...")
if not self.th.build(self.ec_dir):
- raise RuntimeError("Building module %s for TH failed" % (self.module))
+ raise RuntimeError(
+ "Building module %s for TH failed" % (self.module)
+ )
def flash_boards(self):
"""Flashes TH and DUT with their most recently built ec.bin."""
@@ -134,7 +138,9 @@ class Cts(object):
d["name"] = l[0].strip()
d["th_rc"] = self.get_return_code_value(l[1].strip().strip('"'))
d["th_string"] = l[2].strip().strip('"')
- d["dut_rc"] = self.get_return_code_value(l[3].strip().strip('"'))
+ d["dut_rc"] = self.get_return_code_value(
+ l[3].strip().strip('"')
+ )
d["dut_string"] = l[4].strip().strip('"')
tests.append(d)
return tests
@@ -246,7 +252,10 @@ class Cts(object):
for i, v in enumerate(self.testlist):
if v["th_string"] in th_results[i]["output"] or not v["th_string"]:
th_results[i]["string"] = True
- if v["dut_string"] in dut_results[i]["output"] or not v["dut_string"]:
+ if (
+ v["dut_string"] in dut_results[i]["output"]
+ or not v["dut_string"]
+ ):
dut_results[i]["string"] = True
return th_results, dut_results
@@ -260,7 +269,8 @@ class Cts(object):
"""
len_test_name = max(len(s["name"]) for s in self.testlist)
len_code_name = max(
- len(self.get_return_code_name(v, True)) for v in self.return_codes.values()
+ len(self.get_return_code_name(v, True))
+ for v in self.return_codes.values()
)
head = "{:^" + str(len_test_name) + "} "
@@ -283,7 +293,9 @@ class Cts(object):
th_cn = self.get_return_code_name(th_results[i]["rc"], True)
dut_cn = self.get_return_code_name(dut_results[i]["rc"], True)
th_res = self.evaluate_result(
- th_results[i], self.testlist[i]["th_rc"], self.testlist[i]["th_string"]
+ th_results[i],
+ self.testlist[i]["th_rc"],
+ self.testlist[i]["th_string"],
)
dut_res = self.evaluate_result(
dut_results[i],
@@ -398,8 +410,12 @@ def main():
module = "meta"
parser = argparse.ArgumentParser(description="Used to build/flash boards")
- parser.add_argument("-d", "--dut", help="Specify DUT you want to build/flash")
- parser.add_argument("-m", "--module", help="Specify module you want to build/flash")
+ parser.add_argument(
+ "-d", "--dut", help="Specify DUT you want to build/flash"
+ )
+ parser.add_argument(
+ "-m", "--module", help="Specify module you want to build/flash"
+ )
parser.add_argument(
"-s",
"--setup",
@@ -407,7 +423,10 @@ def main():
help="Connect only the TH to save its serial",
)
parser.add_argument(
- "-b", "--build", action="store_true", help="Build test suite (no flashing)"
+ "-b",
+ "--build",
+ action="store_true",
+ help="Build test suite (no flashing)",
)
parser.add_argument(
"-f",