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"""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 switch script is made for the noincremental-prune test. This makes sure 14that, after pruning starts (>1 bad item is found), that the number of args sent 15to the switch scripts is equals to the actual number of items (i.e. checking 16that noincremental always holds). 17 18Warning: This switch script assumes the --file_args option 19""" 20 21from __future__ import print_function 22 23import shutil 24import sys 25 26from binary_search_tool.test import common 27 28 29def Main(argv): 30 working_set = common.ReadWorkingSet() 31 object_index = common.ReadObjectIndex(argv[1]) 32 33 for oi in object_index: 34 working_set[int(oi)] = 0 35 36 shutil.copy(argv[1], './noinc_prune_good') 37 38 common.WriteWorkingSet(working_set) 39 40 return 0 41 42 43if __name__ == '__main__': 44 retval = Main(sys.argv) 45 sys.exit(retval) 46