Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Zptyfy W01history.ztst



On Sun, Nov 15, 2026 at 3:36 AM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>>
>> The zpty tests have a number of disadvantages like zpty not building on
>> obscure platforms. This change forces you to run the tests under zpty.
>> For the completion and zle tests we really need to capture the terminal
>> output so have no choice but this isn't the case for the history tests.
>> Being able to run tests without zpty can be easier when debugging a
>> problem.
>
>
> I agree, having to use zpty is far from ideal. In addition to what you mention, it's also much slower.
>
>>
>> For the history tests, I think it makes more sense to run zpty a layer
>> above in the test driver script. I've attached a patch to do this. This
>> is only being used where $OSTYPE is linux-gnu because Linux doesn't
>> support stty flusho for silencing that output. I was more concerned with
>> the extra noise from those history tests.
>
>
> I didn't know `stty flusho`. I didn't even know `stty` but this looks like a much better option for this case.
>
> From the last line in the first diff of your patch, I inferred that you added a `stty flusho < $TTY` at the start of each test case and a `stty -flusho < $TTY` at their end. I would rather do that in the test runner for tests that require to mute the tty. Instead of hardcoding a list of tests that require this, I would rather encode it in their file name, for example with an `@mutetty` suffix. For Linux, where this trick unfortunately doesn't work, I think that we could use `script` rather than relying on `zpty`. Gemini tells me that it's standard on pretty much all Linux boxes.
>
> See the attached script, which for now is still experimental mainly because I haven't tested at all the Linux code path. Note that it's built on top of these two other patches:
>
> - Use test script specific run directories - workers/55185
> - Add support for running test scripts in parallel - workers/55186
>
>> Do we perhaps need to also
>> use zpty where tests are being run in parallel even for other platforms?
>
>
> I guess there might be other platforms where the `stty` trick doesn't work. We can add workarounds for them as we discover them. If they don't have `script` or an equivalent, we can use `zpty` as a last resort.
>
>> > +    skip s:$'\e]11;?\e\\' &&   # OSC 11: Query terminal's background color
>> > +    skip s:$'\e]10;?\e\\' &&   # OSC 10: Query terminal's foreground color
>> > +    skip s:$'\e]12;?\e\\' &&   # OSC 12: Query terminal's cursor color
>>
>> If we do end up with a variant of this patch then rather than skip
>> these escapes, disabling them all is cleaner and likely more robust.
>> That's with .term.extensions. It also looks like you're skipping the
>> partial line marker from the PROMPT_SP option - again easier to unset
>> the option. For anything that comes from termcap, actual termcap
>> entries may vary. zle -T can cover ZLE but not all termcap output comes
>> from ZLE.
>
>
> I didn't know that you could disable some of that stuff. That looks indeed much more robust. I will keep the infrastructure I built in the patch and your comments but it looks like we won't need them for W01history.ztst.
>
>> (As an aside, why is there a $ZTST_failcolour but nothing for the
>> success and warning colours)
>
>
> In Add support for running test scripts in parallel (workers/55186), I added (and documented in README) $ZTST_warncolour and $ZTST_passcolour.

Wouldn't messing directly with the parent stty settings mess up stuff
badly if we do end up running tests in parallel at some point?

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author