Revision: 50627
          http://brlcad.svn.sourceforge.net/brlcad/?rev=50627&view=rev
Author:   starseeker
Date:     2012-05-21 23:06:59 +0000 (Mon, 21 May 2012)
Log Message:
-----------
Put a framework for regression testing rtwizard in place.  Need to assemble 
more tests - just one example for now.

Modified Paths:
--------------
    brlcad/trunk/regress/CMakeLists.txt

Added Paths:
-----------
    brlcad/trunk/regress/rtwizard/
    brlcad/trunk/regress/rtwizard/rtwizard_test1_ref.asc.gz
    brlcad/trunk/regress/rtwizard.sh

Modified: brlcad/trunk/regress/CMakeLists.txt
===================================================================
--- brlcad/trunk/regress/CMakeLists.txt 2012-05-21 21:07:28 UTC (rev 50626)
+++ brlcad/trunk/regress/CMakeLists.txt 2012-05-21 23:06:59 UTC (rev 50627)
@@ -85,7 +85,16 @@
     ${SH_EXEC} ${CMAKE_SOURCE_DIR}/regress/quote.sh ${CMAKE_SOURCE_DIR}
     DEPENDS test_quote
     )
+  add_custom_target(regress-rtwizard
+    ${SH_EXEC} ${CMAKE_SOURCE_DIR}/regress/rtwizard.sh ${CMAKE_SOURCE_DIR}
+    DEPENDS btclsh rt rtedge fbclear fbserv pix-fb fb-pix pix-bw bw-pix 
+    pixmatte asc2g asc2pix pixdiff util_tclIndex util_pkgIndex.tcl
+    rtwizard_lib_tclIndex rtwizard_lib_pkgIndex.tcl rtwizard_tclIndex
+    rtwizard_pkgIndex.tcl rtwizard_TCLSCRIPTS_cp lib_tclIndex
+    lib_pkgIndex.tcl
+    )
 
+
   add_custom_target(regress
     DEPENDS regress-mged regress-moss regress-lights
     regress-solids regress-shaders regress-spdi regress-iges
@@ -127,6 +136,8 @@
   quote.sh
   red.sh
   repository.sh
+  rtwizard
+  rtwizard.sh
   shaders.sh
   shaderspix.asc
   slave_build.sh
@@ -311,6 +322,12 @@
   red.virgin.out.new
   region_ids
   regions
+  rtwizard.m35.g
+  rtwizard_test1.diff.pix
+  rtwizard_test1.pix
+  rtwizard_test1.pixdiff.log
+  rtwizard_test1_ref.asc
+  rtwizard_test1_ref.pix
   shaders.dat
   shaders.g
   shaders.log

Added: brlcad/trunk/regress/rtwizard/rtwizard_test1_ref.asc.gz
===================================================================
(Binary files differ)


Property changes on: brlcad/trunk/regress/rtwizard/rtwizard_test1_ref.asc.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: brlcad/trunk/regress/rtwizard.sh
===================================================================
--- brlcad/trunk/regress/rtwizard.sh                            (rev 0)
+++ brlcad/trunk/regress/rtwizard.sh    2012-05-21 23:06:59 UTC (rev 50627)
@@ -0,0 +1,128 @@
+#!/bin/sh
+#                    R T W I Z A R D . S H
+# BRL-CAD
+#
+# Copyright (c) 2010-2012 United States Government as represented by
+# the U.S. Army Research Laboratory.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# 3. The name of the author may not be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+###
+
+# Ensure /bin/sh
+export PATH || (echo "This isn't sh."; sh $0 $*; kill $$)
+
+TOP_SRCDIR="$1"
+
+# source common library functionality, setting ARGS, NAME_OF_THIS,
+# PATH_TO_THIS, and THIS.
+. "$1/regress/library.sh"
+
+ASC2G="`ensearch asc2g`"
+if test ! -f "$ASC2G" ; then
+    echo "Unable to find asc2g, aborting"
+    exit 1
+fi
+RTWIZARD="`ensearch rtwizard`"
+if test ! -f "$RTWIZARD" ; then
+    echo "Unable to find rtwizard, aborting"
+    exit 1
+fi
+ASC2PIX="`ensearch asc2pix`"
+if test ! -f "$ASC2PIX" ; then
+    echo "Unable to find asc2pix, aborting"
+    exit 1
+fi
+PIXDIFF="`ensearch pixdiff`"
+if test ! -f "$PIXDIFF" ; then
+    echo "Unable to find pixdiff, aborting"
+    exit 1
+fi
+GZIP="`which gzip`"
+if test ! -f "$GZIP" ; then
+    echo "Unable to find gzip, aborting"
+    exit 1
+fi
+
+# determine the behavior of tail
+case "x`echo 'tail' | tail -n 1 2>&1`" in
+    *xtail*) TAIL_N="n " ;;
+    *) TAIL_N="" ;;
+esac
+
+rtwizard_prep () {
+  rm -f rtwizard_test$1.pix rtwizard_test$1_ref.asc rtwizard_test$1_ref.pix 
rtwizard_test$1.pixdiff.log rtwizard_test$1.diff.pix
+}
+
+rtwizard_check () {
+NUMBER_WRONG=1
+if [ ! -f rtwizard_test1.pix ] ; then
+        echo "rtwizard failed to create an image - Test #$1"
+        echo '-> rtwizard.sh FAILED'
+        exit 1
+else
+        if [ ! -f "$TOP_SRCDIR/regress/rtwizard/rtwizard_test$1_ref.asc.gz" ] 
; then
+                echo No reference file for 
$TOP_SRCDIR/regress/rtwizard_test$1.pix
+        else
+               $GZIP -d -c 
"$TOP_SRCDIR/regress/rtwizard/rtwizard_test$1_ref.asc.gz" > 
rtwizard_test$1_ref.asc
+                $ASC2PIX < rtwizard_test$1_ref.asc > rtwizard_test$1_ref.pix
+                $PIXDIFF rtwizard_test$1.pix rtwizard_test$1_ref.pix > 
rtwizard_test$1.diff.pix 2> rtwizard_test$1.pixdiff.log
+
+               NUMBER_WRONG=`tr , '\012' < rtwizard_test$1.pixdiff.log | awk 
'/many/ {print $1}' | tail -${TAIL_N}1`
+               export NUMBER_WRONG
+               if [ X$NUMBER_WRONG = X0 ] ; then
+                 echo "-> Type $1 image generation succeeded"
+               else
+                 echo "rtwizard_test$1.pix $NUMBER_WRONG off by many"
+                 echo '-> rtwizard.sh FAILED'
+                  exit 1
+               fi
+        fi
+fi
+}
+
+# Create the .g file to be raytraced
+rm -f rtwizard.m35.g
+$ASC2G $1/db/m35.asc rtwizard.m35.g
+
+rtwizard_prep 1
+$RTWIZARD --no-gui -i rtwizard.m35.g -o rtwizard_test1.pix -c component  2>&1
+rtwizard_check 1
+
+# If we got this far, tests were successful
+exit 0
+
+# Local Variables:
+# mode: sh
+# tab-width: 8
+# sh-indentation: 4
+# sh-basic-offset: 4
+# indent-tabs-mode: t
+# End:
+# ex: shiftwidth=4 tabstop=8


Property changes on: brlcad/trunk/regress/rtwizard.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to