test: replace the shell with the emit fixture at 72 of 99 sites - #276
Conversation
`fixtures/emit` writes exactly the bytes its arguments describe — one argument per step, `--esc`/`--csi`/`--raw` for the sequences, `--wait` to hold the terminal open, `--sleep`, `--exit` — and nothing else: std only, no timing but the explicit sleep, so it cannot become a second thing the suite tests. `tests/common::spawn_emit` runs it from any builder. tabs.rs is the first file through it: eleven scripts that were `printf '\033[4G\033H…'; read _` read as the sequences they send. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Seven scripts, one --raw per former printf so a reviewer diffs the escape sequences directly: \033 becomes \e and nothing else changes. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Twelve scripts of designations and locking shifts, one --raw per line the test draws: \016/\017 read as \x0e/\x0f, \0337/\0338 as \e7/\e8. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
The bytes that are not UTF-8 go through --raw as \xe9 and a split \xe6 … \xb1\x89, with --sleep where the script slept. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Nine programs walking the out-of-band state: one --raw per former printf, --wait for each pause the test releases with Enter. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Sixteen sites. A burst that must arrive as one read is one --raw, and the three-frame burst two tests share is a named constant. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
--pid stands in for the shell's $$. --loop used to repeat every step, which reprints the text before the loop each time round; the bell loop in stable.rs needs the text once and the bell forever. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Seven of eight. The SIGTERM trap stays on /bin/sh with a comment: the signal handler is what that test is about, and std has none. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
The bare-name test now uses the fixture as the bare name, with its own directory as the PATH remedy — the same refusal, on every platform, and no /usr/bin:/bin baked into it. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Eight programs; the blocked kitty query no longer needs stty, since the fixture reads nothing the harness might echo. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
The bell loop is `--loop --raw '\a'`, one write per iteration and no process spawned per iteration; the flood is --seq. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
What `echo "$NAME"` and `/usr/bin/env` did for the environment tests: one variable, or all of them sorted, with no shell to add PWD and friends of its own. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Ten of eleven. The self-kill stays on /bin/sh with a comment — a process signalling itself is what that test is about. The round-trip test now waits for a suffix the line discipline's echo cannot produce, so it proves the read rather than the echo. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
The numbered lines are built in the test and handed over as one argument; the shell loop was the only reason they were ever a loop. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Every program in both files puts the terminal in raw mode with stty to read replies byte for byte, which the std-only fixture cannot do. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Five sites. The seven that read the wire under stty -icanon -echo stay on /bin/sh, with the reason in the file header. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Eight sites whose point is that no answer comes: --wait blocks on a line exactly as head did in canonical mode. The fourteen that read a reply stay on /bin/sh, with the reason in the file header. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
common/mod.rs is compiled into every test binary that declares it, and readme_example uses neither helper. Refs #249 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
|
|
Closes #249. Step 1 of #149.
What this is
fixtures/emit— a std-only program that writes exactly the bytes its arguments describe, then waits, sleeps or exits as told. One argument per step; the steps are the crate doc offixtures/emit/src/main.rs:tests/common::spawn_emit(builder, steps)runs it from any builder. Then the migration, one test file per commit so each diff is one file's scripts against theiremitform: tabs, styles, charset, utf8, state, frames, process, builder_validation, observe, timeouts, stable, basic, concurrency, scrollback, input, queries, fixtures. Where a test used to be oneprintf, it is one--raw, with\033read as\e— a reviewer diffs the escape sequences directly.The count
grep -c 'spawn("/bin/sh")\|spawn("sh")' crates/termlens/tests/*.rs: 99 → 27, and every one of the 27 has a comment or file header saying why it is a shell:queries.rsstty -icanon -echoinput.rssttydrain.rsbackpressure.rsddan exact byte count of replies understtybasic.rskill -TERM $$— a process signalling itselfprocess.rstrap … TERM— a signal handlerThe 25 raw-mode sites share one blocker: reading what termlens typed back needs
-icanon -echo, and std has notcsetattr. That is the fixture's stated rule (std only, no timing but--sleep) doing exactly what it was written to do — the shell is the honest tool for a test that is about the line discipline. If those 25 should go too, the step is--raw-modeon the fixture vialibc(onetcsetattr) or crossterm, and that is a decision about the rule, not about the migration. Flagging rather than deciding.Two tests changed shape on purpose
basic.rssend_str_and_enter_round_trip…waited forgot: hello, which the line discipline's echo of the typedhellocould satisfy on its own. It now waits forhello back— the fixture's read plus a suffix the echo cannot produce.builder_validation.rsa_bare_program_name_under_env_clear…usedshas the bare name and/usr/bin:/binas the PATH remedy. It now uses the fixture as the bare name and the fixture's own directory as the remedy: the same refusal, no Unix path baked in.Everything else asserts what it asserted before.
Verified
Every gate in CONTRIBUTING §1 locally, including the cross-target clippy; full suite three feature configurations. The
windowsandstressworkflows are dispatched against this branch — results in a comment below, since #249's done-when names the stress workflow and #149's step 4 is what the Windows count is for.