Revision: 76372
http://sourceforge.net/p/brlcad/code/76372
Author: starseeker
Date: 2020-07-17 18:45:23 +0000 (Fri, 17 Jul 2020)
Log Message:
-----------
Move red regression test to subdir
Modified Paths:
--------------
brlcad/branches/bioh/regress/CMakeLists.txt
Added Paths:
-----------
brlcad/branches/bioh/regress/red/
brlcad/branches/bioh/regress/red/red.sh
Removed Paths:
-------------
brlcad/branches/bioh/regress/red.sh
Modified: brlcad/branches/bioh/regress/CMakeLists.txt
===================================================================
--- brlcad/branches/bioh/regress/CMakeLists.txt 2020-07-17 18:40:13 UTC (rev
76371)
+++ brlcad/branches/bioh/regress/CMakeLists.txt 2020-07-17 18:45:23 UTC (rev
76372)
@@ -39,6 +39,9 @@
# libpkg Regression Tests
add_subdirectory(pkg)
+# Region EDit (red) Regression Tests
+add_subdirectory(red)
+
# Burst Regression Tests
add_subdirectory(burst)
@@ -101,9 +104,6 @@
add_test(NAME regress-mged COMMAND ${SH_EXEC}
"${CMAKE_SOURCE_DIR}/regress/mged.sh" ${CMAKE_SOURCE_DIR})
BRLCAD_REGRESSION_TEST(regress-mged mged TEST_DEFINED)
- add_test(NAME regress-red COMMAND ${SH_EXEC}
"${CMAKE_SOURCE_DIR}/regress/red.sh" ${CMAKE_SOURCE_DIR})
- BRLCAD_REGRESSION_TEST(regress-red mged TEST_DEFINED)
-
add_test(NAME regress-nirt COMMAND ${SH_EXEC}
"${CMAKE_SOURCE_DIR}/regress/nirt.sh" ${CMAKE_SOURCE_DIR})
BRLCAD_REGRESSION_TEST(regress-nirt "mged;nirt" TEST_DEFINED)
@@ -141,7 +141,6 @@
mged_test.sh
nirt.sh
nirt/ovlps.g
- red.sh
rtedge.ref.pix.gz
rtedge.ref2.pix.gz
rtedge.ref3.pix.gz
@@ -227,97 +226,6 @@
nirt.mged
nirt.out
nirt.ref
- red.air.empty.out
- red.air.empty.out.new
- red.air.safe.out
- red.air.safe.out.new
- red.air.safe.out.test
- red.air.unsafe.out
- red.air.unsafe.out.new
- red.air.unsafe.out.test
- red.color.delim.out
- red.color.delim.out.new
- red.color.delim.out.test
- red.color.empty.out
- red.color.empty.out.new
- red.color.safe.out
- red.color.safe.out.new
- red.color.safe.out.test
- red.color.unsafe.out
- red.color.unsafe.out.new
- red.edit.sh
- red.g
- red.hps.r.out
- red.log
- red.los.empty.out
- red.los.empty.out.new
- red.los.safe.out
- red.los.safe.out.new
- red.los.safe.out.test
- red.los.unsafe.out
- red.los.unsafe.out.new
- red.los.unsafe.out.test
- red.material_id.empty.out
- red.material_id.empty.out.new
- red.material_id.safe.out
- red.material_id.safe.out.new
- red.material_id.safe.out.test
- red.material_id.unsafe.out
- red.material_id.unsafe.out.new
- red.material_id.unsafe.out.test
- red.matrix.noop.out
- red.matrix.noop.out.new
- red.name.empty.out
- red.name.empty.out.new
- red.name.emptyedit.out
- red.name.emptyedit.out.new
- red.name.safe.out
- red.name.safe.out.new
- red.name.safe.out.test
- red.name.unsafe.out
- red.name.unsafe.out.new
- red.name.unsafe.out.test
- red.region.edit-comb.out
- red.region.edit-comb.out.new
- red.region.edit-comb.out.test
- red.region.edit-comb.out.test2
- red.region.empty.out
- red.region.empty.out.new
- red.region.no.out
- red.region.no.out.new
- red.region.one.out
- red.region.one.out.new
- red.region.yes.out
- red.region.yes.out.new
- red.region.zero.out
- red.region.zero.out.new
- red.region_id.empty.out
- red.region_id.empty.out.new
- red.region_id.safe.out
- red.region_id.safe.out.new
- red.region_id.safe.out.test
- red.region_id.unsafe.out
- red.region_id.unsafe.out.new
- red.region_id.unsafe.out.test
- red.shader.empty.out
- red.shader.empty.out.new
- red.shader.safe.out
- red.shader.safe.out.new
- red.shader.safe.out.test
- red.shader.unsafe.out
- red.shader.unsafe.out.new
- red.shader.unsafe.out.test
- red.sph.r.out
- red.sph_rot.c.out
- red.tree.empty.out
- red.tree.empty.out.new
- red.tree.safe.out
- red.tree.safe.out.new
- red.tree.safe.out.test
- red.tree.unsafe.out
- red.tree.unsafe.out.new
- red.virgin.out
- red.virgin.out.new
region_ids
regions
rtedge.2.pix
Copied: brlcad/branches/bioh/regress/red/red.sh (from rev 76371,
brlcad/branches/bioh/regress/red.sh)
===================================================================
--- brlcad/branches/bioh/regress/red/red.sh (rev 0)
+++ brlcad/branches/bioh/regress/red/red.sh 2020-07-17 18:45:23 UTC (rev
76372)
@@ -0,0 +1,507 @@
+# R E D . S H
+# BRL-CAD
+#
+# Copyright (c) 2008-2020 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.
+#
+###
+#
+# Basic series of MGED 'red' command sanity tests
+#
+###
+
+# Ensure /bin/sh
+export PATH || (echo "This isn't sh."; sh $0 $*; kill $$)
+
+# source common library functionality, setting ARGS, NAME_OF_THIS,
+# PATH_TO_THIS, and THIS.
+. "$1/regress/library.sh"
+
+if test "x$LOGFILE" = "x" ; then
+ LOGFILE=`pwd`/red.log
+ rm -f $LOGFILE
+fi
+log "=== TESTING red command ==="
+
+MGED="`ensearch mged`"
+if test ! -f "$MGED" ; then
+ log "Unable to find mged, aborting"
+ exit 1
+fi
+
+STATUS=0
+
+
+# make our starting database
+create_db ( ) {
+ rm -f red.g
+ $MGED -c >> $LOGFILE 2>&1 <<EOF
+opendb red.g y
+make sph sph
+make sph sph2
+comb sph.c u sph
+r sph.r u sph.c
+cp sph.r hps.r
+mater hps.r light 255 0 0 0
+cp sph.c sph_rot.c
+e sph_rot.c
+oed sph_rot.c sph
+rot 20.2 30.1 10.4
+accept
+quit
+EOF
+
+ if test $? != 0 ; then
+ log "INTERNAL ERROR: mged returned non-zero exit status $?"
+ exit 1
+ fi
+ if test ! -f red.g ; then
+ log "INTERNAL ERROR: Unable to run mged, aborting"
+ exit 1
+ fi
+
+}
+
+
+assert_different ( ) {
+ if test "x`diff $SAMPLE $REDFILE`" = "x" ; then
+ log "ERROR: sed failed"
+ exit 1
+ fi
+}
+
+
+dump ( ) {
+ if test $# -ne 2 ; then
+ log "INTERNAL ERROR: dump has wrong arg count ($# -ne 2)"
+ exit 1
+ fi
+ if test "x$1" = "x" ; then
+ log "INTERNAL ERROR: dump has empty object name #1"
+ exit 1
+ fi
+ if test "x$2" = "x" ; then
+ log "INTERNAL ERROR: dump has empty file name #2"
+ exit 1
+ fi
+ rm -f $2
+ EDITOR=cat $MGED -c red.g red $1 2>> $LOGFILE > $2
+}
+
+
+edit_and_dump ( ) {
+ if test $# -ne 2 ; then
+ log "INTERNAL ERROR: edit_and_dump has wrong arg count ($# -ne 2)"
+ exit 1
+ fi
+ if test "x$1" = "x" ; then
+ log "INTERNAL ERROR: edit_and_dump has empty object name #1"
+ exit 1
+ fi
+ if test "x$2" = "x" ; then
+ log "INTERNAL ERROR: edit_and_dump has empty file name #2"
+ exit 1
+ fi
+ run $MGED -c red.g red $1
+ dump $1 $2
+}
+
+
+init ( ) {
+ if test $# -ne 2 ; then
+ log "INTERNAL ERROR: init has wrong arg count ($# -ne 2)"
+ exit 1
+ fi
+ if test "x$1" = "x" ; then
+ log "INTERNAL ERROR: init has empty description string #1"
+ exit 1
+ fi
+ if test "x$2" = "x" ; then
+ log "INTERNAL ERROR: init has empty file name #2"
+ exit 1
+ fi
+ log "===== $1 ====="
+ create_db
+ REDFILE="$2"
+ export REDFILE
+}
+
+# write out our "editor"
+rm -f red.edit.sh
+cat > red.edit.sh <<EOF
+#!/bin/sh
+cat \$REDFILE > \$1
+EOF
+chmod u+rwx red.edit.sh
+EDITOR="./red.edit.sh"
+export EDITOR
+
+# write out our initial unedited objects, verify sanity
+create_db
+SAMPLE=red.sph.r.out
+dump sph.r $SAMPLE
+ELPMAS=red.hps.r.out
+dump hps.r $ELPMAS
+files_differ $SAMPLE $ELPMAS
+MATRIX=red.sph_rot.c.out
+dump sph_rot.c $MATRIX
+files_differ $SAMPLE $MATRIX
+
+########
+# nada #
+########
+
+init "Verify no edit is no change" red.virgin.out
+cat $SAMPLE | sed 's/ / /g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+
+##########
+# region #
+##########
+
+init "Changing region to yes" red.region.yes.out
+cat $SAMPLE | sed 's/region[^_].*=.*/region = yes/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new # was already a region
+
+init "Changing region to 1" red.region.one.out
+cat $SAMPLE | sed 's/region[^_].*=.*/region = 1/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new # was already a region
+
+init "Changing region to empty" red.region.empty.out
+cat $SAMPLE | sed 's/region[^_].*=.*/region =/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+
+init "Changing region to no" red.region.no.out
+cat $SAMPLE | sed 's/region[^_].*=.*/region = no/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+
+init "Changing region to 0" red.region.zero.out
+cat $SAMPLE | sed 's/region[^_].*=.*/region = 0/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+
+# check for rev 50521 fix
+init "Editing region combination (-r50521)" red.region.edit-comb.out
+cat $SAMPLE > $REDFILE
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+cat $REDFILE.new > $REDFILE.test
+echo " u sph2" >> $REDFILE.test
+files_differ $SAMPLE $REDFILE.test
+cat $REDFILE.test | sed 's/u sph2/ /g' > $REDFILE.test2
+dump sph.r $REDFILE.test2
+files_match $SAMPLE $REDFILE.test2
+
+#############
+# region_id #
+#############
+
+init "Changing region_id to safe" red.region_id.safe.out
+cat $SAMPLE | sed 's/region_id.*=.*/region_id = 2000/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/2000/1000/g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing region_id to empty" red.region_id.empty.out
+cat $SAMPLE | sed 's/region_id.*=.*/region_id =/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+
+init "Changing region_id to unsafe" red.region_id.unsafe.out
+cat $SAMPLE | sed 's/region_id.*=.*/region_id = -1000/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/-1000/1000/g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+###############
+# material_id #
+###############
+
+init "Changing material ID to safe" red.material_id.safe.out
+cat $SAMPLE | sed 's/material_id.*=.*/material_id = 2/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/2/1/g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing material ID to empty" red.material_id.empty.out
+cat $SAMPLE | sed 's/material_id.*=.*/material_id =/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+
+init "Changing material ID to unsafe" red.material_id.unsafe.out
+cat $SAMPLE | sed 's/material_id.*=.*/material_id = -1/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/-1/1/g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+#######
+# los #
+#######
+
+init "Changing los to safe" red.los.safe.out
+cat $SAMPLE | sed 's/los.*=.*/los = 50/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/50/100/g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing los to empty" red.los.empty.out
+cat $SAMPLE | sed 's/los.*=.*/los =/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+
+init "Changing los to unsafe" red.los.unsafe.out
+cat $SAMPLE | sed 's/los.*=.*/los = 200/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/200/100/g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+#######
+# air #
+#######
+
+init "Changing air to safe" red.air.safe.out
+cat $SAMPLE | sed 's/air.*=.*/air = 1111/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/1111//g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing air to empty" red.air.empty.out
+cat $SAMPLE | sed 's/air.*=.*/air =/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+
+init "Changing air to unsafe" red.air.unsafe.out
+cat $SAMPLE | sed 's/air.*=.*/air = -1/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/-1//g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+#########
+# color #
+#########
+
+init "Changing color to safe" red.color.safe.out
+cat $SAMPLE | sed 's/color.*=.*/color = 255\/255\/255/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/255.255.255//g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing color to safe with comma delimiter" red.color.delim.out
+cat $SAMPLE | sed 's/color.*=.*/color = 255,255,255/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/255.255.255//g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing color to empty" red.color.empty.out
+cat $SAMPLE | sed 's/color.*=.*/color = /g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+cat $SAMPLE | sed 's/color.*=.*/color =/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+
+init "Changing color to unsafe" red.color.unsafe.out
+cat $SAMPLE | sed 's/color.*=.*/color = -123/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+
+##########
+# shader #
+##########
+
+init "Changing shader to safe" red.shader.safe.out
+cat $SAMPLE | sed 's/shader.*=.*/shader = plastic/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/plastic//g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing shader to empty" red.shader.empty.out
+cat $SAMPLE | sed 's/shader.*=.*/shader =/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+
+init "Changing shader to unsafe" red.shader.unsafe.out
+cat $SAMPLE | sed 's/shader.*=.*/shader = 1234567890/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/1234567890//g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+########
+# tree #
+########
+
+init "Changing combination tree to safe" red.tree.safe.out
+cat $SAMPLE | sed 's/u sph.c/u sph/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/u sph/u sph.c/g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing combination tree to empty" red.tree.empty.out
+cat $SAMPLE | sed 's/u sph.c//g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+
+init "Changing combination tree to safe" red.tree.unsafe.out
+cat $SAMPLE | sed 's/u sph.c/i like pancakes/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new # edit should fail
+
+########
+# name #
+########
+
+init "Changing name to safe name" red.name.safe.out
+cat $SAMPLE | sed 's/sph.r/sph_new.r/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+dump sph_new.r $REDFILE.new
+files_match $REDFILE $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/sph_new.r/sph.r/g' > $REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing name to safe name with extra edit" red.name.safe.out
+cat $SAMPLE | sed 's/sph.r/sph_new.r/g' | sed 's/1000/2000/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+dump sph_new.r $REDFILE.new
+files_differ $SAMPLE $REDFILE.new
+cat $REDFILE.new | sed 's/sph_new.r/sph.r/g' | sed 's/2000/1000/g' >
$REDFILE.test
+files_match $SAMPLE $REDFILE.test
+
+init "Changing name to empty name" red.name.empty.out
+cat $SAMPLE | sed 's/sph.r//g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $REDFILE $REDFILE.new
+files_match $SAMPLE $REDFILE.new
+
+init "Changing name to empty name with extra edit" red.name.emptyedit.out
+cat $SAMPLE | sed 's/sph.r//g' | sed 's/1000/2000/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+files_differ $REDFILE $REDFILE.new # empty name
+files_match $SAMPLE $REDFILE.new
+
+init "Changing name to unsafe name" red.name.unsafe.out
+cat $SAMPLE | sed 's/sph.r/hps.r/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+dump hps.r $REDFILE.test
+files_match $SAMPLE $REDFILE.new
+files_match $ELPMAS $REDFILE.test
+files_differ $REDFILE.new $REDFILE.test
+
+init "Changing name to unsafe name with edit" red.name.unsafe.out
+cat $SAMPLE | sed 's/sph.r/hps.r/g' | sed 's/1000/2000/g' > $REDFILE
+assert_different
+edit_and_dump sph.r $REDFILE.new
+dump hps.r $REDFILE.test
+files_match $SAMPLE $REDFILE.new
+files_match $ELPMAS $REDFILE.test
+files_differ $REDFILE.new $REDFILE.test
+
+##########
+# matrix #
+##########
+init "Verify that red no-op leaves matrix intact" red.matrix.noop.out
+cat $MATRIX | sed 's/ / /g' > $REDFILE
+assert_different
+edit_and_dump sph_rot.c $REDFILE.new
+files_match $MATRIX $REDFILE.new
+
+
+if test $STATUS -eq 0 ; then
+ log "-> mged 'red' check succeeded"
+else
+ log "-> mged 'red' check FAILED, see $LOGFILE"
+fi
+
+exit $STATUS
+
+
+# Local Variables:
+# tab-width: 8
+# mode: sh
+# sh-indentation: 4
+# sh-basic-offset: 4
+# indent-tabs-mode: t
+# End:
+# ex: shiftwidth=4 tabstop=8
Deleted: brlcad/branches/bioh/regress/red.sh
===================================================================
--- brlcad/branches/bioh/regress/red.sh 2020-07-17 18:40:13 UTC (rev 76371)
+++ brlcad/branches/bioh/regress/red.sh 2020-07-17 18:45:23 UTC (rev 76372)
@@ -1,507 +0,0 @@
-# R E D . S H
-# BRL-CAD
-#
-# Copyright (c) 2008-2020 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.
-#
-###
-#
-# Basic series of MGED 'red' command sanity tests
-#
-###
-
-# Ensure /bin/sh
-export PATH || (echo "This isn't sh."; sh $0 $*; kill $$)
-
-# source common library functionality, setting ARGS, NAME_OF_THIS,
-# PATH_TO_THIS, and THIS.
-. "$1/regress/library.sh"
-
-if test "x$LOGFILE" = "x" ; then
- LOGFILE=`pwd`/red.log
- rm -f $LOGFILE
-fi
-log "=== TESTING red command ==="
-
-MGED="`ensearch mged`"
-if test ! -f "$MGED" ; then
- log "Unable to find mged, aborting"
- exit 1
-fi
-
-STATUS=0
-
-
-# make our starting database
-create_db ( ) {
- rm -f red.g
- $MGED -c >> $LOGFILE 2>&1 <<EOF
-opendb red.g y
-make sph sph
-make sph sph2
-comb sph.c u sph
-r sph.r u sph.c
-cp sph.r hps.r
-mater hps.r light 255 0 0 0
-cp sph.c sph_rot.c
-e sph_rot.c
-oed sph_rot.c sph
-rot 20.2 30.1 10.4
-accept
-quit
-EOF
-
- if test $? != 0 ; then
- log "INTERNAL ERROR: mged returned non-zero exit status $?"
- exit 1
- fi
- if test ! -f red.g ; then
- log "INTERNAL ERROR: Unable to run mged, aborting"
- exit 1
- fi
-
-}
-
-
-assert_different ( ) {
- if test "x`diff $SAMPLE $REDFILE`" = "x" ; then
- log "ERROR: sed failed"
- exit 1
- fi
-}
-
-
-dump ( ) {
- if test $# -ne 2 ; then
- log "INTERNAL ERROR: dump has wrong arg count ($# -ne 2)"
- exit 1
- fi
- if test "x$1" = "x" ; then
- log "INTERNAL ERROR: dump has empty object name #1"
- exit 1
- fi
- if test "x$2" = "x" ; then
- log "INTERNAL ERROR: dump has empty file name #2"
- exit 1
- fi
- rm -f $2
- EDITOR=cat $MGED -c red.g red $1 2>> $LOGFILE > $2
-}
-
-
-edit_and_dump ( ) {
- if test $# -ne 2 ; then
- log "INTERNAL ERROR: edit_and_dump has wrong arg count ($# -ne 2)"
- exit 1
- fi
- if test "x$1" = "x" ; then
- log "INTERNAL ERROR: edit_and_dump has empty object name #1"
- exit 1
- fi
- if test "x$2" = "x" ; then
- log "INTERNAL ERROR: edit_and_dump has empty file name #2"
- exit 1
- fi
- run $MGED -c red.g red $1
- dump $1 $2
-}
-
-
-init ( ) {
- if test $# -ne 2 ; then
- log "INTERNAL ERROR: init has wrong arg count ($# -ne 2)"
- exit 1
- fi
- if test "x$1" = "x" ; then
- log "INTERNAL ERROR: init has empty description string #1"
- exit 1
- fi
- if test "x$2" = "x" ; then
- log "INTERNAL ERROR: init has empty file name #2"
- exit 1
- fi
- log "===== $1 ====="
- create_db
- REDFILE="$2"
- export REDFILE
-}
-
-# write out our "editor"
-rm -f red.edit.sh
-cat > red.edit.sh <<EOF
-#!/bin/sh
-cat \$REDFILE > \$1
-EOF
-chmod u+rwx red.edit.sh
-EDITOR="./red.edit.sh"
-export EDITOR
-
-# write out our initial unedited objects, verify sanity
-create_db
-SAMPLE=red.sph.r.out
-dump sph.r $SAMPLE
-ELPMAS=red.hps.r.out
-dump hps.r $ELPMAS
-files_differ $SAMPLE $ELPMAS
-MATRIX=red.sph_rot.c.out
-dump sph_rot.c $MATRIX
-files_differ $SAMPLE $MATRIX
-
-########
-# nada #
-########
-
-init "Verify no edit is no change" red.virgin.out
-cat $SAMPLE | sed 's/ / /g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-
-##########
-# region #
-##########
-
-init "Changing region to yes" red.region.yes.out
-cat $SAMPLE | sed 's/region[^_].*=.*/region = yes/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new # was already a region
-
-init "Changing region to 1" red.region.one.out
-cat $SAMPLE | sed 's/region[^_].*=.*/region = 1/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new # was already a region
-
-init "Changing region to empty" red.region.empty.out
-cat $SAMPLE | sed 's/region[^_].*=.*/region =/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-
-init "Changing region to no" red.region.no.out
-cat $SAMPLE | sed 's/region[^_].*=.*/region = no/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-
-init "Changing region to 0" red.region.zero.out
-cat $SAMPLE | sed 's/region[^_].*=.*/region = 0/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-
-# check for rev 50521 fix
-init "Editing region combination (-r50521)" red.region.edit-comb.out
-cat $SAMPLE > $REDFILE
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-cat $REDFILE.new > $REDFILE.test
-echo " u sph2" >> $REDFILE.test
-files_differ $SAMPLE $REDFILE.test
-cat $REDFILE.test | sed 's/u sph2/ /g' > $REDFILE.test2
-dump sph.r $REDFILE.test2
-files_match $SAMPLE $REDFILE.test2
-
-#############
-# region_id #
-#############
-
-init "Changing region_id to safe" red.region_id.safe.out
-cat $SAMPLE | sed 's/region_id.*=.*/region_id = 2000/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/2000/1000/g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing region_id to empty" red.region_id.empty.out
-cat $SAMPLE | sed 's/region_id.*=.*/region_id =/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-
-init "Changing region_id to unsafe" red.region_id.unsafe.out
-cat $SAMPLE | sed 's/region_id.*=.*/region_id = -1000/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/-1000/1000/g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-###############
-# material_id #
-###############
-
-init "Changing material ID to safe" red.material_id.safe.out
-cat $SAMPLE | sed 's/material_id.*=.*/material_id = 2/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/2/1/g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing material ID to empty" red.material_id.empty.out
-cat $SAMPLE | sed 's/material_id.*=.*/material_id =/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-
-init "Changing material ID to unsafe" red.material_id.unsafe.out
-cat $SAMPLE | sed 's/material_id.*=.*/material_id = -1/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/-1/1/g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-#######
-# los #
-#######
-
-init "Changing los to safe" red.los.safe.out
-cat $SAMPLE | sed 's/los.*=.*/los = 50/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/50/100/g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing los to empty" red.los.empty.out
-cat $SAMPLE | sed 's/los.*=.*/los =/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-
-init "Changing los to unsafe" red.los.unsafe.out
-cat $SAMPLE | sed 's/los.*=.*/los = 200/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/200/100/g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-#######
-# air #
-#######
-
-init "Changing air to safe" red.air.safe.out
-cat $SAMPLE | sed 's/air.*=.*/air = 1111/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/1111//g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing air to empty" red.air.empty.out
-cat $SAMPLE | sed 's/air.*=.*/air =/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-
-init "Changing air to unsafe" red.air.unsafe.out
-cat $SAMPLE | sed 's/air.*=.*/air = -1/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/-1//g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-#########
-# color #
-#########
-
-init "Changing color to safe" red.color.safe.out
-cat $SAMPLE | sed 's/color.*=.*/color = 255\/255\/255/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/255.255.255//g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing color to safe with comma delimiter" red.color.delim.out
-cat $SAMPLE | sed 's/color.*=.*/color = 255,255,255/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/255.255.255//g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing color to empty" red.color.empty.out
-cat $SAMPLE | sed 's/color.*=.*/color = /g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-cat $SAMPLE | sed 's/color.*=.*/color =/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-
-init "Changing color to unsafe" red.color.unsafe.out
-cat $SAMPLE | sed 's/color.*=.*/color = -123/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-
-##########
-# shader #
-##########
-
-init "Changing shader to safe" red.shader.safe.out
-cat $SAMPLE | sed 's/shader.*=.*/shader = plastic/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/plastic//g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing shader to empty" red.shader.empty.out
-cat $SAMPLE | sed 's/shader.*=.*/shader =/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-
-init "Changing shader to unsafe" red.shader.unsafe.out
-cat $SAMPLE | sed 's/shader.*=.*/shader = 1234567890/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/1234567890//g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-########
-# tree #
-########
-
-init "Changing combination tree to safe" red.tree.safe.out
-cat $SAMPLE | sed 's/u sph.c/u sph/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/u sph/u sph.c/g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing combination tree to empty" red.tree.empty.out
-cat $SAMPLE | sed 's/u sph.c//g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-
-init "Changing combination tree to safe" red.tree.unsafe.out
-cat $SAMPLE | sed 's/u sph.c/i like pancakes/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new # edit should fail
-
-########
-# name #
-########
-
-init "Changing name to safe name" red.name.safe.out
-cat $SAMPLE | sed 's/sph.r/sph_new.r/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-dump sph_new.r $REDFILE.new
-files_match $REDFILE $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/sph_new.r/sph.r/g' > $REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing name to safe name with extra edit" red.name.safe.out
-cat $SAMPLE | sed 's/sph.r/sph_new.r/g' | sed 's/1000/2000/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-dump sph_new.r $REDFILE.new
-files_differ $SAMPLE $REDFILE.new
-cat $REDFILE.new | sed 's/sph_new.r/sph.r/g' | sed 's/2000/1000/g' >
$REDFILE.test
-files_match $SAMPLE $REDFILE.test
-
-init "Changing name to empty name" red.name.empty.out
-cat $SAMPLE | sed 's/sph.r//g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $REDFILE $REDFILE.new
-files_match $SAMPLE $REDFILE.new
-
-init "Changing name to empty name with extra edit" red.name.emptyedit.out
-cat $SAMPLE | sed 's/sph.r//g' | sed 's/1000/2000/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-files_differ $REDFILE $REDFILE.new # empty name
-files_match $SAMPLE $REDFILE.new
-
-init "Changing name to unsafe name" red.name.unsafe.out
-cat $SAMPLE | sed 's/sph.r/hps.r/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-dump hps.r $REDFILE.test
-files_match $SAMPLE $REDFILE.new
-files_match $ELPMAS $REDFILE.test
-files_differ $REDFILE.new $REDFILE.test
-
-init "Changing name to unsafe name with edit" red.name.unsafe.out
-cat $SAMPLE | sed 's/sph.r/hps.r/g' | sed 's/1000/2000/g' > $REDFILE
-assert_different
-edit_and_dump sph.r $REDFILE.new
-dump hps.r $REDFILE.test
-files_match $SAMPLE $REDFILE.new
-files_match $ELPMAS $REDFILE.test
-files_differ $REDFILE.new $REDFILE.test
-
-##########
-# matrix #
-##########
-init "Verify that red no-op leaves matrix intact" red.matrix.noop.out
-cat $MATRIX | sed 's/ / /g' > $REDFILE
-assert_different
-edit_and_dump sph_rot.c $REDFILE.new
-files_match $MATRIX $REDFILE.new
-
-
-if test $STATUS -eq 0 ; then
- log "-> mged 'red' check succeeded"
-else
- log "-> mged 'red' check FAILED, see $LOGFILE"
-fi
-
-exit $STATUS
-
-
-# Local Variables:
-# tab-width: 8
-# mode: sh
-# sh-indentation: 4
-# sh-basic-offset: 4
-# indent-tabs-mode: t
-# End:
-# ex: shiftwidth=4 tabstop=8
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits