3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/build-support
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
..
add-opengl-runpath addOpenGLRunpath: only apply to ELF files 2019-05-23 16:52:45 -04:00
agda treewide: fix *Flags 2019-12-30 04:50:37 +01:00
appimage appimage: do not use alias 2019-11-23 21:28:01 +01:00
bintools-wrapper Merge pull request #74090 from obsidiansystems/ghcjs-cross-without-cc 2019-12-30 16:40:43 -08:00
build-bazel-package buildBazelPackage: set $USER environment variable (#74538) 2019-11-28 16:14:45 -08:00
build-dotnet-package treewide: Make still dont* Variables are optional in most cases 2019-11-01 14:44:44 -04:00
build-fhs-userenv chrootenv: propagate nested chrootenv /host 2019-05-30 15:34:01 +03:00
build-setupcfg Revert "buildSetupcfg: Include unzip for zip sources." 2018-04-14 20:12:22 -04:00
buildenv buildEnv: check pathsToLink before checking collisions 2019-09-18 15:13:50 +02:00
cc-wrapper Merge pull request #74090 from obsidiansystems/ghcjs-cross-without-cc 2019-12-30 16:40:43 -08:00
docker Merge pull request #75781 from grahamc/dockertools/remove-implementation-detail-layers 2019-12-17 16:03:11 -05:00
dotnetbuildhelpers
dotnetenv [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
emacs emacs package setup hook: Fix Fix 2019-11-23 19:49:56 +01:00
expand-response-params
fetchbitbucket all-packages: move fetch* to pkgs/build-support/ 2019-01-26 22:47:54 -05:00
fetchbower Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchbzr treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchcvs bsd: init netbsd & openbsd userland 2018-04-24 14:16:35 -05:00
fetchdarcs pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchdocker treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
fetchfossil treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
fetchgit nix-prefetch-git: list --branch-name in help 2019-11-26 20:43:23 +01:00
fetchgithub all-packages: move fetch* to pkgs/build-support/ 2019-01-26 22:47:54 -05:00
fetchgitiles fetchFromGitiles: init 2019-12-02 22:44:33 +00:00
fetchgitlab fetchFromGitLab: improve readability 2019-12-09 01:33:16 +00:00
fetchgitlocal pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchgx Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchhg prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
fetchipfs prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
fetchmavenartifact
fetchmtn treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchnuget pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchpatch fetchpatch: explain why we use 0.3.3 2019-05-12 15:16:45 +02:00
fetchrepoorcz all-packages: move fetch* to pkgs/build-support/ 2019-01-26 22:47:54 -05:00
fetchrepoproject treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchs3 pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchsavannah all-packages: move fetch* to pkgs/build-support/ 2019-01-26 22:47:54 -05:00
fetchsvn fetchsvn: move defaults to package file 2019-02-03 15:33:14 +00:00
fetchsvnrevision
fetchsvnssh fetchsvnssh: move defaults to package file 2019-02-03 15:30:27 +00:00
fetchurl fetchurl: Eliminate pointless cross differences 2019-11-11 00:25:24 -05:00
fetchzip treewide: remove unused variables (#63177) 2019-06-16 19:59:05 +00:00
icon-conv-tools
install-shell-files installShellFiles: init (#65211) 2019-09-04 23:19:17 +02:00
kernel modules-shrunk: preserve module priorities from build 2019-12-07 23:04:17 +01:00
libredirect libredirect: fix access return type 2019-11-12 04:29:11 +03:00
make-desktopitem makeDesktopItem: use runCommandLocal 2019-12-08 20:47:27 +01:00
make-startupitem
make-symlinks
mkshell mkshell: improve mergeInputs 2019-06-23 22:20:10 +02:00
mono-dll-fixer
nix-gitignore nix-gitignore: init at v3.0.0 (#46112) 2019-02-18 09:57:30 +00:00
nuke-references nukeReferences: Use stdenvNoCC 2019-10-11 17:12:09 +02:00
ocaml treewide: CAML_LD_LIBRARY_PATH may be undefined 2019-11-14 13:44:07 -05:00
oci-tools ociTools: init 2019-09-04 22:46:42 +00:00
prefer-remote-fetch prefer-fetch-remote: an overlay to fetch on remote builders 2019-01-18 14:41:10 +00:00
references-by-popularity references-by-popularity: cache computation to avoid memory bloat 2019-03-05 16:37:52 -05:00
release treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
remove-references-to
rust buildRustCrate: add buildTests flag to tell rustc to build tests instead of binaries 2020-01-07 11:57:34 +01:00
setup-hooks wrapGAppsHook: don't add empty variables 2019-12-10 17:19:10 +00:00
singularity-tools treewide: remove unused variables (#63177) 2019-06-16 19:59:05 +00:00
skaware buildSkawarePackage: pass through extra args 2019-12-16 13:27:10 +00:00
snap doc: fix after snaptools merge 2019-07-10 08:02:14 -07:00
src-only
substitute substituteAll: allowSubstitutes = false; 2019-02-07 22:20:42 +00:00
substitute-files substituteAllFiles: allowSubstitutes = false 2019-02-08 00:22:51 +00:00
templaterpm treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
upstream-updater treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
vm vmTools.fillDiskWithRPMs: fix cpio use 2019-12-08 21:03:39 +01:00
wrapper-common utils.bash: allow response files in bootstrapping 2019-04-20 23:17:04 -04:00
writers WriteHaskell: Strip binaries 2019-12-14 09:32:34 +01:00
build-maven.nix buildMaven: Support metadata-only dependencies 2018-11-29 17:29:59 +00:00
build-pecl.nix phpPackages: build phpPackages with re2c 2019-06-11 22:21:35 +03:00
closure-info.nix treewide: remove unused variables (#63177) 2019-06-16 19:59:05 +00:00
dhall-to-nix.nix treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
plugins.nix
replace-dependency.nix
setup-systemd-units.nix
source-from-head-fun.nix treewide: Change URLs to HTTPS 2019-04-22 10:19:54 +02:00
trivial-builders.nix pkgs/build-support/trivial-builders: remove runCommandCCLocal 2019-12-04 21:17:01 +01:00