zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 72b7c2b39e261ee0a0990015049ea14c342c7d67
parent 994b86036251bb52003443895715520f37c274ba
Author: Johannes Lorenz <j.git@lorenz-ho.me>
Date:   Fri, 30 Oct 2020 14:20:58 +0100

check-ports.rb: Detect zyn crash

Diffstat:
Msrc/Tests/check-ports.rb | 27++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/Tests/check-ports.rb b/src/Tests/check-ports.rb @@ -2,15 +2,36 @@ require 'open3' +rval=0 + # start zyn, grep the lo server port, and connect the port checker to it Open3.popen3(Dir.pwd + "/../zynaddsubfx -O null --no-gui") do |stdin, stdout, stderr, wait_thr| pid = wait_thr[:pid] while line=stderr.gets do # print "line: " + line; if /^lo server running on (\d+)$/.match(line) then - rval = system(Dir.pwd + "/../../rtosc/port-checker 'osc.udp://localhost:" + $1 + "/'") - Process.kill("KILL", pid) - exit rval + port_checker_rval = system(Dir.pwd + "/../../rtosc/port-checker 'osc.udp://localhost:" + $1 + "/'") + if port_checker_rval != true then + puts "Error: port-checker has returned #{$?.exitstatus}." + rval=1 + end + begin + # Check if zyn has not crashed yet + # Wait 1 second before detection + sleep 1 + Process.kill(0, pid) + # This is only executed if Process.kill did not raise an exception + Process.kill("KILL", pid) + rescue Errno::ESRCH + puts "Error: ZynAddSubFX (PID #{pid}) crashed!" + puts " Missing replies or port-checker crashes could be due to the crash." + rval=1 + rescue + puts "Error: Cannot kill ZynAddSubFX (PID #{pid})?" + rval=1 + end end end end + +exit rval