diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/qa | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/scripts/qa b/scripts/qa new file mode 100755 index 0000000..e5133f0 --- /dev/null +++ b/scripts/qa | |||
@@ -0,0 +1,60 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | |||
3 | from subprocess import Popen, PIPE | ||
4 | from glob import glob | ||
5 | from os.path import dirname, join, abspath, exists | ||
6 | from os import chdir | ||
7 | import signal | ||
8 | |||
9 | root = abspath(dirname(dirname(dirname(__file__)))) | ||
10 | print("Root dir is:" + root) | ||
11 | |||
12 | args = ['bitbake', 'core-image-minimal'] | ||
13 | |||
14 | |||
15 | class Runner(object): | ||
16 | UNKNOWN = 'unknown' | ||
17 | PASS = 'pass' | ||
18 | FAIL = 'fail' | ||
19 | SKIP = 'skipped' | ||
20 | |||
21 | def __init__(self, dirs): | ||
22 | self._dirs = dirs | ||
23 | self._child = None | ||
24 | self._results = {} | ||
25 | for d in dirs: | ||
26 | self._results[d] = self.UNKNOWN | ||
27 | |||
28 | def run(self): | ||
29 | for d in self._dirs: | ||
30 | chdir(d) | ||
31 | if exists(join(d, '.qaskip')): | ||
32 | print("Skipping %s because of .qaskip file" % d) | ||
33 | self._results[d] = self.SKIP | ||
34 | continue | ||
35 | print("Building in " + d) | ||
36 | self._child = Popen(args=args, cwd=d, stdin=PIPE) | ||
37 | retcode = self._child.wait() | ||
38 | self._child = None | ||
39 | if retcode == 0: | ||
40 | self._results[d] = self.PASS | ||
41 | else: | ||
42 | self._results[d] = self.FAIL | ||
43 | print("Error, stopping qa script at %s" % d) | ||
44 | break | ||
45 | for d, result in self._results.items(): | ||
46 | print("%20s %s" % (d, result)) | ||
47 | |||
48 | def handle_signal(self, signo, stack_frame): | ||
49 | if self._child: | ||
50 | self._child | ||
51 | |||
52 | |||
53 | def main(): | ||
54 | dirs = glob(join(root, 'build*')) | ||
55 | runner = Runner(dirs) | ||
56 | signal.signal(signalnum=signal.SIGINT, handler=runner.handle_signal) | ||
57 | runner.run() | ||
58 | |||
59 | if __name__ == "__main__": | ||
60 | main() | ||