[API/compareTest] Return result when files do not exist
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Thu, 8 Oct 2020 07:09:26 +0000 (16:09 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 8 Oct 2020 08:22:52 +0000 (17:22 +0900)
- When the file does not  exist, in BusyBox condition, the bufsize is null and results of `dd` are same error message. And unexpected PASS result follows.
- This patch prevents this unexpected behavior.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
ssat-api.sh

index 2b11b08..c8f255b 100644 (file)
@@ -247,6 +247,10 @@ function callTestExitEq() {
 function callCompareTest() {
        # Try cmp.
        output=0
+       if [[ ! -f "$1" || ! -f "$2" ]]; then
+               testResult $output "$3" "$4" $6
+               return
+       fi
        command -v cmp
        # If cmp is symlink, then it could be from busybox and it does not support "-n" option
        if [[ $? == 0 && ! -L $(which cmp) ]]