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
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
15from __future__ import print_function
16
17import sys
18
19from binary_search_tool.test import common
20
21
22def Main(argv):
23  working_set = common.ReadWorkingSet()
24  object_index = common.ReadObjectIndex(argv[1])
25
26  # Random number so the results can be checked
27  for oi in object_index:
28    working_set[int(oi)] = 42
29
30  common.WriteWorkingSet(working_set)
31  with open('tmp_file', 'w', encoding='utf-8') as f:
32    f.write(argv[1])
33
34  return 0
35
36
37if __name__ == '__main__':
38  retval = Main(sys.argv)
39  sys.exit(retval)
40