Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure clippy runs on all targets #972

Merged
merged 5 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ args = ["run", "--", "--data-dir", "${CARGO_TARGET_DIR}/dev-data/", "@@split(CAR

# Simple clippy tweak
[tasks.clippy]
args = ["clippy", "--", "@@split(CARGO_MAKE_TASK_ARGS,;)"]
args = ["clippy", "--all-targets", "--", "@@split(CARGO_MAKE_TASK_ARGS,;)"]

# Release building and installing Zellij
[tasks.install]
Expand Down
30 changes: 3 additions & 27 deletions src/tests/e2e/cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ pub fn starts_with_one_terminal() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size);
let last_snapshot = runner.take_snapshot_after(Step {
name: "Wait for app to load",
Expand Down Expand Up @@ -112,7 +111,6 @@ pub fn split_terminals_vertically() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size).add_step(Step {
name: "Split pane to the right",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
Expand Down Expand Up @@ -157,7 +155,6 @@ pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size).add_step(Step {
name: "Split pane to the right",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
Expand Down Expand Up @@ -205,7 +202,6 @@ pub fn scrolling_inside_a_pane() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.retry_pause_ms(1000) // we need a longer retry period here because it takes some time to fill the pty buffer
.add_step(Step {
Expand Down Expand Up @@ -306,7 +302,6 @@ pub fn toggle_pane_fullscreen() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -371,7 +366,6 @@ pub fn open_new_tab() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -440,7 +434,6 @@ pub fn close_tab() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -524,7 +517,6 @@ pub fn close_pane() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -587,9 +579,8 @@ pub fn exit_zellij() {
rows: 24,
};
let mut test_attempts = 10;
let last_snapshot = loop {
let last_snapshot = {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size).add_step(Step {
name: "Wait for app to load",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
Expand All @@ -603,7 +594,7 @@ pub fn exit_zellij() {
},
});
runner.run_all_steps();
break runner.take_snapshot_after(Step {
runner.take_snapshot_after(Step {
name: "Wait for app to exit",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
Expand All @@ -614,7 +605,7 @@ pub fn exit_zellij() {
}
step_is_complete
},
});
})
};
assert!(last_snapshot.contains("Bye from Zellij!"));
}
Expand All @@ -629,7 +620,6 @@ pub fn closing_last_pane_exits_zellij() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size).add_step(Step {
name: "Close pane",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
Expand Down Expand Up @@ -672,7 +662,6 @@ pub fn typing_exit_closes_pane() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -738,7 +727,6 @@ pub fn resize_pane() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -803,7 +791,6 @@ pub fn lock_mode() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Enter lock mode",
Expand Down Expand Up @@ -864,7 +851,6 @@ pub fn resize_terminal_window() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -926,7 +912,6 @@ pub fn detach_and_attach_session() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new_mirrored_session(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -1014,7 +999,6 @@ pub fn accepts_basic_layout() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new_with_layout(fake_win_size, layout_file_name);
runner.run_all_steps();
let last_snapshot = runner.take_snapshot_after(Step {
Expand Down Expand Up @@ -1050,7 +1034,6 @@ fn focus_pane_with_mouse() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Split pane to the right",
Expand Down Expand Up @@ -1111,7 +1094,6 @@ pub fn scrolling_inside_a_pane_with_mouse() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size)
.retry_pause_ms(1000) // we need a longer retry period here because it takes some time to fill the pty buffer
.add_step(Step {
Expand Down Expand Up @@ -1208,7 +1190,6 @@ pub fn start_without_pane_frames() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new_without_frames(fake_win_size).add_step(Step {
name: "Split pane to the right",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
Expand Down Expand Up @@ -1259,7 +1240,6 @@ pub fn mirrored_sessions() {
// here we connect with one runner, then connect with another, perform some actions and
// then make sure they were also reflected (mirrored) in the first runner afterwards
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut first_runner =
RemoteRunner::new_with_session_name(fake_win_size, session_name, true)
.dont_panic()
Expand Down Expand Up @@ -1409,7 +1389,6 @@ pub fn multiple_users_in_same_pane_and_tab() {
// here we connect with one runner, then connect with another, perform some actions and
// then make sure they were also reflected (mirrored) in the first runner afterwards
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut first_runner =
RemoteRunner::new_with_session_name(fake_win_size, session_name, false)
.dont_panic()
Expand Down Expand Up @@ -1498,7 +1477,6 @@ pub fn multiple_users_in_different_panes_and_same_tab() {
// here we connect with one runner, then connect with another, perform some actions and
// then make sure they were also reflected (mirrored) in the first runner afterwards
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut first_runner =
RemoteRunner::new_with_session_name(fake_win_size, session_name, false)
.dont_panic()
Expand Down Expand Up @@ -1591,7 +1569,6 @@ pub fn multiple_users_in_different_tabs() {
// here we connect with one runner, then connect with another, perform some actions and
// then make sure they were also reflected (mirrored) in the first runner afterwards
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut first_runner =
RemoteRunner::new_with_session_name(fake_win_size, session_name, false)
.dont_panic()
Expand Down Expand Up @@ -1690,7 +1667,6 @@ pub fn bracketed_paste() {
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
drop(());
let mut runner = RemoteRunner::new(fake_win_size).add_step(Step {
name: "Send pasted text followed by normal text",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
Expand Down
11 changes: 6 additions & 5 deletions src/tests/e2e/remote_runner.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use zellij_tile::data::Palette;

Expand Down Expand Up @@ -135,8 +136,8 @@ fn read_from_channel(
last_snapshot: &Arc<Mutex<String>>,
cursor_coordinates: &Arc<Mutex<(usize, usize)>>,
pane_geom: &PaneGeom,
) -> (Arc<Mutex<bool>>, std::thread::JoinHandle<()>) {
let should_keep_running = Arc::new(Mutex::new(true));
) -> (Arc<AtomicBool>, std::thread::JoinHandle<()>) {
let should_keep_running = Arc::new(AtomicBool::new(true));
let thread = std::thread::Builder::new()
.name("read_thread".into())
.spawn({
Expand All @@ -151,7 +152,7 @@ fn read_from_channel(
move || {
let mut should_sleep = false;
loop {
if !*should_keep_running.lock().unwrap() {
if !should_keep_running.load(Ordering::SeqCst) {
break;
}
if should_sleep {
Expand Down Expand Up @@ -307,7 +308,7 @@ pub struct RemoteRunner {
panic_on_no_retries_left: bool,
last_snapshot: Arc<Mutex<String>>,
cursor_coordinates: Arc<Mutex<(usize, usize)>>, // x, y
reader_thread: (Arc<Mutex<bool>>, std::thread::JoinHandle<()>),
reader_thread: (Arc<AtomicBool>, std::thread::JoinHandle<()>),
pub test_timed_out: bool,
}

Expand Down Expand Up @@ -606,6 +607,6 @@ impl Drop for RemoteRunner {
fn drop(&mut self) {
let _ = self.channel.lock().unwrap().close();
let reader_thread_running = &mut self.reader_thread.0;
*reader_thread_running.lock().unwrap() = false;
reader_thread_running.store(false, Ordering::SeqCst);
}
}
2 changes: 1 addition & 1 deletion zellij-server/src/unit/tab_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use zellij_utils::input::layout::LayoutTemplate;
use zellij_utils::ipc::IpcReceiverWithContext;
use zellij_utils::pane_size::Size;

use std::cell::{RefCell, RefMut};
use std::cell::RefCell;
use std::collections::HashSet;
use std::os::unix::io::RawFd;
use std::rc::Rc;
Expand Down