From 5f592878eed79dd28f9f93418f9456185fd21ac9 Mon Sep 17 00:00:00 2001 From: Jarkko Kniivilä Date: Mon, 7 Sep 2015 23:43:02 +0300 Subject: Do not depend on readlink(1) or -q Solaris 10 lacks readlink(1). Additionally, its different grep(1) and diff(1) do not take a `-q` flag. Use a Perl one-liner instead of readlink(1) which is missing on Solaris 10. Also because /usr/bin/grep and diff(1) don't understand the `-q` option, make them go quiet by redirecting stdout to `/dev/null` instead. The Perl dependency only exists in the test suite, so it does not incur a runtime penalty for end users. This is to work around the fact that readlink(1) is missing on Solaris. The tradeoff is: on Solaris, installing third-party software (readlink) is a pain, whereas on e.g. FreeBSD installing third-party software (Perl) is simple and common. --- test/helper.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/helper.sh b/test/helper.sh index d26749c..5016cf8 100644 --- a/test/helper.sh +++ b/test/helper.sh @@ -35,21 +35,8 @@ refute() { resolved_path() { local original_path="$1" - local actual_path="$original_path" - local actual_basename="$(basename "$original_path")" - - cd "$(dirname "$original_path")" - - while [ -L "$actual_basename" ]; do - actual_path="$(readlink "$actual_basename")" - actual_basename="$(basename "$actual_path")" - - cd "$(dirname "$actual_path")" - done - - local current_directory="$(pwd -P)" - - printf "%s/%s\n" "$current_directory" "$actual_basename" + perl -e \ + "use Cwd realpath; print realpath(\"$original_path\") . \"\\n\";" } assert_linked() { -- cgit v1.2.3