From 3ce85ccc112fe800b8060e6299dc8b972ea08a41 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 19 Feb 2019 00:24:08 +0800 Subject: [PATCH] flash board and send output to hydra log --- extended-tests.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/extended-tests.py b/extended-tests.py index d98e284..4556e71 100644 --- a/extended-tests.py +++ b/extended-tests.py @@ -1,14 +1,16 @@ import json -import bz2 import sys +import subprocess -with open(sys.argv[1], "r") as f: - hydra_json = json.load(f) +with open(sys.argv[1], "r") as hydra_json_file: + hydra_json = json.load(hydra_json_file) drv = hydra_json["drvPath"] assert drv.startswith("/nix/store/") drv = drv[len("/nix/store/"):] -hydra_log = "/var/lib/hydra/build-logs/" + drv[:2] + "/" + drv[2:] + ".bz2" +hydra_log = "/var/lib/hydra/build-logs/" + drv[:2] + "/" + drv[2:] -with bz2.BZ2File(hydra_log, "w") as f: - f.write(b"hack successful") +with open(hydra_log, "w") as log: + def run(*args): + subprocess.run(args, stdout=log, stderr=log).check_returncode() + run("artiq_flash", "-t", "kc705", "-V", "nist_clock")