Skip to content

Commit ee987a1

Browse files
committed
Remove tester subcommand again
This functionality is better implemented manually on top of `bootimage run`. Such a manual implementation can be a proper workspace member and correctly share the sysroot and the target artifacts (with the `bootimage tester` we don't achieve sharing because the dependency fingerprints differ).
1 parent a01c22c commit ee987a1

File tree

5 files changed

+2
-296
lines changed

5 files changed

+2
-296
lines changed

azure-pipelines.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,3 @@ jobs:
198198
if [ $? -eq 109 ]; then (exit 0); else (exit 1); fi
199199
workingDirectory: example-kernels/runner
200200
displayName: 'Run `cargo xrun` for "runner" kernel'
201-
202-
- script: cargo test
203-
workingDirectory: example-kernels/tester
204-
displayName: 'Run `cargo test` for "tester" kernel'

src/args.rs

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pub(crate) fn parse_args() -> Result<Command, ErrorString> {
3030
cmd => cmd,
3131
}),
3232
Some("runner") => parse_runner_args(args),
33-
Some("tester") => parse_tester_args(args),
3433
Some("--help") | Some("-h") => Ok(Command::Help),
3534
Some("--version") => Ok(Command::Version),
3635
_ => Ok(Command::NoSubcommand),
@@ -244,63 +243,3 @@ pub struct RunnerArgs {
244243
pub executable: PathBuf,
245244
}
246245

247-
fn parse_tester_args<A>(args: A) -> Result<Command, ErrorString>
248-
where
249-
A: Iterator<Item = String>,
250-
{
251-
let mut arg_iter = args.into_iter().fuse();
252-
let test_path_arg = PathBuf::from(
253-
arg_iter
254-
.next()
255-
.ok_or("excepted path to test source file as first argument")?,
256-
);
257-
let test_path = test_path_arg.canonicalize().map_err(|err| {
258-
format!(
259-
"Failed to canonicalize test path `{}`: {}",
260-
test_path_arg.display(),
261-
err
262-
)
263-
})?;
264-
let mut run_command = None;
265-
let mut target = None;
266-
267-
loop {
268-
match arg_iter.next().as_ref().map(|s| s.as_str()) {
269-
Some("--command") => {
270-
let old = mem::replace(&mut run_command, Some(arg_iter.collect()));
271-
if !old.is_none() {
272-
Err("multiple `--command` arguments")?;
273-
}
274-
break;
275-
}
276-
Some("--target") => {
277-
let old = mem::replace(&mut target, arg_iter.next());
278-
if !old.is_none() {
279-
Err("multiple `--target` arguments")?;
280-
}
281-
break;
282-
}
283-
Some("--help") | Some("-h") => {
284-
return Ok(Command::TesterHelp);
285-
}
286-
Some("--version") => {
287-
return Ok(Command::Version);
288-
}
289-
None => break,
290-
Some(arg) => Err(format!("unexpected argument `{}`", arg))?,
291-
}
292-
}
293-
294-
Ok(Command::Tester(TesterArgs {
295-
test_path,
296-
run_command,
297-
target,
298-
}))
299-
}
300-
301-
#[derive(Debug, Clone)]
302-
pub struct TesterArgs {
303-
pub test_path: PathBuf,
304-
pub run_command: Option<Vec<String>>,
305-
pub target: Option<String>,
306-
}

src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use args::{Args, RunnerArgs, TesterArgs};
1+
use args::{Args, RunnerArgs};
22
use std::{fmt, process};
33

44
pub mod args;
@@ -14,14 +14,12 @@ enum Command {
1414
Run(Args),
1515
Test(Args),
1616
Runner(RunnerArgs),
17-
Tester(TesterArgs),
1817
Help,
1918
BuildHelp,
2019
RunHelp,
2120
TestHelp,
2221
CargoBootimageHelp,
2322
RunnerHelp,
24-
TesterHelp,
2523
Version,
2624
}
2725

@@ -46,14 +44,13 @@ pub fn run() -> Result<Option<i32>, ErrorString> {
4644
Command::Run(args) => subcommand::run::run(args).map(Some),
4745
Command::Test(args) => subcommand::test::test(args).map(none),
4846
Command::Runner(args) => subcommand::runner::runner(args).map(Some),
49-
Command::Tester(args) => subcommand::tester::tester(args).map(none),
5047
Command::NoSubcommand => help::no_subcommand(),
5148
Command::Help => Ok(help::help()).map(none),
5249
Command::BuildHelp => Ok(help::build_help()).map(none),
5350
Command::RunHelp => Ok(help::run_help()).map(none),
5451
Command::TestHelp => Ok(help::test_help()).map(none),
5552
Command::Version => Ok(println!("bootimage {}", env!("CARGO_PKG_VERSION"))).map(none),
56-
Command::RunnerHelp | Command::TesterHelp | Command::CargoBootimageHelp => unimplemented!(),
53+
Command::RunnerHelp | Command::CargoBootimageHelp => unimplemented!(),
5754
}
5855
}
5956

src/subcommand.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ pub mod build;
22
pub mod run;
33
pub mod runner;
44
pub mod test;
5-
pub mod tester;

src/subcommand/tester.rs

Lines changed: 0 additions & 225 deletions
This file was deleted.

0 commit comments

Comments
 (0)