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 9This file is a test switch script. Used only for the test test_tmp_cleanup. 10The "portion" is defined by the file (which is passed as the only argument to 11this script) content. Every line in the file is an object index, which will be 12set to good (mark as 42). 13""" 14 15 16import sys 17 18from binary_search_tool.test import common 19 20 21def Main(argv): 22 working_set = common.ReadWorkingSet() 23 object_index = common.ReadObjectIndex(argv[1]) 24 25 # Random number so the results can be checked 26 for oi in object_index: 27 working_set[int(oi)] = 42 28 29 common.WriteWorkingSet(working_set) 30 with open("tmp_file", "w", encoding="utf-8") as f: 31 f.write(argv[1]) 32 33 return 0 34 35 36if __name__ == "__main__": 37 retval = Main(sys.argv) 38 sys.exit(retval) 39