testing_test.py revision 88c8aac3277c6fd841cb774f6815a14e37f3182f
1#!/usr/bin/python2
2"""Test for sysroot_wrapper bisector.
3
4All files in bad_files will be determined to be bad. This test was made for
5chromeos-chrome built for a daisy board, if you are using another package you
6will need to change the base_path accordingly.
7"""
8
9from __future__ import print_function
10
11import subprocess
12import sys
13import os
14
15base_path = ('/var/cache/chromeos-chrome/chrome-src-internal/src/out_daisy/'
16             'Release/obj/')
17bad_files = [
18    os.path.join(base_path, 'base/base.cpu.o'),
19    os.path.join(base_path, 'base/base.version.o'),
20    os.path.join(base_path, 'apps/apps.launcher.o')
21]
22
23bisect_dir = os.environ.get('BISECT_DIR', '/tmp/sysroot_bisect')
24
25
26def Main(_):
27  for test_file in bad_files:
28    test_file = test_file.strip()
29    cmd = ['grep', test_file, os.path.join(bisect_dir, 'BAD_SET')]
30    ret = subprocess.call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
31    if not ret:
32      return 1
33  return 0
34
35
36if __name__ == '__main__':
37  sys.exit(Main(sys.argv[1:]))
38