Skip to content

Commit

Permalink
Disable tests that do not work in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewliebenow committed Oct 19, 2024
1 parent 9347824 commit d184170
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions tests/by-util/test_stty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,19 @@ impl UCommand {

self.set_stdin(stdio)
}

Check warning on line 42 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L41-L42

Added lines #L41 - L42 were not covered by tests

fn conditional_set_stdin_to_dev_tty_stdio(&mut self, set_stdin: bool) -> &mut Self {

Check warning on line 44 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L44

Added line #L44 was not covered by tests
if set_stdin {
self.set_stdin_to_dev_tty_stdio()

Check warning on line 46 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L46

Added line #L46 was not covered by tests
} else {
self

Check warning on line 48 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L48

Added line #L48 was not covered by tests
}
}

Check warning on line 50 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L50

Added line #L50 was not covered by tests
}

#[test]
#[cfg(not(target_os = "android"))]
#[ignore = "These tests should work locally, but /dev/tty isn't configured when running in CI"]
fn test_invalid_arg() {
new_ucmd!()

Check warning on line 57 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L57

Added line #L57 was not covered by tests
.arg("--definitely-invalid")
Expand All @@ -54,12 +63,14 @@ fn test_invalid_arg() {

#[test]
#[cfg(not(target_os = "android"))]
#[ignore = "These tests should work locally, but /dev/tty isn't configured when running in CI"]
fn runs() {
new_ucmd!().set_stdin_to_dev_tty_stdio().succeeds();

Check warning on line 68 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L68

Added line #L68 was not covered by tests
}

#[test]
#[cfg(not(target_os = "android"))]
#[ignore = "These tests should work locally, but /dev/tty isn't configured when running in CI"]
fn print_all() {
let cmd_result = new_ucmd!()

Check warning on line 75 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L75

Added line #L75 was not covered by tests
.arg("-a")
Expand Down Expand Up @@ -115,6 +126,7 @@ fn save_and_all() {
// Make sure the "allow_hyphen_values" clap function has been called with true
#[test]
#[cfg(not(target_os = "android"))]
#[ignore = "These tests should work locally, but /dev/tty isn't configured when running in CI"]
fn negation() {
new_ucmd!()

Check warning on line 131 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L130-L131

Added lines #L130 - L131 were not covered by tests
.arg("-ixon")
Expand All @@ -124,10 +136,10 @@ fn negation() {
.stderr_is_bytes([]);
}

Check warning on line 137 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L136-L137

Added lines #L136 - L137 were not covered by tests

fn run_and_check_print_should_succeed(args: &[&str], stdout_regex: &Regex) {
fn run_and_check_print_should_succeed(args: &[&str], stdout_regex: &Regex, set_stdin: bool) {
new_ucmd!()

Check warning on line 140 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L139-L140

Added lines #L139 - L140 were not covered by tests
.args(args)
.set_stdin_to_dev_tty_stdio()
.conditional_set_stdin_to_dev_tty_stdio(set_stdin)
.succeeds()
.stdout_str_check(|st| {

Check warning on line 144 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L144

Added line #L144 was not covered by tests
let Some(str) = st.lines().next() else {
Expand All @@ -142,13 +154,15 @@ fn run_and_check_print_should_succeed(args: &[&str], stdout_regex: &Regex) {
// The end of options delimiter ("--") and everything after must be ignored
#[test]
#[cfg(not(target_os = "android"))]
#[ignore = "These tests should work locally, but /dev/tty isn't configured when running in CI"]
fn ignore_end_of_options_and_after() {

Check warning on line 158 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L158

Added line #L158 was not covered by tests
{
// "stty -a -- -ixon" should behave like "stty -a"
// Should not abort with an error complaining about passing both "-a" and "-ixon" (since "-ixon" is after "--")
run_and_check_print_should_succeed(

Check warning on line 162 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L162

Added line #L162 was not covered by tests
&["-a", "--", "-ixon"],
get_print_dash_a_first_line_regex(),

Check warning on line 164 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L164

Added line #L164 was not covered by tests
true,
);
}

Expand All @@ -158,12 +172,14 @@ fn ignore_end_of_options_and_after() {
run_and_check_print_should_succeed(

Check warning on line 172 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L172

Added line #L172 was not covered by tests
&["--", "non-existent-option-that-must-be-ignored"],
get_print_first_line_regex(),

Check warning on line 174 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L174

Added line #L174 was not covered by tests
true,
);
}
}

Check warning on line 178 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L178

Added line #L178 was not covered by tests

#[test]
#[cfg(not(target_os = "android"))]
#[ignore = "These tests should work locally, but /dev/tty isn't configured when running in CI"]
fn f_file_option() {

Check warning on line 183 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L183

Added line #L183 was not covered by tests
for st in ["-F", "--file"] {
for bo in [false, true] {
Expand All @@ -180,14 +196,15 @@ fn f_file_option() {
(&arr, get_print_first_line_regex())

Check warning on line 196 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L196

Added line #L196 was not covered by tests
};

run_and_check_print_should_succeed(args, regex);
run_and_check_print_should_succeed(args, regex, false);
}
}
}

Check warning on line 202 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L199-L202

Added lines #L199 - L202 were not covered by tests

// Make sure stty is using stdin to look up terminal attributes, not stdout
#[test]
#[cfg(not(target_os = "android"))]
#[ignore = "These tests should work locally, but /dev/tty isn't configured when running in CI"]
fn correct_file_descriptor_output_piped() {

Check warning on line 208 in tests/by-util/test_stty.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_stty.rs#L208

Added line #L208 was not covered by tests
const PIPE_STDOUT_TO: &str = "pipe_stdout_to";
const PIPE_STDERR_TO: &str = "pipe_stderr_to";
Expand Down

0 comments on commit d184170

Please sign in to comment.