aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/testutil
Commit message (Collapse)AuthorAge
* Add hook to process SkyframeExecutor in tests. Also add sentinel exception ↵Gravatar janakr2017-07-25
| | | | | | to indicate unserializability, improve error message in Path when serialization fails, and add some test-only methods to SkyframeExecutor and PackageFactory. PiperOrigin-RevId: 162993806
* Add an Iterable<Event> Truth subject so that we can easily assert things on ↵Gravatar janakr2017-07-24
| | | | | | | | | | an iterable of events without calling into the heavyweight MoreAsserts. Use that in Skyframe instead of MoreAsserts. Also delete an unused method in MoreAsserts. PiperOrigin-RevId: 162754283
* ResourceFilter supports dynamically configured resource filteringGravatar Googler2017-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dynamically Configured Resource Filtering change 3/6 Resource filtering behaves somewhat differently when dynamically configured. Resources obtained from dependencies will have already been filtered and do not need to be filtered again. Resources that were filtered out do not need to be tracked since resource processing will never receive a reference to them anyway. Also, to make builds where ResourceFilter is dynamically configured, add equals and hashCode methods (otherwise, the configuration code throws a NullPointerException) and a global output prefix (otherwise, conflicts can occur). To ensure that the global output prefix (and the ResourceFilter object itself) is the same regardless of the ordering of filters in the android_binary, build the filters into a set, not a list, and sort them as part of creating the ResourceFilter object. This way, for example, objects built with filters "en,fr", "fr,en", and "en,en,fr" will all end up equal. Finally, rename the getFilteredResources method to better reflect its new role, and improve the isPrefiltering method to not try to prefilter if there are no filters. Add tests for all of this, and helper methods for all of those tests, including, most notably, a makeResourceFilter method that instantiates a ResourceFilter similarly to how it is actually created outside of tests (rather than directly calling the constructor) and a fake implementation of AttributeMap to support this. RELNOTES: none PiperOrigin-RevId: 162099178
* Add a toolchains= attribute to *_binary, *_test, cc_library and extra_action ↵Gravatar lberki2017-07-14
| | | | | | | | | rules to declare which Make variables they need. The idea is that they would depend on the future java_runtime_alias / cc_toolchain_alias and similar rules and thus Bazel will know which Make variables they actually need instead of pulling in the whole BuildConfiguration and also making it possible to compute these Make variables during analysis instead of configuration creation. RELNOTES: None. PiperOrigin-RevId: 161785868
* Fix BuildRuleWithDefaultsBuilder to work properly with NODEP_LABEL attributes.Gravatar jcater2017-07-07
| | | | | | | | NODEP_LABEL attributes are not allowed to set file types, but populateLabelAttributes assumes that every label attribute has a file type set. Fix this by adding in better checks. PiperOrigin-RevId: 161212141
* Open source unit tests for the objc rules.Gravatar cpeyser2017-07-06
| | | | PiperOrigin-RevId: 161010594
* Cleanup for Java 8Gravatar laurentlb2017-07-05
| | | | PiperOrigin-RevId: 160832316
* Migrate Java tests to Truth.Gravatar lberki2017-05-30
| | | | | | RELNOTES: None. PiperOrigin-RevId: 157446717
* Expose the target map from Package.Gravatar carmi2017-05-19
| | | | | | | | This doesn't really expose new information, because one can iterate over the existing getTargets() and recreate the map. Moreover, the map is immutable, so there's no risk in returning it to the user. RELNOTES: None PiperOrigin-RevId: 156349797
* PiperOrigin-RevId: 156331430Gravatar nharmata2017-05-19
|
* Automated g4 rollback of commit 9dec9a09d1e4d27e7cff73c440195a32d3b90752.Gravatar plf2017-05-05
| | | | PiperOrigin-RevId: 155194438
* Introduce BazelPackageLoader.Gravatar nharmata2017-05-04
| | | | | | | | | This is a standalone library for loading packages. It is intended to be used by clients outside of Bazel (for now, Kythe). Perform BazelPackageLoader#loadPackage in the testing hook used in all of Bazel's unit tests and integration tests. This gives us very good test coverage for BazelPackageLoader. RELNOTES: None PiperOrigin-RevId: 155004070
* Implement a flag to deprecate old constructor for depsets (`set`)Gravatar vladmos2017-05-04
| | | | | Usage: --incompatible_depset_constructor=true (the default value is false). PiperOrigin-RevId: 154971526
* Automated g4 rollback of commit d9fea57268ff01c001fbcbdc2bd057c86c362e6f.Gravatar buchgr2017-04-25
| | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Rollforward with fix for test flakiness. BEP transport closed events are delivered via their own threadpool and thus might not have been sent immediately. BuildEventStreamerTest#testSimpleStream now waits for a bit until the event has been delivered. I ran the test with --runs_per_test=1000 several times and had no further failures. *** Original change description *** Automated g4 rollback of commit 3d596d63f883fff56001ed7b2e5cf51dba45f082. *** Reason for rollback *** Made BuildEventStreamerTest#testSimpleStream 3% flaky based on --runs_per_test=1000. RELNOTES: None PiperOrigin-RevId: 154170833
* Automated g4 rollback of commit 3d596d63f883fff56001ed7b2e5cf51dba45f082.Gravatar ajmichael2017-04-25
| | | | | | | | *** Reason for rollback *** Made BuildEventStreamerTest#testSimpleStream 3% flaky based on --runs_per_test=1000. RELNOTES: None PiperOrigin-RevId: 154090559
* BEP: Show protocol upload in the UIGravatar buchgr2017-04-24
| | | | | | | | | | | | | | | | | | | | | | The BEP (build event protocol) upload may at times take longer than the build itself. This is especially true for cached builds, where there is little build work, but the protocol still needs to be uploaded. In this case the bazel UI will now display that it's waiting for BEP upload, both in the current and the new experimental UI (--experimental_ui). When executing a run command, blaze waits for the BEP upload to finish before it runs the target. Major Modifications: - The BuildEventTransport interface now also has a name() method that returns a string. When waiting for a transport to finish the BEP upload, this string is displayed in the UI. - The BuildEventStreamer now emits two new events AnnounceBuildEventTransportsEvent and BuildEventTransportClosed on the event bus. This is how the experimental UI is informed about BEP upload progress. RELNOTES: None PiperOrigin-RevId: 154052401
* Move action_outs directory to under the output path.Gravatar janakr2017-04-06
| | | | PiperOrigin-RevId: 152307322
* Move UnixFileSystem to lib.unix, WindowsFileSystem to lib.windowsGravatar Ulf Adams2017-02-28
| | | | | | -- PiperOrigin-RevId: 148749485 MOS_MIGRATED_REVID=148749485
* Provide more reporting options to SkyFunctions Gravatar Klaus Aehlig2017-02-27
| | | | | | | | | | | | | With more specific information to be reported by Skyfunctions, e.g., to inform the build-event protocol on missing files, the EventHandler interface is no longer enough. Therefore, provide an enriched context for reporting events. -- Change-Id: I2d06166fe4d5b9054e24ad8c752fafc039e3f9f8 Reviewed-on: https://cr.bazel.build/8794 PiperOrigin-RevId: 148463437 MOS_MIGRATED_REVID=148463437
* Move Classpath.java from src/test/... to src/main/... since it will be used ↵Gravatar Florian Weikert2017-02-21
| | | | | | | | by the documentation generation in the future. -- PiperOrigin-RevId: 148081562 MOS_MIGRATED_REVID=148081562
* Rollback of commit 4b73e972d909bcd533f2f9940f95a00b9b73bdde.Gravatar Dmitry Lomov2017-02-17
| | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Broke tests on CI: http://ci.bazel.io/job/bazel-tests/570/ *** Original change description *** Roll forward execroot change RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Cust... -- PiperOrigin-RevId: 147833177 MOS_MIGRATED_REVID=147833177
* Make the interface dynamic library builder a regular label instead of a ↵Gravatar Lukacs Berki2017-02-17
| | | | | | | | magic artifact. -- PiperOrigin-RevId: 147830857 MOS_MIGRATED_REVID=147830857
* Roll forward execroot changeGravatar Kristina Chodorow2017-02-16
| | | | | | | | | | | | | | | | | RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Custom crosstools that hardcode external/<repo> paths will have to be updated. Issue #1262. -- PiperOrigin-RevId: 147726370 MOS_MIGRATED_REVID=147726370
* Search for Test classes within the classpath used by the current ↵Gravatar Kush Chakraborty2017-02-15
| | | | | | | | | | | | classloader, instead of the system classpath. (2nd Attempt) Windows tests passed on Jenkins with this patch: http://ci.bazel.io/job/Gerrit-bazel-tests/380/, https://bazel-review.googlesource.com/c/8833 -- PiperOrigin-RevId: 147483103 MOS_MIGRATED_REVID=147483103
* Refactoring: Types report what class of labels they contain.Gravatar Michael Staib2017-02-14
| | | | | | | | | | | | | | | | | | | | | Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do exotic things based on the type. But most sites can avoid having to enumerate all the types they work with explicitly. This causes LABEL_DICT_UNARY to start being treated like the other label types, which means that CcToolchainSuiteRule and JavaRuntimeSuiteRule need to include a set of allowed file types (none, in their case). Skylark will continue treating it as a dictionary from String to Label in its rule context, however, to avoid visible behavior changes. -- PiperOrigin-RevId: 147471542 MOS_MIGRATED_REVID=147471542
* Rollback of commit cdbad585187dfe7bbb4d69ad68a1baf852beb691.Gravatar Michael Staib2017-02-14
| | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks Skylark aspects running over rules with LABEL_DICT_UNARY attributes. *** Original change description *** Refactoring: Types report what class of labels they contain. Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do... -- PiperOrigin-RevId: 147385072 MOS_MIGRATED_REVID=147385072
* Make tests that mess with the WORKSPACE file work with untrimmed dynamic ↵Gravatar Greg Estren2017-02-14
| | | | | | | | | | | | | | | | | | | | configs. They already work with static configs because those configs get created in test setup, before WORKSPACE is modified. That means they get the necessary bindings needed to load their fragments (e.g. local_config_xcode for AppleConfiguration). But dynamic configs get instantiated on-demand. Which means in this case *after* WORKSPACE is overwritten. So they can't find the bindings and fail. This fix has offending tests *append* WORKSPACE instead of overwrite. This unblocks defaulting --experimental_dynamic_configs to "notrim_partial". -- PiperOrigin-RevId: 147377195 MOS_MIGRATED_REVID=147377195
* Rollback of commit 48e7fe262aacd6602331435e22247ced260c87ec.Gravatar Dmitry Lomov2017-02-13
| | | | | | | | | | | | | | | *** Reason for rollback *** Breaks "classpath from classpath.jar" https://github.com/bazelbuild/bazel/issues/2527 Fixes #2257. *** Original change description *** Search for Test classes within the classpath used by the current classloader, instead of the system classpath. -- PiperOrigin-RevId: 147328429 MOS_MIGRATED_REVID=147328429
* Refactoring: Types report what class of labels they contain.Gravatar Michael Staib2017-02-13
| | | | | | | | | | | | | | | | | | | Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do exotic things based on the type. But most sites can avoid having to enumerate all the types they work with explicitly. This causes LABEL_DICT_UNARY to start being treated like the other label types, which means that CcToolchainSuiteRule and JavaRuntimeSuiteRule need to include a set of allowed file types (none, in their case). -- PiperOrigin-RevId: 147175424 MOS_MIGRATED_REVID=147175424
* Search for Test classes within the classpath used by the current ↵Gravatar Kush Chakraborty2017-02-09
| | | | | | | | classloader, instead of the system classpath. -- PiperOrigin-RevId: 147045814 MOS_MIGRATED_REVID=147045814
* Make bazel test suites fail without a real test, by no longer adding an ↵Gravatar Kush Chakraborty2017-02-08
| | | | | | | | | | | | empty test in the TestSuiteBuilder. The current scenario can be bug-prone since changes to the TestSuiteBuilder code may bypass all tests, and in the absence of test failures, our tests will signal success. RELNOTES: Make it mandatory for Java test suites in bazel codebase, to contain at least one test. -- PiperOrigin-RevId: 146919833 MOS_MIGRATED_REVID=146919833
* A minor refactoring of the way the test infrastructure gets the FileSystem ↵Gravatar Lukacs Berki2017-02-01
| | | | | | | | implementation for integration tests. -- PiperOrigin-RevId: 146114082 MOS_MIGRATED_REVID=146114082
* (Re)-Add tests for GenRule.Gravatar John Cater2017-01-25
| | | | | | | | | Reverts commit 4bf8cc30a572018ac27101396d18686b75ad1ab5. With fix for https://github.com/bazelbuild/bazel/issues/2408. -- PiperOrigin-RevId: 145544771 MOS_MIGRATED_REVID=145544771
* Classpath.java: Support reading classpath value from classpath jar Gravatar Yun Peng2017-01-25
| | | | | | | | | | Fixed: https://github.com/bazelbuild/bazel/issues/2242 -- Change-Id: I6aa7c97487b3add30df59c4483e409bb4d4c7532 Reviewed-on: https://cr.bazel.build/8399 PiperOrigin-RevId: 145520851 MOS_MIGRATED_REVID=145520851
* Rollback of commit 4069709cbf890ebd7e55ad73f78d848e4b4e7a41.Gravatar John Cater2017-01-24
| | | | | | | | | | *** Reason for rollback *** Breaks Bazel tests on Windows: see https://github.com/bazelbuild/bazel/issues/2408 -- PiperOrigin-RevId: 145411907 MOS_MIGRATED_REVID=145411907
* Add tests for GenRule.Gravatar John Cater2017-01-24
| | | | | | -- PiperOrigin-RevId: 145322062 MOS_MIGRATED_REVID=145322062
* Fix a typoGravatar Liam Miller-Cushon2017-01-16
| | | | | | -- PiperOrigin-RevId: 144511168 MOS_MIGRATED_REVID=144511168
* Support multiple mirror URLs for external reposGravatar Justine Tunney2016-11-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change improves upon 4c67807964e37cfd55bbcda4c6374fcc480bcecc. - A urls attribute has been added to the native workspace rules, with the exception of maven_jar and git_repository. The Skylark repository API also supports multiple URLs now. - The earlier mirrors in the list are preferred. Failover will happen automatically in parallel. - The first 32kB of data is checked before choosing a mirror in order to evade captive portals. - If one's Internet goes down or a download times out, then the download will resume automatically where it left off, provided the server supports RFC7233 for that particular file. Please note that GitHub does not support this for archive snapshots. Files should always be mirrored to a CDN, e.g. GCS, because they support this. - A semaphore is now used on downloads so only 8 can happen at once. Fixes #1814 Fixes #2131 Fixes #2008 Fixes #1968 Fixes #1717 Fixes #943 Wont fix #1194 Fixes tensorflow/tensorflow#5933 Fixes tensorflow/tensorflow#5924 Fixes tensorflow/tensorflow#5924 Fixes tensorflow/tensorflow#5432 See #1607 See #821 See tensorflow/tensorflow#5080 See tensorflow/tensorflow#5029 See tensorflow/tensorflow#4583 See tensorflow/tensorflow#4058 RELNOTES: A urls attribute has been added to repository rules to support multiple mirror URLs for reliably downloading files. -- MOS_MIGRATED_REVID=140495736
* Remove isSkylark and eval from Environment.Gravatar Laurent Le Brun2016-11-29
| | | | | -- MOS_MIGRATED_REVID=140371603
* Move Bazel-specific functions in a separate file.Gravatar Laurent Le Brun2016-11-21
| | | | | | | | "type", "set" and "select" should not be part of the standalone Skylark library. -- MOS_MIGRATED_REVID=139578095
* Allow labels in the '--aspects' parameter.Gravatar Dmitry Lomov2016-11-21
| | | | | -- MOS_MIGRATED_REVID=139573590
* Extract the integration setup to a new class IntegrationMock.Gravatar Ulf Adams2016-11-18
| | | | | -- MOS_MIGRATED_REVID=139558919
* Avoid passing a Windows path as a regexGravatar Laszlo Csomor2016-10-28
| | | | | | | | | | | See https://github.com/bazelbuild/bazel/issues/2002 This bug was making //src/t/j/c/g/d/build/lib/skyframe:SkyframeTests fail on my Windows machine. -- MOS_MIGRATED_REVID=137521932
* Cleanup, remove differences between Build and Skylark environments.Gravatar Laurent Le Brun2016-10-14
| | | | | | | | | | | | | The only visible difference for users is that a few more functions are available in BUILD files. That's fine, this difference was not even documented. RELNOTES: A few functions are added to BUILD files for consistency (hash, dir, hasattr, getattr) with .bzl files, although they are not very useful. -- MOS_MIGRATED_REVID=136151633
* Change allowedRuleClasses/mandatoryProviders semantics to "either-or" ↵Gravatar Dmitry Lomov2016-10-07
| | | | | | | | | | instead of "and". Also allow native rules to require declared providers on their dependencies. -- MOS_MIGRATED_REVID=135454750
* Rollback of commit 82d43279f93d95e4c41b4bc598a3cc05ddd1ae1a.Gravatar Laszlo Csomor2016-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks TensorFlow and other Bazel jobs on ci.bazel.io *** Original change description *** Change execution root for external repositories to be ../repo Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133709658
* Change execution root for external repositories to be ../repoGravatar Kristina Chodorow2016-09-20
| | | | | | | | | | | | | | | | | | | | | | | Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133606309
* Make BuildViewTest#testErrorBelowCycle properly deterministic so that it can ↵Gravatar Janak Ramakrishnan2016-08-19
| | | | | | | test what it's supposed to test, as pointed out by gregce. -- MOS_MIGRATED_REVID=130661645
* Add a builder-like mechanism for writing targets to a Scratch instance that isGravatar Cal Peyser2016-08-09
| | | | | | | usable across front-end types. -- MOS_MIGRATED_REVID=129633711
* Rename namespace-sandbox/-runner to linux-sandbox.Gravatar Philipp Wollermann2016-07-18
| | | | | -- MOS_MIGRATED_REVID=127538990