From 2e5df9634ce7f59855a85dc5dc1025cb734595d8 Mon Sep 17 00:00:00 2001 From: Julio Merino Date: Fri, 3 Oct 2014 16:15:35 -0400 Subject: [PATCH] Remove \e hack originally added for FreeBSD Replace the use of \e in printf(1) calls with \033. This lets us remove a long-standing hack added to deal with the lack of \e in FreeBSD, which now causes test failures in rebranded versions of Darwin, FreeBSD and Linux. Fixes #16. --- NEWS | 3 +++ atf-sh/atf-check_test.sh | 22 ++-------------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index da0cd812..83b94259 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,9 @@ STILL UNDER DEVELOPMENT; NOT RELEASED YET. * Issue #15: Fix atf_utils_{fork,wait} to support nested calls. +* Issue #16: Fixed test failures (by removing a long-standing hack) on + systems that lack \e support in printf(1). + * Issue #19: Removed stale references to atf-config and atf-run. diff --git a/atf-sh/atf-check_test.sh b/atf-sh/atf-check_test.sh index 7319a2b8..d66d12e4 100644 --- a/atf-sh/atf-check_test.sh +++ b/atf-sh/atf-check_test.sh @@ -211,16 +211,7 @@ oflag_inline_body() h_pass "echo foo bar" -o inline:"foo bar\n" h_pass "printf 'foo bar'" -o inline:"foo bar" h_pass "printf '\t\n\t\n'" -o inline:"\t\n\t\n" - # XXX Ugly hack to workaround the lack of \e in FreeBSD. Also, \e doesn't - # seem to work as expected in Linux. Look for a nicer solution. - case $(uname) in - Darwin|FreeBSD|Linux) - h_pass "printf '\a\b\f\n\r\t\v'" -o inline:"\a\b\f\n\r\t\v" - ;; - *) - h_pass "printf '\a\b\e\f\n\r\t\v'" -o inline:"\a\b\e\f\n\r\t\v" - ;; - esac + h_pass "printf '\a\b\033\f\n\r\t\v'" -o inline:"\a\b\e\f\n\r\t\v" h_pass "printf '\011\022\033\012'" -o inline:"\011\022\033\012" h_fail "echo foo bar" -o inline:"foo bar" @@ -331,16 +322,7 @@ eflag_inline_body() h_pass "echo foo bar 1>&2" -e inline:"foo bar\n" h_pass "printf 'foo bar' 1>&2" -e inline:"foo bar" h_pass "printf '\t\n\t\n' 1>&2" -e inline:"\t\n\t\n" - # XXX Ugly hack to workaround the lack of \e in FreeBSD. Also, \e doesn't - # seem to work as expected in Linux. Look for a nicer solution. - case $(uname) in - Darwin|FreeBSD|Linux) - h_pass "printf '\a\b\f\n\r\t\v' 1>&2" -e inline:"\a\b\f\n\r\t\v" - ;; - *) - h_pass "printf '\a\b\e\f\n\r\t\v' 1>&2" -e inline:"\a\b\e\f\n\r\t\v" - ;; - esac + h_pass "printf '\a\b\033\f\n\r\t\v' 1>&2" -e inline:"\a\b\e\f\n\r\t\v" h_pass "printf '\011\022\033\012' 1>&2" -e inline:"\011\022\033\012" h_fail "echo foo bar 1>&2" -e inline:"foo bar"