aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/with_crash_on_timeout.py
blob: 915ed51c516c9e3d1170348d2c9726db297fd21f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import print_function
# TODO prettyboy remove after ya-bin release

import os
import sys
import subprocess
import json


def main(args):
    meta_path = os.path.abspath(args[0])
    timeout_code = int(args[1])
    subprocess.check_call(args[2:])
    with open(meta_path) as f:
        meta_info = json.loads(f.read())
        if meta_info["exit_code"] == timeout_code:
            print(meta_info["project"], 'crashed by timeout, use --test-disable-timeout option', file=sys.stderr)
            return 1
    return 0


if __name__ == '__main__':
    main(sys.argv[1:])