In case of that there is not available cmp with '-n', dd and diff
compoistion could be useful to compare two file.
diff <(dd bs=1 count=$bufsize if=$1 &>/dev/null) <(dd bs=1
count=$bufsize if=$2 &>/dev/null)
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
# Try cmp.
output=0
command -v cmp
- if (( $? == 0 ))
+ # If cmp is symlink, then it could be from busybox and it does not support "-n" option
+ if [[ $? == 0 && ! -L $(which cmp) ]]
then
# use cmp
if (( $5 == 0 )); then
fi
testResult $output "$3" "$4" $6
else
- # use internal logic (slower!)
- echo NYI
- testResult 0 "$3" "Cannot test. cmp not found." $6
+ # use internal logic (slower!)
+ bufsize=`stat --printf="%s" $1`
+ if (( $5 == 2 )); then
+ bufsize=`stat --printf="%s" $2`
+ else
+ bufsize=$5
+ fi
+ diff <(dd bs=1 count=$bufsize if=$1 &>/dev/null) <(dd bs=1 count=$bufsize if=$2 &>/dev/null)
+ output=$?
+ if (( ${output} == 0 )); then
+ output=1
+ else
+ output=0
+ fi
+ testResult $output "$3" "$4" $6
fi
}