Damien Martin-Guillerez | f88f4d8 | 2015-09-25 13:56:55 +0000 | [diff] [blame] | 1 | // Copyright 2014 The Bazel Authors. All rights reserved. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 2 | // |
| 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 | |
| 15 | package com.google.devtools.build.lib.testutil; |
| 16 | |
| 17 | import com.google.common.collect.ImmutableList; |
nharmata | d922e65 | 2017-05-17 20:29:19 +0200 | [diff] [blame] | 18 | import com.google.devtools.build.lib.packages.PackageFactory.BuilderFactoryForTesting; |
Luis Fernando Pino Duque | b1b28b6 | 2016-02-25 14:25:19 +0000 | [diff] [blame] | 19 | import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass.InvocationPolicy; |
janakr | 150858b | 2017-07-25 00:04:53 +0200 | [diff] [blame] | 20 | import com.google.devtools.build.lib.skyframe.SkyframeExecutor; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Various constants required by the tests. |
| 24 | */ |
| 25 | public class TestConstants { |
| 26 | private TestConstants() { |
| 27 | } |
| 28 | |
Luis Fernando Pino Duque | be10218 | 2016-05-23 14:03:55 +0000 | [diff] [blame] | 29 | public static final String PRODUCT_NAME = "bazel"; |
| 30 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 31 | /** |
| 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 Wollermann | 278814b | 2016-07-15 14:41:54 +0000 | [diff] [blame] | 36 | "linux-sandbox", |
Chris Parsons | f488818 | 2016-01-08 00:42:14 +0000 | [diff] [blame] | 37 | "process-wrapper", |
| 38 | "xcode-locator"); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 39 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 40 | /** |
| 41 | * Location in the bazel repo where embedded binaries come from. |
| 42 | */ |
Damien Martin-Guillerez | b09c97a | 2015-04-01 11:17:16 +0000 | [diff] [blame] | 43 | public static final ImmutableList<String> EMBEDDED_SCRIPTS_PATHS = ImmutableList.of( |
Kristina Chodorow | 93fbc3e | 2016-04-27 17:03:28 +0000 | [diff] [blame] | 44 | "io_bazel/src/main/tools"); |
Ulf Adams | ff03154 | 2015-02-24 10:00:51 +0000 | [diff] [blame] | 45 | |
| 46 | /** |
Han-Wen Nienhuys | ceae8c5 | 2015-09-22 16:24:45 +0000 | [diff] [blame] | 47 | * Default workspace name. |
| 48 | */ |
Kristina Chodorow | 4b71d2e | 2016-05-03 15:06:39 +0000 | [diff] [blame] | 49 | public static final String WORKSPACE_NAME = "__main__"; |
Han-Wen Nienhuys | ceae8c5 | 2015-09-22 16:24:45 +0000 | [diff] [blame] | 50 | |
| 51 | /** |
Ulf Adams | d5baac0 | 2015-02-25 14:18:14 +0000 | [diff] [blame] | 52 | * Name of a class with an INSTANCE field of type AnalysisMock to be used for analysis tests. |
| 53 | */ |
Ulf Adams | 7c5eefb | 2015-03-03 14:52:46 +0000 | [diff] [blame] | 54 | public static final String TEST_ANALYSIS_MOCK = |
Ulf Adams | 570c17f | 2015-04-23 18:12:56 +0000 | [diff] [blame] | 55 | "com.google.devtools.build.lib.analysis.mock.BazelAnalysisMock"; |
Ulf Adams | d5baac0 | 2015-02-25 14:18:14 +0000 | [diff] [blame] | 56 | |
| 57 | /** |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 58 | * Directory where we can find bazel's Java tests, relative to a test's runfiles directory. |
| 59 | */ |
Kristina Chodorow | 93fbc3e | 2016-04-27 17:03:28 +0000 | [diff] [blame] | 60 | public static final String JAVATESTS_ROOT = "io_bazel/src/test/java/"; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 61 | |
aehlig | fb05988 | 2017-12-20 06:02:07 -0800 | [diff] [blame] | 62 | /** Relative path to the process-wrapper tool. */ |
| 63 | public static final String PROCESS_WRAPPER_PATH |
| 64 | = "io_bazel/src/main/tools/process-wrapper"; |
ruperts | bec2fe8 | 2017-12-05 21:53:50 -0800 | [diff] [blame] | 65 | |
aehlig | fb05988 | 2017-12-20 06:02:07 -0800 | [diff] [blame] | 66 | /** 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"; |
ruperts | bec2fe8 | 2017-12-05 21:53:50 -0800 | [diff] [blame] | 69 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 70 | public static final String TEST_RULE_CLASS_PROVIDER = |
| 71 | "com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider"; |
Kristina Chodorow | 76d94b1 | 2015-12-16 16:12:52 +0000 | [diff] [blame] | 72 | public static final String TEST_RULE_MODULE = |
| 73 | "com.google.devtools.build.lib.bazel.rules.BazelRulesModule"; |
Lukacs Berki | 72c4071 | 2017-01-31 14:52:55 +0000 | [diff] [blame] | 74 | public static final String TEST_REAL_UNIX_FILE_SYSTEM = |
Ulf Adams | 8afbd3c | 2017-02-28 10:42:48 +0000 | [diff] [blame] | 75 | "com.google.devtools.build.lib.unix.UnixFileSystem"; |
Lukacs Berki | 72c4071 | 2017-01-31 14:52:55 +0000 | [diff] [blame] | 76 | |
janakr | 150858b | 2017-07-25 00:04:53 +0200 | [diff] [blame] | 77 | public static void processSkyframeExecutorForTesting(SkyframeExecutor skyframeExecutor) {} |
| 78 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 79 | public static final ImmutableList<String> IGNORED_MESSAGE_PREFIXES = ImmutableList.<String>of(); |
Ulf Adams | d87465e | 2015-04-17 13:16:51 +0000 | [diff] [blame] | 80 | |
cpeyser | 478f763 | 2017-07-05 18:03:47 -0400 | [diff] [blame] | 81 | public static final String WORKSPACE_CONTENT = ""; |
| 82 | |
Dmitry Lomov | e36a66c | 2017-02-17 14:48:48 +0000 | [diff] [blame] | 83 | public static final String GCC_INCLUDE_PATH = "external/bazel_tools/tools/cpp/gcc3"; |
Dmitry Lomov | ece87c2 | 2015-11-26 19:22:56 +0000 | [diff] [blame] | 84 | |
cparsons | 81ce9e3 | 2017-08-27 19:28:32 +0200 | [diff] [blame] | 85 | /** The path in which the mock cc crosstool resides. */ |
| 86 | public static final String MOCK_CC_CROSSTOOL_PATH = "tools/cpp"; |
Dmitry Lomov | e0a69aa | 2015-11-30 16:25:40 +0000 | [diff] [blame] | 87 | |
cparsons | 81ce9e3 | 2017-08-27 19:28:32 +0200 | [diff] [blame] | 88 | /** 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 Adams | c934fad | 2015-12-22 07:42:11 +0000 | [diff] [blame] | 94 | |
| 95 | public static final ImmutableList<String> DOCS_RULES_PATHS = ImmutableList.of( |
| 96 | "src/main/java/com/google/devtools/build/lib/rules"); |
Luis Fernando Pino Duque | b1b28b6 | 2016-02-25 14:25:19 +0000 | [diff] [blame] | 97 | |
John Cater | 17a1ae9 | 2017-01-25 15:18:25 +0000 | [diff] [blame] | 98 | // 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 | |
cparsons | 81ce9e3 | 2017-08-27 19:28:32 +0200 | [diff] [blame] | 102 | /** |
| 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 Duque | b1b28b6 | 2016-02-25 14:25:19 +0000 | [diff] [blame] | 108 | public static final InvocationPolicy TEST_INVOCATION_POLICY = |
| 109 | InvocationPolicy.getDefaultInstance(); |
Nathan Harmata | 3ad5645 | 2016-06-10 16:17:45 +0000 | [diff] [blame] | 110 | |
nharmata | d922e65 | 2017-05-17 20:29:19 +0200 | [diff] [blame] | 111 | public static final BuilderFactoryForTesting PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING = |
| 112 | PackageFactoryBuilderFactoryForBazelUnitTests.INSTANCE; |
janakr | 3d44325 | 2017-10-10 23:03:26 +0200 | [diff] [blame] | 113 | |
| 114 | /** A choice of test execution mode, only varies internally. */ |
| 115 | public enum InternalTestExecutionMode { |
| 116 | NORMAL |
| 117 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 118 | } |