Skip to content

Commit

Permalink
Remove \e hack originally added for FreeBSD
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jmmv committed Oct 3, 2014
1 parent 59df53d commit 2e5df96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down
22 changes: 2 additions & 20 deletions atf-sh/atf-check_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 2e5df96

Please sign in to comment.