{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/cargo/issues/2305","labels_url":"https://api.github.com/repos/rust-lang/cargo/issues/2305/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/cargo/issues/2305/comments","events_url":"https://api.github.com/repos/rust-lang/cargo/issues/2305/events","html_url":"https://github.com/rust-lang/cargo/issues/2305","id":128264287,"number":2305,"title":"\"Could not execute process (never executed)\" with [lib] harness = false","user":{"login":"SimonSapin","id":291359,"avatar_url":"https://avatars.githubusercontent.com/u/291359?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonSapin","html_url":"https://github.com/SimonSapin","followers_url":"https://api.github.com/users/SimonSapin/followers","following_url":"https://api.github.com/users/SimonSapin/following{/other_user}","gists_url":"https://api.github.com/users/SimonSapin/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSapin/subscriptions","organizations_url":"https://api.github.com/users/SimonSapin/orgs","repos_url":"https://api.github.com/users/SimonSapin/repos","events_url":"https://api.github.com/users/SimonSapin/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSapin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/cargo/labels/E-easy","name":"E-easy","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-22T22:45:41Z","updated_at":"2016-01-23T00:44:06Z","closed_at":null,"body":"http://doc.crates.io/manifest.html#configuring-a-target suggests that `harness = false` can be used in the `[lib]` section of `Cargo.toml`. Let’s try it:\r\n\r\n```rust\r\n/tmp% cargo new foo\r\n/tmp% cd foo \r\n/tmp/foo% echo -e '[lib]\\nharness=false' >> Cargo.toml\r\n/tmp/foo% cargo test -v\r\n   Compiling foo v0.1.0 (file:///tmp/foo)\r\n     Running `rustc src/lib.rs --crate-name foo --crate-type lib -g -C metadata=9476bb3dbe366490 -C extra-filename=-9476bb3dbe366490 --out-dir /tmp/foo/target/debug --emit=dep-info,link -L dependency=/tmp/foo/target/debug -L dependency=/tmp/foo/target/debug/deps`\r\n     Running `rustc src/lib.rs --crate-name foo --crate-type lib -g --out-dir /tmp/foo/target/debug --emit=dep-info,link -L dependency=/tmp/foo/target/debug -L dependency=/tmp/foo/target/debug/deps`\r\n     Running `/tmp/foo/target/debug/foo-9476bb3dbe366490`\r\nCould not execute process `/tmp/foo/target/debug/foo-9476bb3dbe366490` (never executed)\r\n\r\nCaused by:\r\n  Could not execute process `/tmp/foo/target/debug/foo-9476bb3dbe366490` (never executed)\r\n\r\nCaused by:\r\n  No such file or directory (os error 2)\r\n```\r\n\r\n`--test` is indeed not passed, but `--crate-type lib` still is so no executable is created.\r\n\r\nGrepping Cargo’s source shows an example in `tests/test_cargo_test.rs` where `harness = false`  is used in `[[test]]`, which makes more sense.\r\n\r\nSo:\r\n\r\n* The docs should show `harness = false` in a `[[test]]` section, not `[lib]`.\r\n* `harness = false` in `[lib]` should probably emit a warning and be otherwise ignored, since it doesn’t work. Or make Cargo emit in error and abort.\r\n* With `harness = false` in `[[bin]]`, there is no way that I can find to tell whether an executable is being built for testing or not. Maybe pass `--cfg test`?"},"comment":{"url":"https://api.github.com/repos/rust-lang/cargo/issues/comments/174099254","html_url":"https://github.com/rust-lang/cargo/issues/2305#issuecomment-174099254","issue_url":"https://api.github.com/repos/rust-lang/cargo/issues/2305","id":174099254,"user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"created_at":"2016-01-23T00:44:06Z","updated_at":"2016-01-23T00:44:06Z","body":"I'm gonna tag this as `E-easy` as this is likely a pretty easy-to-approach project for anyone looking to dive into Cargo!"}}