• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python2
2"""Change portions of the object files to good.
3
4The "portion" is defined by the file (which is passed as the only argument to
5this script) content. Every line in the file is an object index, which will be
6set to good (mark as 0).
7
8This script is meant to be specifically used with the set_file test. This uses
9the set files generated by binary_search_state to do the switching.
10"""
11
12from __future__ import print_function
13
14import os
15import sys
16
17import common
18
19
20def Main(_):
21  working_set = common.ReadWorkingSet()
22
23  if not os.path.exists(os.environ['BISECT_GOOD_SET']):
24    print('Good set file does not exist!')
25    return 1
26
27  object_index = common.ReadObjectIndex(os.environ['BISECT_GOOD_SET'])
28
29  for oi in object_index:
30    working_set[int(oi)] = 0
31
32  common.WriteWorkingSet(working_set)
33
34  return 0
35
36
37if __name__ == '__main__':
38  retval = Main(sys.argv)
39  sys.exit(retval)
40