From 7a491b7e62a033aa5f0f8efdfd77dac5ec5fa1b3 Mon Sep 17 00:00:00 2001 From: ccalvarin Date: Wed, 16 May 2018 09:13:27 -0700 Subject: Port bazelrc flags into their own module. This way the documentation logs them correctly as named "bazel," and describes the correct behavior. Needed for #4502. RELNOTES: None. PiperOrigin-RevId: 196837021 --- .../build/lib/runtime/CommandLineEventTest.java | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/test/java/com/google/devtools/build/lib/runtime/CommandLineEventTest.java') diff --git a/src/test/java/com/google/devtools/build/lib/runtime/CommandLineEventTest.java b/src/test/java/com/google/devtools/build/lib/runtime/CommandLineEventTest.java index 71ad575314..228669b3c1 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/CommandLineEventTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/CommandLineEventTest.java @@ -17,6 +17,7 @@ import static com.google.common.truth.Truth.assertThat; import com.google.common.collect.ImmutableList; import com.google.common.io.BaseEncoding; +import com.google.devtools.build.lib.bazel.BazelStartupOptionsModule.Options; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEventId.StructuredCommandLineId; import com.google.devtools.build.lib.runtime.CommandLineEvent.CanonicalCommandLineEvent; import com.google.devtools.build.lib.runtime.CommandLineEvent.OriginalCommandLineEvent; @@ -102,11 +103,11 @@ public class CommandLineEventTest { } @Test - public void testActiveBlazercs_OriginalCommandLine() throws OptionsParsingException { + public void testActiveBazelrcs_OriginalCommandLine() throws OptionsParsingException { OptionsParser fakeStartupOptions = - OptionsParser.newOptionsParser(BlazeServerStartupOptions.class); + OptionsParser.newOptionsParser(BlazeServerStartupOptions.class, Options.class); fakeStartupOptions.parse( - "--blazerc=/some/path", "--master_blazerc", "--blazerc", "/some/other/path"); + "--bazelrc=/some/path", "--master_bazelrc", "--bazelrc", "/some/other/path"); OptionsParser fakeCommandOptions = OptionsParser.newOptionsParser(TestOptions.class); CommandLine line = @@ -127,20 +128,20 @@ public class CommandLineEventTest { assertThat(line.getSections(0).getChunkList().getChunk(0)).isEqualTo("testblaze"); assertThat(line.getSections(1).getOptionList().getOptionCount()).isEqualTo(3); assertThat(line.getSections(1).getOptionList().getOption(0).getCombinedForm()) - .isEqualTo("--blazerc=/some/path"); + .isEqualTo("--bazelrc=/some/path"); assertThat(line.getSections(1).getOptionList().getOption(1).getCombinedForm()) - .isEqualTo("--master_blazerc"); + .isEqualTo("--master_bazelrc"); assertThat(line.getSections(1).getOptionList().getOption(2).getCombinedForm()) - .isEqualTo("--blazerc /some/other/path"); + .isEqualTo("--bazelrc /some/other/path"); assertThat(line.getSections(2).getChunkList().getChunk(0)).isEqualTo("someCommandName"); assertThat(line.getSections(3).getOptionList().getOptionCount()).isEqualTo(0); assertThat(line.getSections(4).getChunkList().getChunkCount()).isEqualTo(0); } @Test - public void testPassedInBlazercs_OriginalCommandLine() throws OptionsParsingException { + public void testPassedInBazelrcs_OriginalCommandLine() throws OptionsParsingException { OptionsParser fakeStartupOptions = - OptionsParser.newOptionsParser(BlazeServerStartupOptions.class); + OptionsParser.newOptionsParser(BlazeServerStartupOptions.class, Options.class); OptionsParser fakeCommandOptions = OptionsParser.newOptionsParser(TestOptions.class); CommandLine line = @@ -151,9 +152,9 @@ public class CommandLineEventTest { fakeCommandOptions, Optional.of( ImmutableList.of( - Pair.of("", "--blazerc=/some/path"), - Pair.of("", "--master_blazerc"), - Pair.of("", "--blazerc=/some/other/path"), + Pair.of("", "--bazelrc=/some/path"), + Pair.of("", "--master_bazelrc"), + Pair.of("", "--bazelrc=/some/other/path"), Pair.of("", "--invocation_policy=notARealPolicy")))) .asStreamProto(null) .getStructuredCommandLine(); @@ -166,11 +167,11 @@ public class CommandLineEventTest { assertThat(line.getSections(0).getChunkList().getChunk(0)).isEqualTo("testblaze"); assertThat(line.getSections(1).getOptionList().getOptionCount()).isEqualTo(4); assertThat(line.getSections(1).getOptionList().getOption(0).getCombinedForm()) - .isEqualTo("--blazerc=/some/path"); + .isEqualTo("--bazelrc=/some/path"); assertThat(line.getSections(1).getOptionList().getOption(1).getCombinedForm()) - .isEqualTo("--master_blazerc"); + .isEqualTo("--master_bazelrc"); assertThat(line.getSections(1).getOptionList().getOption(2).getCombinedForm()) - .isEqualTo("--blazerc=/some/other/path"); + .isEqualTo("--bazelrc=/some/other/path"); assertThat(line.getSections(1).getOptionList().getOption(3).getCombinedForm()) .isEqualTo("--invocation_policy=notARealPolicy"); assertThat(line.getSections(2).getChunkList().getChunk(0)).isEqualTo("someCommandName"); @@ -179,11 +180,11 @@ public class CommandLineEventTest { } @Test - public void testBlazercs_CanonicalCommandLine() throws OptionsParsingException { + public void testBazelrcs_CanonicalCommandLine() throws OptionsParsingException { OptionsParser fakeStartupOptions = - OptionsParser.newOptionsParser(BlazeServerStartupOptions.class); + OptionsParser.newOptionsParser(BlazeServerStartupOptions.class, Options.class); fakeStartupOptions.parse( - "--blazerc=/some/path", "--master_blazerc", "--blazerc", "/some/other/path"); + "--bazelrc=/some/path", "--master_bazelrc", "--bazelrc", "/some/other/path"); OptionsParser fakeCommandOptions = OptionsParser.newOptionsParser(TestOptions.class); CommandLine line = -- cgit v1.2.3