From 1115e598ddcb7ac7bd0e6990a6deb49674bd62cd Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Tue, 22 Dec 2015 01:21:27 +0000 Subject: [PATCH] Use stable output to a test file instead of depending on the OS name being grep'able in /bin/sh This fixes the situation where the OS has been rebranded to something other than `FreeBSD` MFC after: 1 week Obtained from: Isilon OneFS (^/onefs/head@r511419) Reviewed by: cem, Daniel O'Connor Sponsored by: EMC / Isilon Storage Division --- contrib/netbsd-tests/usr.bin/grep/d_binary.out | 2 +- contrib/netbsd-tests/usr.bin/grep/t_grep.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/contrib/netbsd-tests/usr.bin/grep/d_binary.out b/contrib/netbsd-tests/usr.bin/grep/d_binary.out index ce030561340..f0ef9880d6d 100644 --- a/contrib/netbsd-tests/usr.bin/grep/d_binary.out +++ b/contrib/netbsd-tests/usr.bin/grep/d_binary.out @@ -1 +1 @@ -Binary file /bin/sh matches +Binary file test.file matches diff --git a/contrib/netbsd-tests/usr.bin/grep/t_grep.sh b/contrib/netbsd-tests/usr.bin/grep/t_grep.sh index f2d70f08bde..7e530169141 100755 --- a/contrib/netbsd-tests/usr.bin/grep/t_grep.sh +++ b/contrib/netbsd-tests/usr.bin/grep/t_grep.sh @@ -43,7 +43,20 @@ binary_head() } binary_body() { + # Begin FreeBSD + # + # Generate stable output instead of depending on uname to match the + # branded OS name of /bin/sh + if true; then + dd if=/dev/zero count=1 of=test.file + echo -n "foobar" >> test.file + atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep foobar test.file + else + # End FreeBSD atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep $(uname) /bin/sh + # Begin FreeBSD + fi + # End FreeBSD } atf_test_case recurse