xref: /aosp_15_r20/external/toolchain-utils/binary_search_tool/test/switch_to_good.py (revision 760c253c1ed00ce9abd48f8546f08516e57485fe)
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"""
13
14
15import sys
16
17from binary_search_tool.test import common
18
19
20def Main(argv):
21    working_set = common.ReadWorkingSet()
22    object_index = common.ReadObjectIndex(argv[1])
23
24    for oi in object_index:
25        working_set[int(oi)] = 0
26
27    common.WriteWorkingSet(working_set)
28
29    return 0
30
31
32if __name__ == "__main__":
33    retval = Main(sys.argv)
34    sys.exit(retval)
35