imageDiff.sh 1.72 KB
#!/bin/sh -f

ARCHIVE_DIR=${ROOT}/PR/diags/rdp/archive

TNAME=""

##################################################
#
#  Usage message
#
##################################################
usage()
{
  echo "Usage: imageDiff.sh -n test_name"
  exit 0
}

##################################################
#
#  Compare .rgb, .cov, and .z files
#
#  $1 = file prefix
#
##################################################
compare_function()
{
	for sufx in  rgb cov z 
#	for sufx in  rgb
	do
	    f1=OutData/${TNAME}_0.${sufx}
	    f2=${ARCHIVE_DIR}/${TNAME}_io_0.${sufx}.archive
	    df=OutData/${TNAME}_idf.${sufx}

            if [ -r $f1 -a -r $f2 ]
	    then
		${ROOT}/PR/rdpsim/tools/iclr $f1 
	        if cmp -s $f1 $f2
	        then
	            echo "INFO:  ${sufx} equate."
	        else
	            echo "ERROR: ${sufx} differ. Diff generated as $df."
	            ${ROOT}/usr/sbin/idf -d $f1 $f2 $df
	            if [ $? -eq 0 ]
	            then
		        echo "HINT:  Differences probably SOLELY due to dithering."
	            fi
	        fi
	    else
	        if [ ! -r $f1 ]
	        then
	          echo "ERROR: $f1 not present or not readable."
		fi
	
	        if [ ! -r $f2 ]
		then
	          echo "ERROR: $f2 not present or not readable."
		fi
	    fi
	done
}
   
##################################################
#
#  Parse options
#
##################################################
    while getopts "n:" a
    do
      case $a in
        n)  TNAME=$OPTARG;;
        \?) usage ;;
      esac
    done
    shift `expr $OPTIND - 1`


    echo "\n"
    echo "#"
    echo "# Compare of image file to archived file"
    echo "# `date`"
    echo "#"

    echo "INFO:  ==============  ${TNAME}  =============="
    compare_function
    echo "\n"