python formatting

This commit is contained in:
Lynne Megido 2022-01-24 00:16:06 +10:00
parent e834c3e7fa
commit ee6224e98c
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90

13
test.py
View file

@ -1,13 +1,13 @@
#!/usr/bin/env python #!/usr/bin/env python
# SPDX-FileCopyrightText: 2021-2022 Lynnesbian # SPDX-FileCopyrightText: 2021-2022 Lynnesbian
#
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
import re import re
import subprocess import subprocess
import sys import sys
def test_archs(): def test_archs():
archs = ["aarch64", "powerpc", "riscv64gc"] archs = ["aarch64", "powerpc", "riscv64gc"]
upto = 1 upto = 1
@ -15,9 +15,12 @@ def test_archs():
for arch in archs: for arch in archs:
print(f"Testing {arch} ({upto} of {target})") print(f"Testing {arch} ({upto} of {target})")
subprocess.run(f"cross test --features=json,infer-backend --target {arch}-unknown-linux-gnu".split(" ")).check_returncode() subprocess\
.run(f"cross test --features=json,infer-backend --target {arch}-unknown-linux-gnu".split(" "))\
.check_returncode()
upto += 1 upto += 1
def test_versions(): def test_versions():
match = re.search( match = re.search(
r'rust-version ?= ?"([\d.]+)"', r'rust-version ?= ?"([\d.]+)"',
@ -41,9 +44,12 @@ def test_versions():
upto += 1 upto += 1
print(f"[{version}, {backend}] Scanning imgs ({upto} of {target})") print(f"[{version}, {backend}] Scanning imgs ({upto} of {target})")
subprocess.run(f"cargo +{version} run --release --features=json,{backend}-backend -- imgs".split(" ")).check_returncode() subprocess\
.run(f"cargo +{version} run --release --features=json,{backend}-backend -- imgs".split(" "))\
.check_returncode()
upto += 1 upto += 1
def main(): def main():
done_something = False done_something = False
if "versions" in sys.argv: if "versions" in sys.argv:
@ -60,5 +66,6 @@ def main():
print("Done! You might want to run cargo clean...") print("Done! You might want to run cargo clean...")
subprocess.run(["du", "-sh", "target"]) subprocess.run(["du", "-sh", "target"])
if __name__ == "__main__": if __name__ == "__main__":
main() main()