1 #!/usr/bin/env python2 2 """Change portions of the object files to good. 3 4 The "portion" is defined by the file (which is passed as the only argument to 5 this script) content. Every line in the file is an object index, which will be 6 set to good (mark as 0). 7 8 This script is meant to be specifically used with the set_file test. This uses 9 the set files generated by binary_search_state to do the switching. 10 """ 11 12 from __future__ import print_function 13 14 import os 15 import sys 16 17 import common 18 19 20 def 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 37 if __name__ == '__main__': 38 retval = Main(sys.argv) 39 sys.exit(retval) 40