Skip to content

Commit

Permalink
testsuite: test that NUL can be sent over pty
Browse files Browse the repository at this point in the history
Problem: There's no test that ensures NUL can be transmitted over
a pty allocated for a job.

Add a test to t2612-job-shell-pty.t that sends a NUL as input to a
job with a pty and ensures it is received by the job task.
  • Loading branch information
grondo committed Mar 26, 2024
1 parent 03fd390 commit a0bd298
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions t/t2612-job-shell-pty.t
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,14 @@ test_expect_success 'pty: no hang when invalid command is run under pty' '
test_expect_code 127 run_timeout 15 \
flux run -o pty.interactive nosuchcommand
'
# Note: test below uses printf(1) to send [Ctrl-SPACE (NUL), newline, Ctrl-D]
# over the pty connection and expects ^@ to appear in output.
nul_ctrl_d() {
python3 -c 'print("\x00\n\x04", end=None)'
}
test_expect_success 'pty: NUL (Ctrl-SPACE) character not dropped' '
nul_ctrl_d | flux run -vvv -o pty.interactive -o pty.capture cat -v &&
flux job eventlog -HLp output $(flux job last) &&
flux job eventlog -HLp output $(flux job last) | grep \\^@
'
test_done

0 comments on commit a0bd298

Please sign in to comment.