File: basic.py

package info (click to toggle)
reptyr 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 328 kB
  • sloc: ansic: 2,576; python: 76; makefile: 62; sh: 46
file content (31 lines) | stat: -rw-r--r-- 666 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import pexpect
import sys

from util import expect_eof

if os.getenv("NO_TEST_BASIC") is not None:
    print("Skipping basic tests because $NO_TEST_BASIC is set.")
    sys.exit(0)

logfile = sys.stdout
if sys.version_info[0] >= 3:
    logfile = logfile.buffer

child = pexpect.spawn("test/victim")
child.logfile = logfile
child.setecho(False)
child.sendline("hello")
child.expect("ECHO: hello")

reptyr = pexpect.spawn("./reptyr -V %d" % (child.pid,))
reptyr.logfile = logfile
reptyr.sendline("world")
reptyr.expect("ECHO: world")

child.sendline("final")
expect_eof(child.child_fd)

reptyr.sendeof()
reptyr.expect(pexpect.EOF)
assert not reptyr.isalive()