Skip to content

Commit fe90448

Browse files
authored
Merge pull request #3238 from rbtcollins/test-bonanza
Use a single integration test binary
2 parents a8c0958 + 417371c commit fe90448

File tree

64 files changed

+36
-61
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+36
-61
lines changed

ci/run.bash

+7-14
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,17 @@ build_test() {
6161
cmd="$1"
6262
shift
6363
download_pkg_test "${cmd}"
64-
target_cargo "${cmd}" --bin rustup-init
65-
target_cargo "${cmd}" --lib --all
66-
if [ "build" != "${cmd}" ]; then
67-
target_cargo "${cmd}" --doc --all
68-
fi
69-
70-
if [ "build" = "${cmd}" ]; then
71-
target_cargo "${cmd}" --test dist
64+
if [ "build" = "${cmd}" ]; then
65+
target_cargo "${cmd}" --workspace --all-targets
7266
else
7367
# free runners have 2 or 3(mac) cores
74-
target_cargo "${cmd}" --test dist -- --test-threads 2
68+
target_cargo "${cmd}" --workspace --tests -- --test-threads 2
69+
fi
70+
71+
if [ "build" != "${cmd}" ]; then
72+
target_cargo "${cmd}" --doc --workspace
7573
fi
7674

77-
find tests -maxdepth 1 -type f ! -path '*/dist.rs' -name '*.rs' \
78-
| sed -e 's@^tests/@@;s@\.rs$@@g' \
79-
| while read -r test; do
80-
target_cargo "${cmd}" --test "${test}"
81-
done
8275
}
8376

8477
if [ -z "$SKIP_TESTS" ]; then

tests/mock/clitools.rs

-18
Original file line numberDiff line numberDiff line change
@@ -806,24 +806,6 @@ where
806806
!(run || self_cmd || version || (is_update && !no_self_update))
807807
}
808808

809-
#[deprecated]
810-
pub fn run<I, A>(config: &Config, name: &str, args: I, env: &[(&str, &str)]) -> SanitizedOutput
811-
where
812-
I: IntoIterator<Item = A> + Clone,
813-
A: AsRef<OsStr>,
814-
{
815-
config.run(name, args, env)
816-
}
817-
818-
#[deprecated]
819-
pub fn run_subprocess<I, A>(config: &Config, name: &str, args: I, env: &[(&str, &str)]) -> Output
820-
where
821-
I: IntoIterator<Item = A>,
822-
A: AsRef<OsStr>,
823-
{
824-
config.run_subprocess(name, args, env)
825-
}
826-
827809
#[derive(Copy, Clone, Eq, PartialEq)]
828810
enum RlsStatus {
829811
Available,

tests/cli-exact.rs renamed to tests/suite/cli_exact.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Yet more cli test cases. These are testing that the output
22
//! is exactly as expected.
33
4-
pub mod mock;
5-
64
use crate::mock::clitools::{self, set_current_dist_date, with_update_server, Config, Scenario};
75
use rustup::for_host;
86
use rustup::test::this_host_triple;

tests/cli-inst-interactive.rs renamed to tests/suite/cli_inst_interactive.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Tests of the interactive console installer
22
3-
pub mod mock;
4-
53
use std::env::consts::EXE_SUFFIX;
64
use std::io::Write;
75
use std::process::Stdio;

tests/cli-misc.rs renamed to tests/suite/cli_misc.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Test cases of the rustup command that do not depend on the
22
//! dist server, mostly derived from multirust/test-v2.sh
33
4-
pub mod mock;
5-
64
use std::str;
75
use std::{env::consts::EXE_SUFFIX, path::Path};
86

tests/cli-paths.rs renamed to tests/suite/cli_paths.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! This file contains tests relevant to Rustup's handling of updating PATHs.
22
//! It depends on self-update working, so if absolutely everything here breaks,
33
//! check those tests as well.
4-
pub mod mock;
54
65
// Prefer omitting actually unpacking content while just testing paths.
76
const INIT_NONE: [&str; 4] = ["rustup-init", "-y", "--default-toolchain", "none"];

tests/cli-rustup.rs renamed to tests/suite/cli_rustup.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Test cases for new rustup UI
22
3-
pub mod mock;
4-
53
use std::env::consts::EXE_SUFFIX;
64
use std::fs;
75
use std::path::{PathBuf, MAIN_SEPARATOR};
@@ -10,7 +8,10 @@ use rustup::for_host;
108
use rustup::test::this_host_triple;
119
use rustup::utils::raw;
1210

13-
use crate::mock::clitools::{self, Config, Scenario};
11+
use crate::mock::{
12+
self,
13+
clitools::{self, Config, Scenario},
14+
};
1415

1516
macro_rules! for_host_and_home {
1617
($config:ident, $s: expr) => {

tests/cli-self-upd.rs renamed to tests/suite/cli_self_upd.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Testing self install, uninstall and update
22
3-
pub mod mock;
4-
53
use std::env;
64
use std::env::consts::EXE_SUFFIX;
75
use std::fs;
@@ -14,9 +12,10 @@ use rustup::test::{this_host_triple, with_saved_path};
1412
use rustup::utils::{raw, utils};
1513
use rustup::{for_host, Notification, DUP_TOOLS, TOOLS};
1614

17-
use crate::clitools::output_release_file;
18-
use crate::mock::clitools::{self, self_update_setup, Config, Scenario};
19-
use crate::mock::dist::calc_hash;
15+
use crate::mock::{
16+
clitools::{self, output_release_file, self_update_setup, Config, Scenario},
17+
dist::calc_hash,
18+
};
2019

2120
const TEST_VERSION: &str = "1.1.1";
2221

tests/cli-ui.rs renamed to tests/suite/cli_ui.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ fn rustup_init_ui_doc_text_tests() {
2323
let project_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
2424
t.register_bin("rustup-init", &rustup_init);
2525
t.register_bin("rustup-init.sh", &project_root.join("rustup-init.sh"));
26-
t.case("tests/cli-ui/rustup-init/*.toml");
26+
t.case("tests/suite/cli-ui/rustup-init/*.toml");
2727
#[cfg(target_os = "windows")]
2828
{
29-
// On non-windows, we don't use rustup-init.sh, so skip the test.
30-
t.skip("tests/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml");
29+
// On windows, we don't use rustup-init.sh, so skip the test.
30+
t.skip("tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml");
3131
}
3232

3333
// On non-windows, we don't use rustup-init.sh, so skip the test.
3434
#[cfg(not(target_os = "windows"))]
3535
{
3636
let rustup_init_help_toml =
37-
project_root.join("tests/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml");
38-
let rustup_init_sh_help_toml =
39-
project_root.join("tests/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml");
37+
project_root.join("tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml");
38+
let rustup_init_sh_help_toml = project_root
39+
.join("tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml");
4040

4141
#[derive(Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
4242
struct Stdout {

tests/cli-v1.rs renamed to tests/suite/cli_v1.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Test cases of the rustup command, using v1 manifests, mostly
22
//! derived from multirust/test-v2.sh
33
4-
pub mod mock;
5-
64
use std::fs;
75

86
use rustup::for_host;

tests/cli-v2.rs renamed to tests/suite/cli_v2.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Test cases of the rustup command, using v2 manifests, mostly
22
//! derived from multirust/test-v2.sh
33
4-
pub mod mock;
5-
64
use std::fs;
75
use std::io::Write;
86

tests/dist.rs renamed to tests/suite/dist.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Tests of installation and updates from a v2 Rust distribution
22
// server (mocked on the file system)
33

4-
pub mod mock;
5-
64
use std::cell::Cell;
75
use std::collections::HashMap;
86
use std::env;

tests/dist_install.rs renamed to tests/suite/dist_install.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
pub mod mock;
2-
31
use std::fs::File;
42
use std::io::Write;
53

File renamed without changes.
File renamed without changes.

tests/suite/mod.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
mod cli_exact;
2+
mod cli_inst_interactive;
3+
mod cli_misc;
4+
mod cli_paths;
5+
mod cli_rustup;
6+
mod cli_self_upd;
7+
mod cli_ui;
8+
mod cli_v1;
9+
mod cli_v2;
10+
mod dist;
11+
mod dist_install;
12+
mod dist_manifest;
13+
mod dist_transactions;

tests/test_bonanza.rs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mod mock;
2+
mod suite;

0 commit comments

Comments
 (0)