The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=65cda8a11df4718d963ef0624eb2f6e0f5201a8c
commit 65cda8a11df4718d963ef0624eb2f6e0f5201a8c Author: K Rin <r...@sandb0x.tw> AuthorDate: 2025-04-20 09:59:34 +0000 Commit: Warner Losh <i...@freebsd.org> CommitDate: 2025-06-13 14:25:54 +0000 bin/cat: add test for reading data from stdin Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1671 Closes: https://github.com/freebsd/freebsd-src/pull/1671 --- bin/cat/tests/Makefile | 1 + contrib/netbsd-tests/bin/cat/stdin_test.out | 1 + contrib/netbsd-tests/bin/cat/t_cat.sh | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/bin/cat/tests/Makefile b/bin/cat/tests/Makefile index 2f48c7d4e0cf..347f4826ba4d 100644 --- a/bin/cat/tests/Makefile +++ b/bin/cat/tests/Makefile @@ -12,6 +12,7 @@ ${PACKAGE}FILES+= d_s_output.in ${PACKAGE}FILES+= d_s_output.out ${PACKAGE}FILES+= d_vt_output.in ${PACKAGE}FILES+= d_vt_output.out +${PACKAGE}FILES+= stdin_test.out .include <netbsd-tests.test.mk> diff --git a/contrib/netbsd-tests/bin/cat/stdin_test.out b/contrib/netbsd-tests/bin/cat/stdin_test.out new file mode 100644 index 000000000000..7caf37d4c05d --- /dev/null +++ b/contrib/netbsd-tests/bin/cat/stdin_test.out @@ -0,0 +1 @@ +This is nothing but a cat test. diff --git a/contrib/netbsd-tests/bin/cat/t_cat.sh b/contrib/netbsd-tests/bin/cat/t_cat.sh index 10706372f87d..4e88276b371f 100755 --- a/contrib/netbsd-tests/bin/cat/t_cat.sh +++ b/contrib/netbsd-tests/bin/cat/t_cat.sh @@ -112,6 +112,20 @@ vt_output_body() { } # End FreeBSD +# Begin FreeBSD +atf_test_case stdin_test +stdin_test_head() { + atf_set "descr" "Test that cat(1) receives data from stdin " \ + "and outputs." +} + +stdin_test_body() { + echo "This is nothing but a cat test." | \ + atf_check -s ignore -o file:$(atf_get_srcdir)/stdin_test.out \ + cat +} +# End FreeBSD + atf_init_test_cases() { atf_add_test_case align @@ -124,5 +138,6 @@ atf_init_test_cases() atf_add_test_case s_output atf_add_test_case e_output atf_add_test_case vt_output + atf_add_test_case stdin_test # End FreeBSD }