Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
2Shirt 2019-01-08 19:25:39 -07:00
commit a839140ff4
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -588,6 +588,10 @@ class State():
if not skip_disk:
self.disks.append(disk_obj)
# Start tmux thread
self.tmux_layout = TMUX_LAYOUT.copy()
start_thread(fix_tmux_panes_loop, args=[self])
class TestObj():
"""Object to track test data."""
@ -664,9 +668,6 @@ def fix_tmux_panes_loop(state):
try:
fix_tmux_panes(state)
sleep(1)
except AttributeError:
# tmux_layout attribute has been deleted, exit function
return
except RuntimeError:
# Assuming layout definitions changes mid-run, ignoring
pass
@ -676,6 +677,10 @@ def fix_tmux_panes(state):
"""Fix pane sizes if the window has been resized."""
needs_fixed = False
# Bail?
if not state.panes:
return
# Check layout
for k, v in state.tmux_layout.items():
if not v.get('Check'):
@ -1013,7 +1018,6 @@ def run_hw_tests(state):
# Build Panes
update_progress_pane(state)
build_outer_panes(state)
start_tmux_repair_thread(state)
# Show selected tests and create TestObj()s
print_info('Selected Tests:')
@ -1075,13 +1079,13 @@ def run_hw_tests(state):
state.ost.post_device_results(state.cpu, state.ticket_id)
except GenericAbort:
# Cleanup
stop_tmux_repair_thread(state)
tmux_kill_pane(*state.panes.values())
state.panes.clear()
state.tmux_layout.pop('Current', None)
# Rebuild panes
update_progress_pane(state)
build_outer_panes(state)
start_tmux_repair_thread(state)
# Mark unfinished tests as aborted
for k, v in state.tests.items():
@ -1138,6 +1142,7 @@ def run_hw_tests(state):
state.ost.disconnect(full=True)
stop_tmux_repair_thread(state)
tmux_kill_pane(*state.panes.values())
state.panes.clear()
def run_io_benchmark(state, test):
@ -1681,19 +1686,6 @@ def show_results(state):
update_progress_pane(state)
def start_tmux_repair_thread(state):
"""Fix tmux panes as long as state.tmux_layout attribute exists."""
state.tmux_layout = TMUX_LAYOUT.copy()
start_thread(fix_tmux_panes_loop, args=[state])
def stop_tmux_repair_thread(state):
"""Stop previous thread by causing an AttributeError in the thread."""
if hasattr(state, 'tmux_layout'):
del state.tmux_layout
sleep(1)
def update_main_options(state, selection, main_options):
"""Update menu and state based on selection."""
index = int(selection) - 1