nightly_image_diff.sh 6.71 KB
#!/bin/sh -f

SIM="all"

##################################################
#
#  Usage message
#
##################################################
usage()
{
  echo "Usage: nightly_image_diff.sh <-s> simulator"
  echo "  Simulator: cio, ccv, cvio, all, default = all"
  exit 0
}

##################################################
#
#  Parse options
#
##################################################
    while getopts "s:" a
    do
      case $a in
        s)  SIM=$OPTARG;;
        \?) usage ;;
      esac
    done
    shift `expr $OPTIND - 1`


###############################################################################
#
# For each incoming arg, generate file names by appending appropriate suffixes,
# use iclr to strip out garbage from the image file header, then use cmp to
# compare the resulting binary data.  If a difference is detected, use idf -d
# to generate a viewable difference file, and to determine whether or not the
# differences are == 0x08, which are usually attributable to dithering.
#
###############################################################################


    for fprefix do

      if [ $SIM = "ccv" -o $SIM = "cio" -o $SIM = "all" ]
      then
	../../tools/iclr OutData/${fprefix}_cf_0.rgb
	../../tools/iclr OutData/${fprefix}_c_0.cov
	../../tools/iclr OutData/${fprefix}_c_0.z
      fi

      if [ $SIM = "ccv" -o $SIM = "cvio" -o $SIM = "all" ]
      then
	../../tools/iclr OutData/${fprefix}_cvf_0.rgb
	../../tools/iclr OutData/${fprefix}_cv_0.cov
	../../tools/iclr OutData/${fprefix}_cv_0.z
      fi

      if [ $SIM = "cvio" -o $SIM = "cio" -o $SIM = "all" ]
      then
	../../tools/iclr OutData/${fprefix}_iof_0.rgb
	../../tools/iclr OutData/${fprefix}_io_0.cov
	../../tools/iclr OutData/${fprefix}_io_0.z
      fi


      #
      #  C/CV compares
      #

      if [ $SIM = "ccv" -o $SIM = "all" ]
      then

	#
	# Compare RGB pixel values, rdp_c vs rdp_cv.
	#

	if cmp -s OutData/${fprefix}_cf_0.rgb OutData/${fprefix}_cvf_0.rgb
	then
	    echo "INFO:  Image files ${fprefix}_cf_0.rgb and ${fprefix}_cvf_0.rgb equate."
	else
	    echo "ERROR: Image files ${fprefix}_cf_0.rgb and ${fprefix}_cvf_0.rgb differ."
	    echo "  difference file generated as ${fprefix}_idf_c_cv.rgb"
	    idf -d OutData/${fprefix}_cf_0.rgb OutData/${fprefix}_cvf_0.rgb OutData/${fprefix}_idf_c_cv.rgb
	    if test $? -eq 0
	    then
		echo "  differences probably SOLELY due to dithering."
	    fi
	fi

        #
        # Compare z buffer values, rdp_c vs rdp_cv.
        #

	if cmp -s OutData/${fprefix}_c_0.z OutData/${fprefix}_cv_0.z
	then
	    echo "INFO:  Image files ${fprefix}_c_0.z and ${fprefix}_cv_0.z equate."
	else
	    echo "ERROR: Image files ${fprefix}_c_0.z and ${fprefix}_cv_0.z differ."
	fi

	#
	# Compare filter program's coverage values, rdp_c vs rdp_cv.
	#

	if cmp -s OutData/${fprefix}_c_0.cov OutData/${fprefix}_cv_0.cov
	then
	    echo "INFO:  Image files ${fprefix}_c_0.cov and ${fprefix}_cv_0.cov equate."
	else
	    echo "ERROR: Image files ${fprefix}_c_0.cov and ${fprefix}_cv_0.cov differ."
	fi

	# Don't do this until raw coverage files compare (need to clear the header).
	####
	#### Compare raw coverage values, rdp_c vs rdp_cv.
	####
	###
	###	if cmp -s OutData/${fprefix}_c_0.cvg OutData/${fprefix}_cv_0.cvg
	###	then
	###	    echo "INFO:  Coverage files ${fprefix}_c_0.cvg and ${fprefix}_cv_0.cvg equate."
	###	else
	###	    echo "ERROR: Coverage files ${fprefix}_c_0.cvg and ${fprefix}_cv_0.cvg differ."
	###	fi
	###
	####
      fi

      #
      #  C/IO compares
      #

      if [ $SIM = "cio" -o $SIM = "all" ]
      then

	#
	# Compare RGB pixel values, rdp_c vs iosim.
	#

	if cmp -s OutData/${fprefix}_cf_0.rgb OutData/${fprefix}_iof_0.rgb
	then
	    echo "INFO:  Image files ${fprefix}_cf_0.rgb and ${fprefix}_iof_0.rgb equate."
	else
	    echo "ERROR: Image files ${fprefix}_cf_0.rgb and ${fprefix}_iof_0.rgb differ."
	    echo "  difference file generated as ${fprefix}_idf_c_io.rgb"
	    idf -d OutData/${fprefix}_cf_0.rgb OutData/${fprefix}_iof_0.rgb OutData/${fprefix}_idf_c_io.rgb
	    if test $? -eq 0
	    then
		echo "  differences probably SOLELY due to dithering."
	    fi
	fi

	#
	# Compare z buffer values, rdp_c vs iosim.
	#

	if cmp -s OutData/${fprefix}_c_0.z OutData/${fprefix}_io_0.z
	then
	    echo "INFO:  Image files ${fprefix}_c_0.z and ${fprefix}_io_0.z equate."
	else
	    echo "ERROR: Image files ${fprefix}_c_0.z and ${fprefix}_io_0.z differ."
	fi

	#
	# Compare filter program's coverage values, rdp_c vs iosim.
	#

	if cmp -s OutData/${fprefix}_c_0.cov OutData/${fprefix}_io_0.cov
	then
	    echo "INFO:  Image files ${fprefix}_c_0.cov and ${fprefix}_io_0.cov equate."
	else
	    echo "ERROR: Image files ${fprefix}_c_0.cov and ${fprefix}_io_0.cov differ."
	fi

	#### Compare raw coverage values, rdp_c vs iosim.
	####
	###
	###	if cmp -s OutData/${fprefix}_c_0.cvg OutData/${fprefix}_io_0.cvg
	###	then
	###	    echo "INFO:  Coverage files ${fprefix}_c_0.cvg and ${fprefix}_io_0.cvg equate."
	###	else
	###	    echo "ERROR: Coverage files ${fprefix}_c_0.cvg and ${fprefix}_io_0.cvg differ."
	###	fi
	###
	###
	####
      fi

      #
      #  CV/IO compares
      #

      if [ $SIM = "cvio" -o $SIM = "all" ]
      then

	#
	# Compare RGB pixel values, rdp_cv vs iosim.
	#

	if cmp -s OutData/${fprefix}_cvf_0.rgb OutData/${fprefix}_iof_0.rgb
	then
	    echo "INFO:  Image files ${fprefix}_cvf_0.rgb and ${fprefix}_iof_0.rgb equate."
	else
	    echo "ERROR: Image files ${fprefix}_cvf_0.rgb and ${fprefix}_iof_0.rgb differ."
	    echo "  difference file generated as ${fprefix}_idf_cv_io.rgb"
	    idf -d OutData/${fprefix}_cvf_0.rgb OutData/${fprefix}_iof_0.rgb OutData/${fprefix}_idf_cv_io.rgb
	    if test $? -eq 0
	    then
		echo "  differences probably SOLELY due to dithering."
	    fi
	fi

	#
	# Compare z buffer values, rdp_cv vs iosim.
	#

	if cmp -s OutData/${fprefix}_cv_0.z OutData/${fprefix}_io_0.z
	then
	    echo "INFO:  Image files ${fprefix}_cv_0.z and ${fprefix}_io_0.z equate."
	else
	    echo "ERROR: Image files ${fprefix}_cv_0.z and ${fprefix}_io_0.z differ."
	fi


	#
	# Compare filter program's coverage values, rdp_cv vs iosim.
	#

	if cmp -s OutData/${fprefix}_cv_0.cov OutData/${fprefix}_io_0.cov
	then
	    echo "INFO:  Image files ${fprefix}_cv_0.cov and ${fprefix}_io_0.cov equate."
	else
	    echo "ERROR: Image files ${fprefix}_cv_0.cov and ${fprefix}_io_0.cov differ."
	fi

	#### Compare raw coverage values, rdp_cv vs iosim.
	####
	###
	###	if cmp -s OutData/${fprefix}_cv_0.cvg OutData/${fprefix}_io_0.cvg
	###	then
	###	    echo "INFO:  Coverage files ${fprefix}_cv_0.cvg and ${fprefix}_io_0.cvg equate."
	###	else
	###	    echo "ERROR: Coverage files ${fprefix}_cv_0.cvg and ${fprefix}_io_0.cvg differ."
	###	fi

      fi



      #
      # Print a space between each prefix for readability.
      #
      echo ""

    done