Skip to content

Commit

Permalink
Merge pull request watplugin#336 from RailKill/fix-debugger-breakpoint
Browse files Browse the repository at this point in the history
Fix watplugin#332 by having 10 minute timeout and kicking client on GUI debug
  • Loading branch information
AlexDarigan authored Apr 10, 2022
2 parents e7c4924 + 4a7bd47 commit 3559a0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 9 additions & 1 deletion addons/WAT/network/test_server.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ func _ready() -> void:

func _on_network_peer_connected(id: int) -> void:
_peer_id = id
_peer.set_peer_timeout(id, 1000, 2000, 3000)
# Timeout is 10 minutes.
_peer.set_peer_timeout(id, 600000, 601000, 602000)
emit_signal("network_peer_connected")

func _on_network_peer_disconnected(_id: int) -> void:
Expand All @@ -31,6 +32,13 @@ func _on_network_peer_disconnected(_id: int) -> void:
caselist.clear()
status = STATE.DISCONNECTED

func kick_current_peer():
var kicked = false
if _peer_id in custom_multiplayer.get_network_connected_peers():
_on_results_received_from_client([])
kicked = true
return kicked

func send_tests(testdir: Array, repeat: int, thread_count: int) -> void:
status = STATE.SENDING
rpc_id(_peer_id, "_on_tests_received_from_server", testdir, repeat, thread_count)
Expand Down
8 changes: 3 additions & 5 deletions addons/WAT/ui/gui.gd
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func setup_editor_context(plugin, build: FuncRef, goto_func: FuncRef, filesystem
TestMenu.update_menus()
Server.results_view = Results


# Setup tests for display. Returns false if run should be terminated.
func _setup_display(tests: Array) -> bool:
if tests.empty():
Expand All @@ -68,7 +67,6 @@ func _setup_display(tests: Array) -> bool:
Results.display(tests, Repeats.value)
return true


func _on_run_pressed(data = _filesystem.root) -> void:
Results.clear()
var current_build = true
Expand Down Expand Up @@ -104,6 +102,8 @@ func _on_debug_pressed(data = _filesystem.root) -> void:
TestMenu.update_menus()

if current_build:
if Server.kick_current_peer():
_plugin.get_editor_interface().stop_playing_scene()
var tests: Array = data.get_tests()
if _setup_display(tests):
_plugin.get_editor_interface().play_custom_scene(
Expand All @@ -113,12 +113,10 @@ func _on_debug_pressed(data = _filesystem.root) -> void:
yield(Server, "network_peer_connected")
Server.send_tests(tests, Repeats.value, Threads.value)
var results: Array = yield(Server, "results_received")
_plugin.get_editor_interface().stop_playing_scene() # Check if this works exported
_plugin.get_editor_interface().stop_playing_scene()
_on_test_run_finished(results)


func _on_test_run_finished(results: Array) -> void:
_plugin.get_editor_interface().stop_playing_scene() # Check if this works exported
Summary.summarize(results)
JUnitXML.write(results, Settings, Summary.time_taken)
_filesystem.failed.update(results)
Expand Down

0 comments on commit 3559a0a

Please sign in to comment.