Skip to content

dd: move tests of slow reader to test_dd.rs#4160

Merged
jfinkels merged 1 commit intouutils:mainfrom
jfinkels:dd-test-lazy-reader
Nov 19, 2022
Merged

dd: move tests of slow reader to test_dd.rs#4160
jfinkels merged 1 commit intouutils:mainfrom
jfinkels:dd-test-lazy-reader

Conversation

@jfinkels
Copy link
Copy Markdown
Collaborator

Move some tests that simulate a slow reader from dd.rs to tests/by-util/test_dd.rs, and employ a FIFO and sleep() to simulate the slow reader instead of a custom struct that implements Read. This change restricts the type of Inputs the Output::dd_out() function can accept, facilitating a future change to make Input an enum.

Inspired by #4134 (comment)

Comment thread tests/by-util/test_dd.rs Outdated
Copy link
Copy Markdown
Collaborator

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

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

This is great! dd has always felt too complicated and I'm excited to see it cleaned up once we can convert Input to an enum :)

@jfinkels jfinkels force-pushed the dd-test-lazy-reader branch from 6cb97a9 to f59c653 Compare November 19, 2022 13:30
Comment thread tests/by-util/test_dd.rs Outdated
@jfinkels jfinkels force-pushed the dd-test-lazy-reader branch from 209d12c to f06d42d Compare November 19, 2022 14:20
Move some tests that simulate a slow reader from `dd.rs` to
`tests/by-util/test_dd.rs`, and employ a FIFO and `sleep()` to
simulate the slow reader instead of a custom struct that implements
`Read`. This change restricts the type of `Input`s the
`Output::dd_out()` function can accept, facilitating a future change
to make `Input` an enum.
@jfinkels jfinkels force-pushed the dd-test-lazy-reader branch from f06d42d to 903ad16 Compare November 19, 2022 14:27
@jfinkels
Copy link
Copy Markdown
Collaborator Author

Sorry, one more update: I updated this branch to remove some test fixtures that are no longer needed. They were stored in src/uu/dd/test-resources/.

Copy link
Copy Markdown
Collaborator

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

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

Cool! Glad those can be removed. Can be merged in my opinion if the CI is green

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/misc/timeout. tests/misc/timeout is passing on 'main'. Maybe you have to rebase?

@jfinkels jfinkels merged commit 881e63a into uutils:main Nov 19, 2022
@jfinkels jfinkels deleted the dd-test-lazy-reader branch November 19, 2022 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants