1
0
Fork 0
nix-scripts/extended-tests.py

35 lines
889 B
Python
Raw Normal View History

2019-02-18 23:53:48 +08:00
import json
import sys
2019-02-19 00:50:05 +08:00
import time
import subprocess
2019-02-19 00:50:05 +08:00
import os
import artiq
2019-02-17 20:26:46 +08:00
with open(sys.argv[1], "r") as hydra_json_file:
hydra_json = json.load(hydra_json_file)
2019-02-18 23:53:48 +08:00
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:]
2019-02-18 23:53:48 +08:00
with open(hydra_log, "w") as log:
2019-02-19 00:50:05 +08:00
def run(*args, **kwargs):
subprocess.run(args, stdout=log, stderr=log, **kwargs).check_returncode()
run("artiq_flash", "-t", "kc705", "-V", "nist_clock")
2019-02-19 00:50:05 +08:00
2019-02-19 01:10:07 +08:00
time.sleep(15)
2019-02-19 00:50:05 +08:00
2019-02-19 01:10:07 +08:00
# ping: socket: Operation not permitted
#run("ping", "kc705-1", "-c10", "-w30")
2019-02-19 00:50:05 +08:00
env = {
2019-02-19 01:16:07 +08:00
"ARTIQ_ROOT": artiq.__path__[0] + "/examples/kc705_nist_clock",
2019-02-19 00:50:05 +08:00
"ARTIQ_LOW_LATENCY": "1"
}
env.update(os.environ)
2019-02-19 01:22:17 +08:00
run("python", "-m", "unittest", "discover", "-v", "artiq.test.coredevice", env=env)