From 448dd18685afaba821d5e4e8c200307f7ae68825 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 2 Apr 2022 13:23:51 -0700 Subject: [PATCH] Use head instead of dd in the read test The read test is now failing on GitHub actions even though it passes on my Mac. It may be due to differences in dd between these two environments. Stop using dd and just use head. --- tests/checks/read.fish | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/checks/read.fish b/tests/checks/read.fish index bf45320e3..709ee977b 100644 --- a/tests/checks/read.fish +++ b/tests/checks/read.fish @@ -192,7 +192,7 @@ set line abcdefghijklmnopqrstuvwxyz # Ensure the `read` command terminates if asked to read too much data. The var # should be empty. We throw away any data we read if it exceeds the limit on # what we consider reasonable. -yes $line | dd iflag=fullblock bs=1024 count=(math "1 + $fish_read_limit / 1024") 2>/dev/null | read --null x +yes $line | head -c (math "1 + $fish_read_limit") | read --null x if test $status -ne 122 echo reading too much data did not terminate with failure status end @@ -239,14 +239,12 @@ end # Same as previous test but limit the amount of data fed to `read` rather than # using the `--nchars` flag. -yes $line | dd iflag=fullblock bs=1024 count=(math "$fish_read_limit / 1024") 2>/dev/null | read --null x +yes $line | head -c $fish_read_limit | read --null x if test $status -ne 0 echo the read of the max amount of data failed unexpectedly end if test (string length "$x") -ne $fish_read_limit - # See how much data 'yes' produced. - set yeslen (yes $line | dd iflag=fullblock bs=1024 count=(math "$fish_read_limit / 1024") 2>/dev/null | wc -c | tr -d " \t\n\r") - echo reading the max amount of data with --nchars failed the length test. read: (string length "$x"), limit: $fish_read_limit, yes produced: $yeslen + echo reading with a limited amount of input data failed the length test end # Confirm reading non-interactively works -- \#4206 regression