From 2e648b6ab66487a4714972f39eed9bc3000d8d77 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Wed, 18 Jul 2018 15:57:48 +0900 Subject: [PATCH] [Tests] Fix bug, errors ignored Bug: - When there is no log files, a test results in "PASSED" - When there is differences between golden and test, the result sasy "PASSED" Fixes #275 Signed-off-by: MyungJoo Ham --- tests/testAPI.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/testAPI.sh b/tests/testAPI.sh index e3e9da6..3ebdbd5 100644 --- a/tests/testAPI.sh +++ b/tests/testAPI.sh @@ -93,6 +93,24 @@ function gstFailTest { function compareAll { cmp $1 $2 output=$? + if [ ! -f $1 ]; then + output=1 + else + size1=$(wc -c < "$1") + if [ $size1 -eq 0 ]; then + # If the size is 0, it's an error + output=2 + fi + fi + if [ ! -f $2 ]; then + output=1 + else + size2=$(wc -c < "$2") + if [ $size2 -eq 0 ]; then + # If the size is 0, it's an error + output=2 + fi + fi if [[ $output -eq 0 ]]; then lsucc=$((lsucc+1)) log="${log}$GREEN[PASSED]$NC golden test comparison case $3\n" @@ -111,6 +129,25 @@ function compareAll { function compareAllSizeLimit { # @TODO enter -n option with the size of #1 cmp -n `stat --printf="%s" $1` $1 $2 + output=$? + if [ ! -f $1 ]; then + output=1 + else + size1=$(wc -c < "$1") + if [ $size1 -eq 0 ]; then + # If the size is 0, it's an error + output=2 + fi + fi + if [ ! -f $2 ]; then + output=1 + else + size2=$(wc -c < "$2") + if [ $size2 -eq 0 ]; then + # If the size is 0, it's an error + output=2 + fi + fi if [[ $output -eq 0 ]]; then lsucc=$((lsucc+1)) log="${log}$GREEN[PASSED]$NC golden test comparison case $3\n" -- 2.7.4