diff options
author | 2018-06-04 10:41:53 -0700 | |
---|---|---|
committer | 2018-06-04 10:43:50 -0700 | |
commit | 25ae199041c4176d06bbe36ff112da28c2a48a15 (patch) | |
tree | 9c8c6df451ef26102091f792c465c44ae755f342 /src/test/java/com/google | |
parent | 9cf0f655dc0e416f88c64bebe0eed6f1536b33fd (diff) |
Remove --glibc option
Crosstool selection will be based solely on --cpu and --compiler options.
RELNOTES: Option --glibc is removed, toolchain selection relies solely on --cpu and --compiler options.
PiperOrigin-RevId: 199156131
Diffstat (limited to 'src/test/java/com/google')
3 files changed, 66 insertions, 78 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java index 7ba9f8a994..994888265c 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java +++ b/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java @@ -96,7 +96,7 @@ public final class BazelMockCcSupport extends MockCcSupport { " 'ppc|compiler': ':cc-compiler-ppc',", " })", "cc_toolchain(name = 'cc-compiler-k8', all_files = ':empty', compiler_files = ':empty',", - " cpu = 'k8', compiler = 'compiler', libc = 'local', dwp_files = ':empty',", + " cpu = 'k8', compiler = 'compiler', dwp_files = ':empty',", " dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", " module_map = 'crosstool.cppmap', supports_header_parsing = 1,", @@ -114,7 +114,7 @@ public final class BazelMockCcSupport extends MockCcSupport { ")", "cc_toolchain(name = 'cc-no-dyn-linker-k8', all_files = ':empty', ", " compiler_files = ':empty', cpu = 'k8', compiler = 'compiler_no_dyn_linker', ", - " libc = 'local', dwp_files = ':empty', dynamic_runtime_libs = [':empty'], ", + " dwp_files = ':empty', dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", " module_map = 'crosstool.cppmap', supports_header_parsing = 1,", " objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',", @@ -130,7 +130,7 @@ public final class BazelMockCcSupport extends MockCcSupport { " toolchain_type = ':toolchain_type',", ")", "cc_toolchain(name = 'cc-compiler-ppc', all_files = ':empty', compiler_files = ':empty',", - " cpu = 'ppc', compiler = 'compiler', libc = 'local', dwp_files = ':empty',", + " cpu = 'ppc', compiler = 'compiler', dwp_files = ':empty',", " dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", " module_map = 'crosstool.cppmap', supports_header_parsing = 1,", @@ -148,7 +148,7 @@ public final class BazelMockCcSupport extends MockCcSupport { ")", "cc_toolchain(name = 'cc-compiler-piii', all_files = ':all-files-piii',", " compiler_files = ':compiler-files-piii',", - " cpu = 'piii', compiler = 'compiler', libc = 'local', dwp_files = ':empty',", + " cpu = 'piii', compiler = 'compiler', dwp_files = ':empty',", " dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", " module_map = 'crosstool.cppmap', supports_header_parsing = 1,", @@ -166,7 +166,7 @@ public final class BazelMockCcSupport extends MockCcSupport { ")", "cc_toolchain(name = 'cc-compiler-darwin', all_files = ':empty', ", " compiler_files = ':empty',", - " cpu = 'darwin', compiler = 'compiler', libc = 'macosx', dwp_files = ':empty',", + " cpu = 'darwin', compiler = 'compiler', dwp_files = ':empty',", " dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", " module_map = 'crosstool.cppmap', supports_header_parsing = 1,", @@ -184,7 +184,7 @@ public final class BazelMockCcSupport extends MockCcSupport { ")", "cc_toolchain(name = 'cc-no-dyn-linker-darwin', all_files = ':empty', ", " compiler_files = ':empty',", - " cpu = 'darwin', compiler = 'compiler_no_dyn_linker', libc = 'macosx', " , + " cpu = 'darwin', compiler = 'compiler_no_dyn_linker', ", " dwp_files = ':empty', dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", " module_map = 'crosstool.cppmap', supports_header_parsing = 1,", @@ -202,7 +202,7 @@ public final class BazelMockCcSupport extends MockCcSupport { ")", "cc_toolchain(name = 'cc-compiler-ios_x86_64', all_files = ':empty', ", " compiler_files = ':empty',", - " cpu = 'ios_x86_64', compiler = 'compiler', libc = 'local', dwp_files = ':empty',", + " cpu = 'ios_x86_64', compiler = 'compiler', dwp_files = ':empty',", " dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", " module_map = 'crosstool.cppmap', supports_header_parsing = 1,", @@ -220,7 +220,7 @@ public final class BazelMockCcSupport extends MockCcSupport { ")", "cc_toolchain(name = 'cc-compiler-armeabi-v7a', all_files = ':empty', ", " compiler_files = ':empty',", - " cpu = 'armeabi-v7a', compiler = 'compiler', libc = 'armeabi-v7a', ", + " cpu = 'armeabi-v7a', compiler = 'compiler',", " dwp_files = ':empty',", " dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", @@ -239,7 +239,7 @@ public final class BazelMockCcSupport extends MockCcSupport { ")", "cc_toolchain(name = 'cc-compiler-x64_windows', all_files = ':empty', ", " compiler_files = ':empty',", - " cpu = 'x64_windows', compiler = 'windows_msys64', libc = 'local', ", + " cpu = 'x64_windows', compiler = 'windows_msys64',", " dwp_files = ':empty',", " dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", @@ -258,7 +258,7 @@ public final class BazelMockCcSupport extends MockCcSupport { ")", "cc_toolchain(name = 'cc-no-dyn-linker-x64_windows', all_files = ':empty', ", " compiler_files = ':empty',", - " cpu = 'x64_windows', compiler = 'compiler_no_dyn_linker', libc = 'local', ", + " cpu = 'x64_windows', compiler = 'compiler_no_dyn_linker',", " dwp_files = ':empty',", " dynamic_runtime_libs = [':empty'], ", " ar_files = ':empty', as_files = ':empty', linker_files = ':empty',", diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/Crosstool.java b/src/test/java/com/google/devtools/build/lib/packages/util/Crosstool.java index 09e86633bb..ad799b9de2 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/Crosstool.java +++ b/src/test/java/com/google/devtools/build/lib/packages/util/Crosstool.java @@ -140,7 +140,6 @@ final class Crosstool { addModuleMap ? " module_map = 'crosstool.cppmap'," : "", " cpu = '" + arch + "',", " compiler = 'gcc-4.4.0',", - " libc = 'glibc-2.3.6-grte',", " ar_files = 'ar-" + arch + "',", " as_files = 'as-" + arch + "',", " compiler_files = 'compile-" + arch + "',", diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java index 39a6404229..7ea71a486d 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java @@ -597,7 +597,6 @@ public class CrosstoolConfigurationLoaderTest extends AnalysisTestCase { create( loader, "--compiler=compiler-C", - "--glibc=target-libc-C", "--cpu=piii", "--host_cpu=piii", "--android_cpu=", @@ -676,12 +675,11 @@ public class CrosstoolConfigurationLoaderTest extends AnalysisTestCase { } /** - * Tests that we can select a toolchain using a subset of the --compiler and - * --glibc flags, as long as they select a unique result. Also tests the error - * messages we get when they don't. + * Tests that we can select a toolchain using the --compiler flag, as long as it selects a unique + * result. Also tests the error messages we get when it doesn't. */ @Test - public void testCompilerLibcSearch() throws Exception { + public void testToolchainSelection() throws Exception { CppConfigurationLoader loader = loader( // Needs to include \n's; as a single line it hits a parser limitation. @@ -690,95 +688,86 @@ public class CrosstoolConfigurationLoaderTest extends AnalysisTestCase { + "default_target_cpu: \"k8\"\n" + "default_toolchain {\n" + " cpu: \"piii\"\n" - + " toolchain_identifier: \"toolchain-identifier-AA-piii\"\n" + + " toolchain_identifier: \"toolchain-identifier-A-piii\"\n" + "}\n" + "default_toolchain {\n" + " cpu: \"k8\"\n" - + " toolchain_identifier: \"toolchain-identifier-BB\"\n" + + " toolchain_identifier: \"toolchain-identifier-B\"\n" + "}\n" + "toolchain {\n" - + " toolchain_identifier: \"toolchain-identifier-AA\"\n" - + " host_system_name: \"host-system-name-AA\"\n" - + " target_system_name: \"target-system-name-AA\"\n" + + " toolchain_identifier: \"toolchain-identifier-A\"\n" + + " host_system_name: \"host-system-name-A\"\n" + + " target_system_name: \"target-system-name-A\"\n" + " target_cpu: \"k8\"\n" + " target_libc: \"target-libc-A\"\n" + " compiler: \"compiler-A\"\n" + " abi_version: \"abi-version-A\"\n" + " abi_libc_version: \"abi-libc-version-A\"\n" + "}\n" - // AA-piii is uniquely determined by libc and compiler. + "toolchain {\n" - + " toolchain_identifier: \"toolchain-identifier-AA-piii\"\n" - + " host_system_name: \"host-system-name-AA\"\n" - + " target_system_name: \"target-system-name-AA\"\n" - + " target_cpu: \"piii\"\n" + + " toolchain_identifier: \"toolchain-identifier-A-duplicate\"\n" + + " host_system_name: \"host-system-name-A\"\n" + + " target_system_name: \"target-system-name-A\"\n" + + " target_cpu: \"k8\"\n" + " target_libc: \"target-libc-A\"\n" + " compiler: \"compiler-A\"\n" + " abi_version: \"abi-version-A\"\n" + " abi_libc_version: \"abi-libc-version-A\"\n" + "}\n" + "toolchain {\n" - + " toolchain_identifier: \"toolchain-identifier-AB\"\n" - + " host_system_name: \"host-system-name-AB\"\n" - + " target_system_name: \"target-system-name-AB\"\n" + + " toolchain_identifier: \"toolchain-identifier-C\"\n" + + " host_system_name: \"host-system-name-C\"\n" + + " target_system_name: \"target-system-name-C\"\n" + " target_cpu: \"k8\"\n" - + " target_libc: \"target-libc-A\"\n" - + " compiler: \"compiler-B\"\n" - + " abi_version: \"abi-version-B\"\n" - + " abi_libc_version: \"abi-libc-version-A\"\n" + + " target_libc: \"target-libc-C\"\n" + + " compiler: \"compiler-C\"\n" + + " abi_version: \"abi-version-C\"\n" + + " abi_libc_version: \"abi-libc-version-C\"\n" + "}\n" + "toolchain {\n" - + " toolchain_identifier: \"toolchain-identifier-BA\"\n" - + " host_system_name: \"host-system-name-BA\"\n" - + " target_system_name: \"target-system-name-BA\"\n" - + " target_cpu: \"k8\"\n" - + " target_libc: \"target-libc-B\"\n" + + " toolchain_identifier: \"toolchain-identifier-A-piii\"\n" + + " host_system_name: \"host-system-name-A\"\n" + + " target_system_name: \"target-system-name-A\"\n" + + " target_cpu: \"piii\"\n" + + " target_libc: \"target-libc-A\"\n" + " compiler: \"compiler-A\"\n" + " abi_version: \"abi-version-A\"\n" - + " abi_libc_version: \"abi-libc-version-B\"\n" + + " abi_libc_version: \"abi-libc-version-A\"\n" + "}\n" + "toolchain {\n" - + " toolchain_identifier: \"toolchain-identifier-BB\"\n" - + " host_system_name: \"host-system-name-BB\"\n" - + " target_system_name: \"target-system-name-BB\"\n" - + " target_cpu: \"k8\"\n" - + " target_libc: \"target-libc-B\"\n" + + " toolchain_identifier: \"toolchain-identifier-B-piii\"\n" + + " host_system_name: \"host-system-name-A\"\n" + + " target_system_name: \"target-system-name-A\"\n" + + " target_cpu: \"piii\"\n" + + " target_libc: \"target-libc-A\"\n" + " compiler: \"compiler-B\"\n" - + " abi_version: \"abi-version-B\"\n" - + " abi_libc_version: \"abi-libc-version-B\"\n" + + " abi_version: \"abi-version-A\"\n" + + " abi_libc_version: \"abi-libc-version-A\"\n" + "}\n" + "toolchain {\n" - + " toolchain_identifier: \"toolchain-identifier-BC\"\n" - + " host_system_name: \"host-system-name-BC\"\n" - + " target_system_name: \"target-system-name-BC\"\n" + + " toolchain_identifier: \"toolchain-identifier-B\"\n" + + " host_system_name: \"host-system-name-B\"\n" + + " target_system_name: \"target-system-name-B\"\n" + " target_cpu: \"k8\"\n" - + " target_libc: \"target-libc-B\"\n" - + " compiler: \"compiler-C\"\n" - + " abi_version: \"abi-version-C\"\n" - + " abi_libc_version: \"abi-libc-version-B\"\n" + + " target_libc: \"target-libc-A\"\n" + + " compiler: \"compiler-B\"\n" + + " abi_version: \"abi-version-B\"\n" + + " abi_libc_version: \"abi-libc-version-A\"\n" + "}"); // Uses the default toolchain for k8. assertThat(create(loader, "--cpu=k8").getToolchainIdentifier()) - .isEqualTo("toolchain-identifier-BB"); + .isEqualTo("toolchain-identifier-B"); // Does not default to --cpu=k8; if no --cpu flag is present, Bazel defaults to the host cpu! - assertThat( - create(loader, "--cpu=k8", "--compiler=compiler-A", "--glibc=target-libc-B") - .getToolchainIdentifier()) - .isEqualTo("toolchain-identifier-BA"); + assertThat(create(loader, "--cpu=k8", "--compiler=compiler-C").getToolchainIdentifier()) + .isEqualTo("toolchain-identifier-C"); // Uses the default toolchain for piii. assertThat(create(loader, "--cpu=piii").getToolchainIdentifier()) - .isEqualTo("toolchain-identifier-AA-piii"); - - // We can select the unique piii toolchain with either its compiler or glibc. - assertThat(create(loader, "--cpu=piii", "--compiler=compiler-A").getToolchainIdentifier()) - .isEqualTo("toolchain-identifier-AA-piii"); - assertThat(create(loader, "--cpu=piii", "--glibc=target-libc-A").getToolchainIdentifier()) - .isEqualTo("toolchain-identifier-AA-piii"); + .isEqualTo("toolchain-identifier-A-piii"); - // compiler-C uniquely identifies a toolchain, so we can use it. - assertThat(create(loader, "--cpu=k8", "--compiler=compiler-C").getToolchainIdentifier()) - .isEqualTo("toolchain-identifier-BC"); + // We can select the unique piii toolchain with its compiler. + assertThat(create(loader, "--cpu=piii", "--compiler=compiler-B").getToolchainIdentifier()) + .isEqualTo("toolchain-identifier-B-piii"); try { create(loader, "--cpu=k8", "--compiler=nonexistent-compiler"); @@ -788,24 +777,24 @@ public class CrosstoolConfigurationLoaderTest extends AnalysisTestCase { .hasMessage( "No toolchain found for --cpu='k8' --compiler='nonexistent-compiler'. " + "Valid toolchains are: [\n" - + " --cpu='k8' --compiler='compiler-A' --glibc='target-libc-A',\n" - + " --cpu='piii' --compiler='compiler-A' --glibc='target-libc-A',\n" - + " --cpu='k8' --compiler='compiler-B' --glibc='target-libc-A',\n" - + " --cpu='k8' --compiler='compiler-A' --glibc='target-libc-B',\n" - + " --cpu='k8' --compiler='compiler-B' --glibc='target-libc-B',\n" - + " --cpu='k8' --compiler='compiler-C' --glibc='target-libc-B',\n" + + " toolchain-identifier-A: --cpu='k8' --compiler='compiler-A',\n" + + " toolchain-identifier-A-duplicate: --cpu='k8' --compiler='compiler-A',\n" + + " toolchain-identifier-C: --cpu='k8' --compiler='compiler-C',\n" + + " toolchain-identifier-A-piii: --cpu='piii' --compiler='compiler-A',\n" + + " toolchain-identifier-B-piii: --cpu='piii' --compiler='compiler-B',\n" + + " toolchain-identifier-B: --cpu='k8' --compiler='compiler-B',\n" + "]"); } try { - create(loader, "--cpu=k8", "--glibc=target-libc-A"); + create(loader, "--cpu=k8", "--compiler=compiler-A"); fail("Expected an error that multiple toolchains matched."); } catch (InvalidConfigurationException e) { assertThat(e) .hasMessage( - "Multiple toolchains found for --cpu='k8' --glibc='target-libc-A': [\n" - + " --cpu='k8' --compiler='compiler-A' --glibc='target-libc-A',\n" - + " --cpu='k8' --compiler='compiler-B' --glibc='target-libc-A',\n" + "Multiple toolchains found for --cpu='k8' --compiler='compiler-A': [\n" + + " toolchain-identifier-A: --cpu='k8' --compiler='compiler-A',\n" + + " toolchain-identifier-A-duplicate: --cpu='k8' --compiler='compiler-A',\n" + "]"); } } |