- Verify that echo(1) does not print the trailing newline character with option '-n'
- Verify that echo(1) does not print the trailing newline character when '\c' is appended to the end of the string
Details
- Reviewers
asomers brooks ngie - Commits
- rS319626: Add basic tests for echo(1)
- Run make install from bin/echo/tests.
- Run kyua test from /usr/tests/bin/echo. All 2 test cases should succeed.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Two things:
- You must update bin/echo/Makefile to hook up these tests to the build. See bin/sh/Makefile for an example.
- Please call echo by its full path /bin/echo. Otherwise, you're testing sh's builtin command of the same name.
You're missing the integration piece in
- etc/mtree/BSD.tests.dist (this creates the path in ${TESTSBASE}).
- bin/echo (this hooks the test into the build, proper).
Please see: https://wiki.freebsd.org/TestSuite/DeveloperHowTo#Adding_a_new_test_program (I'll need to review/update the wiki page -- it could be a bit more terse).
bin/echo/tests/Makefile | ||
---|---|---|
7 ↗ | (On Diff #29181) | With the size of the test file, I think it's better to just add it inline in the test, and drop the *FILES/PACKAGE lines. |
bin/echo/tests/echo_test.sh | ||
26 ↗ | (On Diff #29181) | Please omit the : -- SVN will expand $FreeBSD$ for us (which includes it adding a colon). |
31 ↗ | (On Diff #29181) | (Picking an arbitrary line) Please indent all new lines with hard tabs. |
36–37 ↗ | (On Diff #29181) | Something seems really off if the file given above matches this output. |
Address changes -
- Update src/etc/mtree/BSD.tests.dist to register the new subdirectory
- Update bin/echo/Makefile to hook up these tests to the build
- Update echo invocation with /bin/echo
- Move d_non_trailing.out inline to echo_test.sh
- Indent all new lines with hard tabs
LGTM, sans the cosmetic nit in the Makefile I pointed out
bin/echo/tests/Makefile | ||
---|---|---|
3 ↗ | (On Diff #29245) | Please remove this line. |
bin/echo/Makefile | ||
---|---|---|
7 ↗ | (On Diff #29245) | Oh wait.. I missed that src.opts.mk hasn't been included here... *sigh* sorry ;/ |
This is a great start -- I'll commit it to head after I run the tests (I'll provide the output to show you what I do when verifying things work :)!)
$ arc patch D11036 ... $ sudo make -s hier # Create /usr/tests/bin/echo boot/kernel: type (dir, link) $ (export MAKEFLAGS=-s; cd bin/echo/; make obj; make; sudo make install; make -C tests check) ===> tests (obj) ===> tests (all) install -s -o root -g wheel -m 555 echo /bin/echo install -o root -g wheel -m 444 echo.debug /usr/lib/debug/bin/echo.debug install -o root -g wheel -m 444 echo.1.gz /usr/share/man/man1/ ===> tests (install) install -o root -g wheel -m 555 echo_test /usr/tests/bin/echo/echo_test install -o root -g wheel -m 444 Kyuafile /usr/tests/bin/echo/Kyuafile echo_test:append_c_output -> passed [0.014s] echo_test:n_output -> passed [0.012s] Results file id is usr_tests_bin_echo.20170606-155945-399233 Results saved to /home/ngie/.kyua/store/results.usr_tests_bin_echo.20170606-155945-399233.db 2/2 passed (0 failed)
LGTM!