|
1 | 1 | //! Tests for fingerprinting (rebuild detection). |
2 | 2 |
|
3 | | -use std::env::consts::EXE_SUFFIX; |
4 | 3 | use std::fs::{self, OpenOptions}; |
5 | 4 | use std::io; |
6 | 5 | use std::io::prelude::*; |
@@ -3183,85 +3182,3 @@ fn use_mtime_cache_in_cargo_home() { |
3183 | 3182 | "#]]) |
3184 | 3183 | .run(); |
3185 | 3184 | } |
3186 | | - |
3187 | | -#[cargo_test] |
3188 | | -fn overwrite_cargo_environment_variable() { |
3189 | | - // If passed arguments `arg1 arg2 ...`, this program runs them as a command. |
3190 | | - // If passed no arguments, this program simply prints `$CARGO`. |
3191 | | - let p = project() |
3192 | | - .file("Cargo.toml", &basic_manifest("foo", "1.0.0")) |
3193 | | - .file( |
3194 | | - "src/main.rs", |
3195 | | - r#" |
3196 | | - fn main() { |
3197 | | - let mut args = std::env::args().skip(1); |
3198 | | - if let Some(arg1) = args.next() { |
3199 | | - let status = std::process::Command::new(arg1) |
3200 | | - .args(args) |
3201 | | - .status() |
3202 | | - .unwrap(); |
3203 | | - assert!(status.success()); |
3204 | | - } else { |
3205 | | - eprintln!("{}", std::env::var("CARGO").unwrap()); |
3206 | | - } |
3207 | | - } |
3208 | | - "#, |
3209 | | - ) |
3210 | | - .build(); |
3211 | | - |
3212 | | - // Create two other cargo binaries in the project root, one with the wrong |
3213 | | - // name and one with the right name. |
3214 | | - let cargo_exe = cargo_test_support::cargo_exe(); |
3215 | | - let wrong_name_path = p.root().join(format!("wrong_name{EXE_SUFFIX}")); |
3216 | | - let other_cargo_path = p.root().join(cargo_exe.file_name().unwrap()); |
3217 | | - std::fs::hard_link(&cargo_exe, &wrong_name_path).unwrap(); |
3218 | | - std::fs::hard_link(&cargo_exe, &other_cargo_path).unwrap(); |
3219 | | - |
3220 | | - // The output of each of the following commands should be `path-to-cargo`: |
3221 | | - // ``` |
3222 | | - // cargo run |
3223 | | - // cargo run -- cargo run |
3224 | | - // cargo run -- wrong_name run |
3225 | | - // ``` |
3226 | | - |
3227 | | - let cargo = cargo_exe.display().to_string(); |
3228 | | - let wrong_name = wrong_name_path.display().to_string(); |
3229 | | - let stderr_cargo = format!( |
3230 | | - "{}[EXE]\n", |
3231 | | - cargo_exe |
3232 | | - .canonicalize() |
3233 | | - .unwrap() |
3234 | | - .with_extension("") |
3235 | | - .to_str() |
3236 | | - .unwrap() |
3237 | | - ); |
3238 | | - |
3239 | | - for cmd in [ |
3240 | | - "run", |
3241 | | - &format!("run -- {cargo} run"), |
3242 | | - &format!("run -- {wrong_name} run"), |
3243 | | - ] { |
3244 | | - p.cargo(cmd).with_stderr_contains(&stderr_cargo).run(); |
3245 | | - } |
3246 | | - |
3247 | | - // The output of the following command should be `path-to-other-cargo`: |
3248 | | - // ``` |
3249 | | - // cargo run -- other_cargo run |
3250 | | - // ``` |
3251 | | - |
3252 | | - let other_cargo = other_cargo_path.display().to_string(); |
3253 | | - let stderr_other_cargo = format!( |
3254 | | - "{}[EXE]\n", |
3255 | | - other_cargo_path |
3256 | | - .canonicalize() |
3257 | | - .unwrap() |
3258 | | - .with_extension("") |
3259 | | - .to_str() |
3260 | | - .unwrap() |
3261 | | - .replace(p.root().parent().unwrap().to_str().unwrap(), "[ROOT]") |
3262 | | - ); |
3263 | | - |
3264 | | - p.cargo(&format!("run -- {other_cargo} run")) |
3265 | | - .with_stderr_contains(stderr_other_cargo) |
3266 | | - .run(); |
3267 | | -} |
0 commit comments