Skip to content

Commit

Permalink
Only CTRL-C in sigint orbit tests when the long C integration has sta…
Browse files Browse the repository at this point in the history
…rted
  • Loading branch information
jobovy committed Mar 17, 2020
1 parent 1305a0a commit c97a40e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
4 changes: 4 additions & 0 deletions tests/orbitint4sigint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
o= Orbit([1.,0.1,1.1,0.1,0.1,0.])
elif sys.argv[2] == 'planar':
o= Orbit([1.,0.1,1.1,0.1])
print("Starting long C integration ...")
sys.stdout.flush()
o.integrate(ts,mp,method=sys.argv[1])
elif sys.argv[2] == 'planardxdv':
o= Orbit([1.,0.1,1.1,0.1])
print("Starting long C integration ...")
sys.stdout.flush()
o.integrate_dxdv([0.1,0.1,0.1,0.1],ts,mp,method=sys.argv[1])
sys.exit(0)
21 changes: 15 additions & 6 deletions tests/test_orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3900,9 +3900,12 @@ def test_orbit_c_sigint_full():
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
time.sleep(8)
for line in iter(p.stdout.readline, b''):
if line.startswith(b"Starting long C integration ..."):
break
time.sleep(1)
os.kill(p.pid,signal.SIGINT)
time.sleep(4)
time.sleep(1)
cnt= 0
while p.poll() is None and cnt < ntries: # wait a little longer
time.sleep(4)
Expand Down Expand Up @@ -3935,9 +3938,12 @@ def test_orbit_c_sigint_planar():
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
time.sleep(8)
for line in iter(p.stdout.readline, b''):
if line.startswith(b"Starting long C integration ..."):
break
time.sleep(1)
os.kill(p.pid,signal.SIGINT)
time.sleep(4)
time.sleep(1)
cnt= 0
while p.poll() is None and cnt < ntries: # wait a little longer
time.sleep(4)
Expand Down Expand Up @@ -3966,9 +3972,12 @@ def test_orbit_c_sigint_planardxdv():
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
time.sleep(8)
for line in iter(p.stdout.readline, b''):
if line.startswith(b"Starting long C integration ..."):
break
time.sleep(1)
os.kill(p.pid,signal.SIGINT)
time.sleep(4)
time.sleep(1)
cnt= 0
while p.poll() is None and cnt < ntries: # wait a little longer
time.sleep(4)
Expand Down

0 comments on commit c97a40e

Please sign in to comment.