nixpkgs/pkgs
Andreas Rammhold a3a51763f9
buildRustCrate: add buildTests flag to tell rustc to build tests instead of binaries
This helps us instruct rustc to build tests instead of binaries. The
actual build will then ONLY produce test executables. This is a first
step towards having rust crate tests within nixpkgs.

We default back to only a single output in test cases since that is the
only reasonable thing to do here.

Producing libraries or binaries in addition to tests would theoretically
be feasible but usually generates different dependency trees. It is very
common to have some libraries in `[dev-depdendencies]` within Cargo.toml
just for your tests. To not start mixing things up going with a
dedicated derivation for the test build sounds like the best choice for
now.

To use this you must provide a proper test dependency chain to
`buildRustCrate` (as you would usually do with your non-test inputs).
And then set the `buildTests` attribute to `true`. The derivation will
then contain all tests that were built in `$out/tests`. All common test
patterns and directories should be supported and tested by this change.

Below is an example how you would run a single test from the derivation.
This commit contains some more examples in the `buildRustCrateTests`
attribute set that might be helpful.

```
let
  drv = buildRustCrate {
     …
     buildTests true;
  };
in runCommand "test-my-crate" {} ''
  touch $out
  exec ${drv}/tests/my-test
''
```
2020-01-07 11:57:34 +01:00
..
applications Merge pull request #77185 from r-ryantm/auto-update/pgmodeler 2020-01-07 05:33:01 -05:00
build-support buildRustCrate: add buildTests flag to tell rustc to build tests instead of binaries 2020-01-07 11:57:34 +01:00
common-updater
data theme-obsidian2: 2.9 -> 2.10 2020-01-03 12:53:12 +00:00
desktops Merge pull request #77092 from worldofpeace/pantheon-update-jan-6 2020-01-07 02:22:09 -05:00
development Merge pull request #77202 from raboof/jitterentropy-reproducible-manpages 2020-01-07 11:13:23 +01:00
games gzdoom: 4.2.4 -> 4.3.1 2020-01-06 20:39:18 +01:00
misc vscode.extensions.scalameta.metals: init at 1.6.3 2020-01-06 00:39:12 -08:00
os-specific linuxPackages_5_4.ddci-driver: fix build 2020-01-06 18:47:37 +01:00
servers mpd: 0.21.17 -> 0.21.18 2020-01-07 04:13:33 +00:00
shells zsh-powerlevel10k: init at unstable-2019-12-19 2020-01-06 21:49:15 +01:00
stdenv Merge pull request #74090 from obsidiansystems/ghcjs-cross-without-cc 2019-12-30 16:40:43 -08:00
test
tools Merge pull request #77171 from r-ryantm/auto-update/opkg 2020-01-07 11:25:34 +01:00
top-level Merge pull request #76941 from Pamplemousse/bash_unit 2020-01-07 09:31:53 +01:00