• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This binary requires the following linker variables:
6// - main.UseCCache: Whether to use ccache.
7// - main.ConfigName: Name of the configuration to use.
8//   See config.go for the supported values.
9//
10// The script ./build simplifies the call to `go build`.
11// E.g. ./build --use_ccache=true --config=cros.hardened will build a
12// binary that uses the ccache for ChromeOS with hardened flags.
13//
14// Test arguments:
15// - updategolden: To update the golden results for the wrapper. Without it,
16//   the tests will verify that the wrapper output matches the goldens.
17// - rungolden: To filter the golden tests by a regex for the wrapper env, path and args.
18//
19// Examples:
20// - run all tests in isolation:
21// 		go test third_party/toolchain-utils/compiler_wrapper/ -v
22package main
23
24import (
25	"log"
26	"os"
27)
28
29func main() {
30	env, err := newProcessEnv()
31	if err != nil {
32		log.Fatal(err)
33	}
34	cfg, err := getRealConfig()
35	if err != nil {
36		log.Fatal(err)
37	}
38	// Note: callCompiler will exec the command. Only in case of
39	// an error or when we run other commands like bisect
40	// will this os.Exit be called.
41	os.Exit(callCompiler(env, cfg, newProcessCommand()))
42}
43