title: How to change build.rs behavior based on the current Cargo command?
body: <p>My build.rs is complicated since I am using it to generate tests and run some other binaries before actually compiling my current project. These tests rely on auto-generated code from these other binaries. These binaries can change dynamically thus changing the auto-generated code files so I do not want to statically write these tests. However, this ends up taking an enormous amount of time. </p>
  
  <p>This is no problem when I want to run <code>cargo test</code>, but when I'm running <code>cargo build &amp;&amp; cargo run</code> or <code>cargo bench</code> which don't need these generated tests, the long build time caused by build.rs becomes extremely annoying. </p>
  
  <p>Is there any way to specify that I only want build.rs to execute when using <code>cargo test</code>? Is there some way in build.rs to detect which Cargo command is being run? </p>