• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"""Check to see if the working set produces a good executable.
8
9This test script is made for the noincremental-prune test. This makes sure
10that, after pruning starts (>1 bad item is found), that the number of args sent
11to the switch scripts is equals to the actual number of items (i.e. checking
12that noincremental always holds).
13"""
14
15from __future__ import print_function
16
17import os
18import sys
19
20from binary_search_tool.test import common
21
22
23def Main():
24  working_set = common.ReadWorkingSet()
25
26  with open('noinc_prune_good', 'r', encoding='utf-8') as good_args:
27    num_good_args = len(good_args.readlines())
28
29  with open('noinc_prune_bad', 'r', encoding='utf-8') as bad_args:
30    num_bad_args = len(bad_args.readlines())
31
32  num_args = num_good_args + num_bad_args
33  if num_args != len(working_set):
34    print('Only %d args, expected %d' % (num_args, len(working_set)))
35    print('%d good args, %d bad args' % (num_good_args, num_bad_args))
36    return 3
37
38  os.remove('noinc_prune_bad')
39  os.remove('noinc_prune_good')
40
41  if not os.path.exists('./is_setup'):
42    return 1
43  for w in working_set:
44    if w == 1:
45      return 1  ## False, linking failure
46  return 0
47
48
49if __name__ == '__main__':
50  retval = Main()
51  sys.exit(retval)
52