blob: 6a3ca2b7ae9774344f550310da9cc449ef249711 [file] [log] [blame]
Damien Martin-Guillerezf88f4d82015-09-25 13:56:55 +00001// Copyright 2014 The Bazel Authors. All rights reserved.
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +01002//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package com.google.devtools.build.lib.testutil;
16
17import com.google.common.collect.ImmutableList;
nharmatad922e652017-05-17 20:29:19 +020018import com.google.devtools.build.lib.packages.PackageFactory.BuilderFactoryForTesting;
Luis Fernando Pino Duqueb1b28b62016-02-25 14:25:19 +000019import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass.InvocationPolicy;
janakr150858b2017-07-25 00:04:53 +020020import com.google.devtools.build.lib.skyframe.SkyframeExecutor;
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010021
22/**
23 * Various constants required by the tests.
24 */
25public class TestConstants {
26 private TestConstants() {
27 }
28
Luis Fernando Pino Duquebe102182016-05-23 14:03:55 +000029 public static final String PRODUCT_NAME = "bazel";
30
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010031 /**
32 * A list of all embedded binaries that go into the regular Bazel binary.
33 */
34 public static final ImmutableList<String> EMBEDDED_TOOLS = ImmutableList.of(
35 "build-runfiles",
Philipp Wollermann278814b2016-07-15 14:41:54 +000036 "linux-sandbox",
Chris Parsonsf4888182016-01-08 00:42:14 +000037 "process-wrapper",
38 "xcode-locator");
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010039
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010040 /**
41 * Location in the bazel repo where embedded binaries come from.
42 */
Damien Martin-Guillerezb09c97a2015-04-01 11:17:16 +000043 public static final ImmutableList<String> EMBEDDED_SCRIPTS_PATHS = ImmutableList.of(
Kristina Chodorow93fbc3e2016-04-27 17:03:28 +000044 "io_bazel/src/main/tools");
Ulf Adamsff031542015-02-24 10:00:51 +000045
46 /**
Han-Wen Nienhuysceae8c52015-09-22 16:24:45 +000047 * Default workspace name.
48 */
Kristina Chodorow4b71d2e2016-05-03 15:06:39 +000049 public static final String WORKSPACE_NAME = "__main__";
Han-Wen Nienhuysceae8c52015-09-22 16:24:45 +000050
51 /**
Ulf Adamsd5baac02015-02-25 14:18:14 +000052 * Name of a class with an INSTANCE field of type AnalysisMock to be used for analysis tests.
53 */
Ulf Adams7c5eefb2015-03-03 14:52:46 +000054 public static final String TEST_ANALYSIS_MOCK =
Ulf Adams570c17f2015-04-23 18:12:56 +000055 "com.google.devtools.build.lib.analysis.mock.BazelAnalysisMock";
Ulf Adamsd5baac02015-02-25 14:18:14 +000056
57 /**
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010058 * Directory where we can find bazel's Java tests, relative to a test's runfiles directory.
59 */
Kristina Chodorow93fbc3e2016-04-27 17:03:28 +000060 public static final String JAVATESTS_ROOT = "io_bazel/src/test/java/";
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010061
aehligfb059882017-12-20 06:02:07 -080062 /** Relative path to the process-wrapper tool. */
63 public static final String PROCESS_WRAPPER_PATH
64 = "io_bazel/src/main/tools/process-wrapper";
rupertsbec2fe82017-12-05 21:53:50 -080065
aehligfb059882017-12-20 06:02:07 -080066 /** Relative path to the spend_cpu_time testing tool. */
67 public static final String CPU_TIME_SPENDER_PATH
68 = "io_bazel/src/test/shell/integration/spend_cpu_time";
rupertsbec2fe82017-12-05 21:53:50 -080069
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010070 public static final String TEST_RULE_CLASS_PROVIDER =
71 "com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider";
Kristina Chodorow76d94b12015-12-16 16:12:52 +000072 public static final String TEST_RULE_MODULE =
73 "com.google.devtools.build.lib.bazel.rules.BazelRulesModule";
Lukacs Berki72c40712017-01-31 14:52:55 +000074 public static final String TEST_REAL_UNIX_FILE_SYSTEM =
Ulf Adams8afbd3c2017-02-28 10:42:48 +000075 "com.google.devtools.build.lib.unix.UnixFileSystem";
Lukacs Berki72c40712017-01-31 14:52:55 +000076
janakr150858b2017-07-25 00:04:53 +020077 public static void processSkyframeExecutorForTesting(SkyframeExecutor skyframeExecutor) {}
78
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010079 public static final ImmutableList<String> IGNORED_MESSAGE_PREFIXES = ImmutableList.<String>of();
Ulf Adamsd87465e2015-04-17 13:16:51 +000080
cpeyser478f7632017-07-05 18:03:47 -040081 public static final String WORKSPACE_CONTENT = "";
82
Dmitry Lomove36a66c2017-02-17 14:48:48 +000083 public static final String GCC_INCLUDE_PATH = "external/bazel_tools/tools/cpp/gcc3";
Dmitry Lomovece87c22015-11-26 19:22:56 +000084
cparsons81ce9e32017-08-27 19:28:32 +020085 /** The path in which the mock cc crosstool resides. */
86 public static final String MOCK_CC_CROSSTOOL_PATH = "tools/cpp";
Dmitry Lomove0a69aa2015-11-30 16:25:40 +000087
cparsons81ce9e32017-08-27 19:28:32 +020088 /** The workspace repository label under which built-in tools reside. */
89 public static final String TOOLS_REPOSITORY = "@bazel_tools";
90 /** The file path in which to create files so that they end up under {@link #TOOLS_REPOSITORY}. */
91 public static final String TOOLS_REPOSITORY_SCRATCH = "/bazel_tools_workspace/";
92 /** The output file path prefix for tool file dependencies. */
93 public static final String TOOLS_REPOSITORY_PATH_PREFIX = "external/bazel_tools/";
Ulf Adamsc934fad2015-12-22 07:42:11 +000094
95 public static final ImmutableList<String> DOCS_RULES_PATHS = ImmutableList.of(
96 "src/main/java/com/google/devtools/build/lib/rules");
Luis Fernando Pino Duqueb1b28b62016-02-25 14:25:19 +000097
John Cater17a1ae92017-01-25 15:18:25 +000098 // Constants used to determine how genrule pulls in the setup script.
99 public static final String GENRULE_SETUP = "@bazel_tools//tools/genrule:genrule-setup.sh";
100 public static final String GENRULE_SETUP_PATH = "genrule-setup.sh";
101
cparsons81ce9e32017-08-27 19:28:32 +0200102 /**
103 * A list of flags required to support use of the crosstool on OSX.
104 */
105 public static final ImmutableList<String> OSX_CROSSTOOL_FLAGS =
106 ImmutableList.of();
107
Luis Fernando Pino Duqueb1b28b62016-02-25 14:25:19 +0000108 public static final InvocationPolicy TEST_INVOCATION_POLICY =
109 InvocationPolicy.getDefaultInstance();
Nathan Harmata3ad56452016-06-10 16:17:45 +0000110
nharmatad922e652017-05-17 20:29:19 +0200111 public static final BuilderFactoryForTesting PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING =
112 PackageFactoryBuilderFactoryForBazelUnitTests.INSTANCE;
janakr3d443252017-10-10 23:03:26 +0200113
114 /** A choice of test execution mode, only varies internally. */
115 public enum InternalTestExecutionMode {
116 NORMAL
117 }
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +0100118}