aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2019-05-01Add licenses() to all BUILD files. (#141)Thomas Van Lenten
2019-04-12diff_test: add rule and tests (#136)László Csomor
This new test rule compares two files and passes if the files match. On Linux/macOS/non-Windows, the test compares files using 'diff'. On Windows, the test compares files using 'fc.exe'. This utility is available on all Windows versions I tried (Windows 2008 Server, Windows 2016 Datacenter Core). See https://github.com/bazelbuild/bazel/issues/5508 See https://github.com/bazelbuild/bazel/issues/4319
2019-04-02Reformat with buildifier --warnings=all (#138)Thomas Van Lenten
Fixes some dictionaries to put things in the more common orders. Buildifer used to default to doing this check and reformatting which is why the //conditions:default got moved up in these in the first place.
2019-03-26Windows: fix tests for native test wrapper (#129)László Csomor
All tests work with `--incompatible_windows_native_test_wrapper` except for the ones already broken on Windows (//tests:analysis_test_e2e_test and //tests:unittest_e2e_test). See https://github.com/bazelbuild/bazel/issues/6622
2019-03-20maprule: hide it, not ready for public use. (#133)upstream/0.8.0László Csomor
Move maprule() to a private directory, to discourage use of it. I (@laszlocsomor) am planning breaking changes to it. Also move private files (rule implementations) to a subdirectory "rules/private/", to clean up the "rules/" directory.
2019-03-20Accept kwargs in dicts.add() (#130)Dave Lee
Accept kwargs in dicts.add()
2019-03-20maprule: add basic integration test (#131)László Csomor
2019-03-19e2e tests: make them run on Windows (#121)László Csomor
2019-03-19write_file: add rule and tests (#122)László Csomor
This PR adds two new rules: write_file and write_xfile. Both rules solve a common problem: to write a text file with user-defined contents. The problem is routinely solved using a genrule. That however requires Bash, since genrules execute Bash commands. Requiring Bash is a problem on Windows. The new rules do not require any shell. The only difference between the rules is that write_xfile creates an executable file while write_file doesn't. See https://github.com/bazelbuild/bazel/issues/4319
2019-03-18copy_file: add rule and tests (#123)László Csomor
This PR adds two new rules: copy_file and copy_xfile. Both rules solve a common problem: to copy one file to another location. The problem is routinely solved using a genrule. That however requires Bash, since genrules execute Bash commands. Requiring Bash is a problem on Windows. The new rules do not require Bash on Windows (only on other platforms). The only difference between the rules is that copy_xfile creates an executable file while copy_file doesn't. See https://github.com/bazelbuild/bazel/issues/4319
2019-03-04maprule: use ctx.resolve_tools (#117)László Csomor
In this PR: - In the _resolve_locations function: use the Bash-less ctx.resolve_tools function to resolve the runfiles manifests and inputs of tools, instead of using ctx.resolve_command for the same purpose. - In the _custom_envmap function: no longer resolve $(location) references when creating the envvars from custom_env, because those references were already resolved in _resolve_locations. The ctx.resolve_tools() method was added in this PR: https://github.com/bazelbuild/bazel/pull/7139 See design doc there.
2019-02-22fix a number of warnings found by Starlark analyzer (#114)c-parsons
2019-02-20analysistest API for retrieval of actions registered by target under testc-parsons
2019-02-19Add analysis_test rulec-parsons
Targets of this rule verify that targets can be analyzed successfully. This is similar to build_test, except no actual action execution of the underlying targets occur. analysis_test essentially verifies that `bazel build [targets] --nobuild` passes.
2019-02-14Add analysis-test test framework (#110)c-parsons
This framework allows for easy creation of unittest-like tests to make assertions on the provider-values returned by real targets.
2019-02-11Add basic shell testing for unittest.bzl (#108)c-parsons
2019-02-08Add `types.is_depset`. (#105)upstream/0.7.0Tony Allevato
2019-01-25Some doc fixes (#100)Thomas Van Lenten
* fix up Args doc block. * add a module doc string
2019-01-25Add a build_test rule. (#97)Thomas Van Lenten
* Add a build_test rule. This rules (marco) provides a 'test' target that can be used to ensure other targets build.
2019-01-14fix various linter errors (#93)c-parsons
2019-01-08maprule: an improved version of genrule() (#86)László Csomor
maprule() is an improved version of native.genrule(), with the following advantages: - Maprule can process source files in parallel, creating separate actions for each of them. - Maprule does not require declaring all output files. Instead you declare templates for the output files yielded for each source. Therefore N source files and M templates yield N*M outputs. - Maprule supports both Bash and cmd.exe syntax for its commands via the specialized rules bash_maprule and cmd_maprule. - Maprule's cmd attribute does deliberately not support $(location) expression nor Make Variables, in order to avoid issues and challenges with quoting. (In case of cmd.exe passing empty arguments is impossible). These paths can be passed as envvars instead. - Maprule's add_env attribute does support $(location) expressions (and some extra placeholders) and is the idiomatic way to pass execpaths of labels in "tools" or "srcs" (the shared sources available for all actions) to the command. See https://github.com/bazelbuild/bazel/issues/4319
2019-01-02Run buildifier --lint=fix over the files. (#88)Thomas Van Lenten
Fixes some dict order issues with the current version of buildifier.
2018-12-04unittest.bzl: supports Windows (#84)László Csomor
In this commit: - change unittest.bzl to declare a named output file instead of relying on the deprecated [1] default output name (ctx.outputs.executable). - define a new toolchain_type and toolchain rules for cmd.exe and for Bash (basically Windows and non-Windows) - register the new toolchains in workspace.bzl - let unittest.make-created test rules require the new toolchain_type - write the test output script as a Windows batch script or as a Shell script, depending on the selected toolchain This PR enables the Bazel team to break the Bash dependency (for test execution) on Windows, and can run Starlark unittests with the new, Windows-native test wrapper (still under development). See https://github.com/bazelbuild/bazel/issues/5508
2018-11-26Fix up lint issues. (#77)Thomas Van Lenten
Fixed via `buildifier --lint=fix` with buildifier 0.19.2.1
2018-11-14Remove supports for make(depset()) from new_sets (#68)bttk
With `--incompatible_depset_is_not_iterable` depset is no longer iterable. Remove tests that assumed it is. Bazel issue: https://github.com/bazelbuild/bazel/issues/5816
2018-09-28Rename a number of instances of 'skylark' to 'starlark' or 'bzl'c-parsons
Most notably, this renames/moves a few important identifiers: //:skylark_library.bzl -> //:bzl_library.bzl skylark_library -> bzl_library SkylarkLibraryInfo -> StarlarkLibraryInfo
2018-08-24Remove usage and suggests for lib.bzl.Thomas Van Lenten
As more things are added, lib.bzl is an anti-pattern as the cost of loading it actually just keeps increasing and most things will never use everything out of it. The pattern the should be used is to directly import the modules one uses.
2018-06-13Reformat .bzl files with buildifier and add format check.Thomas Van Lenten
Buildifier 0.12.0 includes initial support for reformatting .bzl files. - Reformat all the bzl files. - Expand the travis check to check the .bzl files also.
2018-05-09Add type checking functions.Taras Tsugrii
Even though it's not great to use type checks, they are frequently useful for checking input types of macros. Because there is no standard way of checking types, at least 2 types of checks are used: - `type(foo) == type([])` - `type(foo) == "list"` The first option is not very readable and the second option seem to be relying on an Bazel implementation detail. Encapsulating type checks into this library enables consistent and easy to understand type checking without explicitly relying on implementation details.
2018-05-04Add support for repr/str to new_sets (#42)upstream/0.4.0dmaclach
2018-05-01Skylint: stop using ctx.outputs.executable.Thomas Van Lenten
Be explicit about the file create/to run instead of using ctx.outputs.executable.
2018-05-01Address skylint warnings on the tests. (#39)Thomas Van Lenten
* Skylint: Move comment out of docstring. Is skylint seems more than a single like docstring, it expect a full comment with Args/Returns/etc.; avoid having to have full docstring but just making the comment a comment and not part of the docstring. * Address some skylint issues. - ctx.file_action -> ctx.actions.write - Return an empty list of providers rather then an old style empty struct.
2018-04-20Introduce new_sets.bzl (#32)Nicholas Titcombe
This version is hash-based (implemented on top of a dictionary) and doesn't suffer the performance problems of the current version. It will eventually replace the old one after a deprecation period.
2018-04-17Add support for 'functools.partial' like functionality. (#34)dmaclach
* Add support for 'functools.partial' like functionality. https://docs.python.org/3/library/functools.html#functools.partial
2018-03-07Don't special case current directory relative paths.upstream/0.3.1Thomas Van Lenten
2018-01-12Added a lib for version checking and comparison (#13)Jingwen
2017-10-10Initial check-in.Tony Allevato