1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3# Copyright 2020 The ChromiumOS Authors 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6 7"""Change portions of the object files to good. 8 9The "portion" is defined by the file (which is passed as the only argument to 10this script) content. Every line in the file is an object index, which will be 11set to good (mark as 0). 12 13This script is meant to be specifically used with the set_file test. This uses 14the set files generated by binary_search_state to do the switching. 15""" 16 17 18import os 19import sys 20 21from binary_search_tool.test import common 22 23 24def Main(_): 25 working_set = common.ReadWorkingSet() 26 27 if not os.path.exists(os.environ["BISECT_GOOD_SET"]): 28 print("Good set file does not exist!") 29 return 1 30 31 object_index = common.ReadObjectIndex(os.environ["BISECT_GOOD_SET"]) 32 33 for oi in object_index: 34 working_set[int(oi)] = 0 35 36 common.WriteWorkingSet(working_set) 37 38 return 0 39 40 41if __name__ == "__main__": 42 retval = Main(sys.argv) 43 sys.exit(retval) 44