Skip to content

chore(cli): update test output string for uutils cat#831

Merged
benhoyt merged 3 commits intocanonical:masterfrom
holmanb:holmanb/uutils-fix
Mar 30, 2026
Merged

chore(cli): update test output string for uutils cat#831
benhoyt merged 3 commits intocanonical:masterfrom
holmanb:holmanb/uutils-fix

Conversation

@holmanb
Copy link
Copy Markdown
Member

@holmanb holmanb commented Mar 30, 2026

When a file is not found the cat implementation in uutils
prints more output than the coreutils implementation.
Make pebble tests pass with uutils on Ubuntu 25.10.

Example output:

coreutils $ cat msg2
cat: msg2: No such file or directory

uutils $ cat msg2
cat: msg2: No such file or directory (os error 2)

@holmanb
Copy link
Copy Markdown
Member Author

holmanb commented Mar 30, 2026

Seen on Ubuntu 25.10 from the tip of master:

----------------------------------------------------------------------
FAIL: cmd_enter_test.go:174: PebbleSuite.TestEnterExecReadServiceOutputFile

cmd_enter_test.go:192:
    c.Check(s.Stdout(), Equals, "foo\ncat: msg2: No such file or directory\n")
... obtained string = "" +
...     "foo\n" +
...     "cat: msg2: No such file or directory (os error 2)\n"
... expected string = "" +
...     "foo\n" +
...     "cat: msg2: No such file or directory\n"
... String difference:
...     [1]: "cat: msg2: No such file or directory (os error 2)" != "cat: msg2: No such file or directory"

Alternatively, we could switch the regex to replace the last characters of the current string \n with .*. Let me know.

@benhoyt
Copy link
Copy Markdown
Contributor

benhoyt commented Mar 30, 2026

Yeah, I would much rather we make the test more permissive (because we don't care so much about the exact message). So let's us .*.

@holmanb holmanb marked this pull request as ready for review March 30, 2026 22:17
@holmanb
Copy link
Copy Markdown
Member Author

holmanb commented Mar 30, 2026

Yeah, I would much rather we make the test more permissive (because we don't care so much about the exact message). So let's us .*.

Thanks for the feedback. Agreed.

@benhoyt
Copy link
Copy Markdown
Contributor

benhoyt commented Mar 30, 2026

Thanks. Can you please add a PR description explaining the why/context of this change? And then I'll merge.

@holmanb
Copy link
Copy Markdown
Member Author

holmanb commented Mar 30, 2026

Welcome. The relevant context is now included.

@benhoyt benhoyt merged commit 7ac34b0 into canonical:master Mar 30, 2026
22 checks passed
@holmanb holmanb deleted the holmanb/uutils-fix branch March 30, 2026 22:37
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.

2 participants