On 02/11/2025 00:55, Collin Funk wrote:
Collin Funk <[email protected]> writes:

My value for options doesn't have ispeed or ospeed because that test is
only meant for bolean options. One of the proceeding commands shows the
difference in our 'stty' output:

     # My output.
     + stty -drain
     ispeed 9600 baud; ospeed 38400 baud; line = 0;
     erase = -;
     -brkint -imaxbel iutf8

     # Your output.
     + stty -drain
     ispeed 9600 baud; ospeed 38400 baud; line = 0;
     erase = -;
     -brkint -imaxbel iutf8

But I am not too sure why that is the case.

This looks to be the same cause as for tests/stty/stty-pairs.sh.

I guess this patch should fix your tests at least, but I'm not sure why
they just now started failing for you.

diff --git a/tests/stty/stty-pairs.sh b/tests/stty/stty-pairs.sh
index aebbd7fe7..a7f0d555b 100755
--- a/tests/stty/stty-pairs.sh
+++ b/tests/stty/stty-pairs.sh
@@ -38,7 +38,9 @@ stty $(cat $saved_state) || fail=1
  # Don't depend on terminal width.  Put each option on its own line,
  # remove all non-boolean ones, remove 'parenb' and 'cread' explicitly,
  # then remove any leading hyphens.
-sed_del='/^speed/d;/^rows/d;/^columns/d;/ = /d;s/parenb//;s/cread//'
+sed_del1='/^ispeed/d;/^ospeed/d;/^speed/d;'
+sed_del2='/^rows/d;/^columns/d;/ = /d;s/parenb//;s/cread//'
+sed_del="$sed_del1$sed_del2"
  options=$(stty -a | tr -s ';' '\n' | sed "s/^ //;$sed_del;s/-//g")
# Take them in pairs, with and without the leading '-'.
diff --git a/tests/stty/stty.sh b/tests/stty/stty.sh
index c0f74947a..facd2e6b2 100755
--- a/tests/stty/stty.sh
+++ b/tests/stty/stty.sh
@@ -51,7 +51,9 @@ returns_ 1 stty -raw -a 2>/dev/null || fail=1
  # Build a list of all boolean options stty accepts on this system.
  # Don't depend on terminal width.  Put each option on its own line,
  # remove all non-boolean ones, then remove any leading hyphens.
-sed_del='/^speed/d;/^rows/d;/^columns/d;/ = /d'
+sed_del1='/^ispeed/d;/^ospeed/d;/^speed/d;'
+sed_del2='/^rows/d;/^columns/d;/ = /d;s/parenb//;s/cread//'
+sed_del="$sed_del1$sed_del2"
  options=$(stty -a | tr -s ';' '\n' | sed "s/^ //;$sed_del;s/-//g")
# Take them one at a time, with and without the leading '-'.

One could probably do that more concisely with:

  sed_del='/^[io]*speed/d;/^rows/d;/^columns/d;/ = /d'

Note I used the less accurate * rather than the more accurate \? for 
portability reasons

I guess the reason for the test failure is the newer kernel
supporting disparate speeds on input and output,
causing the separated [io]speed to be displayed.
Note our tests run `stty 9600` so perhaps once the tests are run once,
you get the disparity on subsequent runs.

cheers,
Padraig

Reply via email to