fif/test.py

38 lines
929 B
Python
Executable file

#!/usr/bin/env python
import re
import subprocess
def main():
match = re.search(
r'rust-version ?= ?"([\d.]+)"',
open("Cargo.toml", "r").read(-1)
)
if not match:
print("Couldn't find rust-version")
exit(1)
versions = [match.group(1), "stable", "beta", "nightly"]
backends = ["xdg-mime", "infer"]
done = 0
target = len(versions) * len(backends) * 2
for version in versions:
for backend in backends:
print(f"[{version}, {backend}] Tests")
subprocess.run(f"cargo +{version} test --features={backend}-backend".split(" "))
done += 1
print(f"Success - {done} of {target} complete")
print(f"[{version}, {backend}] Scanning imgs")
subprocess.run(f"cargo +{version} run --release --features={backend}-backend -- -E images imgs".split(" "))
done += 1
print(f"Success - {done} of {target} complete")
print("Done! You might want to run cargo clean...")
if __name__ == "__main__":
main()