]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: ceph-disk.sh: use "readlink -f" instead for fullpath 7606/head
authorKefu Chai <kchai@redhat.com>
Thu, 11 Feb 2016 12:08:32 +0000 (20:08 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 11 Feb 2016 12:08:35 +0000 (20:08 +0800)
if $PATH has ".." in it, and the program happen to be located in
"..", `which program` will print `../program` instead of its fullpath,
so we should always use `readlink -f` for the fullpath.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/ceph-disk/tests/ceph-disk.sh

index b2b4faaa8bd34fe7a116d07504bc8d1ec60823e5..9456ee364f3006bed07b9c743018f70775abbf64 100644 (file)
@@ -132,8 +132,8 @@ function kill_daemons() {
 
 function command_fixture() {
     local command=$1
-
-    [ $(which $command) = `readlink -f ../$command` ] || [ $(which $command) = `readlink -f $(pwd)/$command` ] || return 1
+    local fpath=`readlink -f $(which $command)`
+    [ "$fpath" = `readlink -f ../$command` ] || [ "$fpath" = `readlink -f $(pwd)/$command` ] || return 1
 
     cat > $DIR/$command <<EOF
 #!/bin/bash