Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix error running tests on Linux kernel 5.13 or newer
As of torvalds/linux@1b8b208,
unsupported ioctls now return ENOTTY instead of EINVAL. This change was
also backported to the 5.10 stable branch, so it's a problem on the
current release of many Linux distros now.
  • Loading branch information
ssgelm committed Jan 13, 2022
commit dfeab5401c270c791f5364e522564563632c5879
3 changes: 2 additions & 1 deletion termios/termios_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package termios
Expand Down Expand Up @@ -152,7 +153,7 @@ func checktty(t *testing.T, err error) {
t.Helper()
// some ioctls fail against char devices if they do not
// support a particular feature
if (runtime.GOOS == "darwin" && err == unix.ENOTTY) || (runtime.GOOS == "linux" && err == unix.EINVAL) {
if ((runtime.GOOS == "darwin" || runtime.GOOS == "linux") && err == unix.ENOTTY) || (runtime.GOOS == "linux" && err == unix.EINVAL) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to put the (err == unix.EINVAL || err == unix.ENOTTY) together? Or maybe this is getting complex enough, we want to split it up in a switch?

🤷‍♀️ I mean, the code should work fine either way…

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly either way. Happy to change it however you'd like, just let me know.

t.Skip(err)
}
}