]> git.proxmox.com Git - rustc.git/blob - vendor/ui_test/src/error.rs
New upstream version 1.72.1+dfsg1
[rustc.git] / vendor / ui_test / src / error.rs
1 use crate::{parser::Pattern, rustc_stderr::Message, Mode};
2 use std::{path::PathBuf, process::ExitStatus};
3
4 /// All the ways in which a test can fail.
5 #[derive(Debug)]
6 pub enum Error {
7 /// Got an invalid exit status for the given mode.
8 ExitStatus {
9 /// The expected mode.
10 mode: Mode,
11 /// The exit status of the command.
12 status: ExitStatus,
13 /// The expected exit status as set in the file or derived from the mode.
14 expected: i32,
15 },
16 /// A pattern was declared but had no matching error.
17 PatternNotFound {
18 /// The pattern that was missing an error
19 pattern: Pattern,
20 /// The line in which the pattern was defined.
21 definition_line: usize,
22 },
23 /// A ui test checking for failure does not have any failure patterns
24 NoPatternsFound,
25 /// A ui test checking for success has failure patterns
26 PatternFoundInPassTest,
27 /// Stderr/Stdout differed from the `.stderr`/`.stdout` file present.
28 OutputDiffers {
29 /// The file containing the expected output that differs from the actual output.
30 path: PathBuf,
31 /// The output from the command.
32 actual: Vec<u8>,
33 /// The contents of the file.
34 expected: Vec<u8>,
35 /// A command, that when run, causes the output to get blessed instead of erroring.
36 bless_command: String,
37 },
38 /// There were errors that don't have a pattern.
39 ErrorsWithoutPattern {
40 /// The main message of the error.
41 msgs: Vec<Message>,
42 /// File and line information of the error.
43 path: Option<(PathBuf, usize)>,
44 },
45 /// A comment failed to parse.
46 InvalidComment {
47 /// The comment
48 msg: String,
49 /// THe line in which it was defined.
50 line: usize,
51 },
52 /// A subcommand (e.g. rustfix) of a test failed.
53 Command {
54 /// The name of the subcommand (e.g. "rustfix").
55 kind: String,
56 /// The exit status of the command.
57 status: ExitStatus,
58 },
59 /// This catches crashes of ui tests and reports them along the failed test.
60 Bug(String),
61 /// An auxiliary build failed with its own set of errors.
62 Aux {
63 /// Path to the aux file.
64 path: PathBuf,
65 /// The errors that occurred during the build of the aux file.
66 errors: Vec<Error>,
67 /// The line in which the aux file was requested to be built.
68 line: usize,
69 },
70 }
71
72 pub(crate) type Errors = Vec<Error>;