Page MenuHomeFreeBSD

Add tests for bin/echo
ClosedPublic

Authored by shivansh on Jun 3 2017, 7:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 2:05 AM
Unknown Object (File)
Dec 10 2023, 10:08 PM
Unknown Object (File)
Nov 9 2023, 10:33 PM
Unknown Object (File)
Nov 8 2023, 9:10 AM
Unknown Object (File)
Oct 8 2023, 9:27 PM
Unknown Object (File)
Sep 17 2023, 4:40 AM
Unknown Object (File)
Sep 2 2023, 11:42 AM
Unknown Object (File)
Jul 9 2023, 7:19 PM
Subscribers
None

Details

Summary
  • 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
Test Plan
  • 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

asomers requested changes to this revision.Jun 5 2017, 2:53 PM

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.
This revision now requires changes to proceed.Jun 5 2017, 2:53 PM

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.

shivansh edited edge metadata.

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.

ngie requested changes to this revision.Jun 6 2017, 4:51 AM
ngie added inline comments.
bin/echo/Makefile
7 ↗(On Diff #29245)

Oh wait.. I missed that src.opts.mk hasn't been included here... *sigh* sorry ;/

This revision now requires changes to proceed.Jun 6 2017, 4:51 AM
shivansh edited edge metadata.

Address changes pointed by @ngie

LGTM. But I'll wait a few hours before committing so @ngie has a chance to see it.

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 :)!)

This revision is now accepted and ready to land.Jun 6 2017, 3:00 PM
$ 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!

This revision was automatically updated to reflect the committed changes.