]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/x86_64-gnu-tools/checkregression.py
Improve type size assertions
[rust.git] / src / ci / docker / x86_64-gnu-tools / checkregression.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import sys
5 import json
6
7 if __name__ == '__main__':
8     os_name = sys.argv[1]
9     toolstate_file = sys.argv[2]
10     current_state = sys.argv[3]
11     verb = sys.argv[4] # 'regressed' or 'changed'
12
13     with open(toolstate_file, 'r') as f:
14         toolstate = json.load(f)
15     with open(current_state, 'r') as f:
16         current = json.load(f)
17
18     regressed = False
19     for cur in current:
20         tool = cur['tool']
21         state = cur[os_name]
22         new_state = toolstate.get(tool, '')
23         if verb == 'regressed':
24             if tool == 'rls':
25                 # Temporary override until
26                 # https://github.com/rust-lang/rust/issues/60848 is fixed.
27                 updated = False
28             else:
29                 updated = new_state < state
30         elif verb == 'changed':
31             updated = new_state != state
32         else:
33             print('Unknown verb {}'.format(updated))
34             sys.exit(2)
35         if updated:
36             print(
37                 'The state of "{}" has {} from "{}" to "{}"'
38                 .format(tool, verb, state, new_state)
39             )
40             regressed = True
41
42     if regressed:
43         sys.exit(1)