aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/bisect_flag.go
blob: 2a805352deed914e1fd3b7d2615a62af548fb01a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package main

const bisectPythonCommand = "import bisect_driver; sys.exit(bisect_driver.bisect_driver(sys.argv[1], sys.argv[2], sys.argv[3:]))"

func getBisectStage(env env) string {
	value, _ := env.getenv("BISECT_STAGE")
	return value
}

func calcBisectCommand(env env, bisectStage string, compilerCmd *command) *command {
	bisectDir, _ := env.getenv("BISECT_DIR")
	if bisectDir == "" {
		bisectDir = "/tmp/sysroot_bisect"
	}
	absCompilerPath := getAbsCmdPath(env, compilerCmd)
	return &command{
		Path: "/usr/bin/python2",
		Args: append([]string{
			"-c",
			bisectPythonCommand,
			bisectStage,
			bisectDir,
			absCompilerPath,
		}, compilerCmd.Args...),
		EnvUpdates: compilerCmd.EnvUpdates,
	}
}