1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# Copyright 2020 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""Test for sysroot_wrapper bisector.
8
9All files in bad_files will be determined to be bad. This test was made for
10chromeos-chrome built for a daisy board, if you are using another package you
11will need to change the base_path accordingly.
12"""
13
14from __future__ import print_function
15
16import subprocess
17import sys
18import os
19
20base_path = ('/var/cache/chromeos-chrome/chrome-src-internal/src/out_daisy/'
21             'Release/obj/')
22bad_files = [
23    os.path.join(base_path, 'base/base.cpu.o'),
24    os.path.join(base_path, 'base/base.version.o'),
25    os.path.join(base_path, 'apps/apps.launcher.o')
26]
27
28bisect_dir = os.environ.get('BISECT_DIR', '/tmp/sysroot_bisect')
29
30
31def Main(_):
32  for test_file in bad_files:
33    test_file = test_file.strip()
34    cmd = ['grep', test_file, os.path.join(bisect_dir, 'BAD_SET')]
35    ret = subprocess.call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
36    if not ret:
37      return 1
38  return 0
39
40
41if __name__ == '__main__':
42  sys.exit(Main(sys.argv[1:]))
43