[avida-cvs] avida CVS commits: /current NEWS configure.in /current/source/main Makefile.am /current/source/main/functional_testsuites/config unix.exp /current/source/main/functional_testsuites/default.md5sum analyze.cfg environment.cfg events.cfg genesis inst_set.default md5sum.exp md5sum.sh organism.default /current/source/main/functional_testsuites/default.tail analyze.cfg environment.cfg events.cfg genesis inst_set.default organism.default tail.exp tail.sh /current/source/main/unit_testsuites Makefile.am dejagnu.h /current/source/main/unit_testsuites/config unix.exp /current/source/main/unit_testsuites/demo.hello hello.cc hello.exp

kaben avida-cvs at alife.org
Fri Oct 3 22:48:18 PDT 2003


kaben		Fri Oct  3 14:48:18 2003 EDT

  Modified files:              
    /avida/current	NEWS configure.in 
    /avida/current/source/main	Makefile.am 
    /avida/current/source/main/functional_testsuites/config	unix.exp 
    /avida/current/source/main/functional_testsuites/default.md5sum	
                                                                   	analyze.cfg 
                                                                   	environment.cfg 
                                                                   	events.cfg 
                                                                   	genesis 
                                                                   	inst_set.default 
                                                                   	md5sum.exp 
                                                                   	md5sum.sh 
                                                                   	organism.default 
    /avida/current/source/main/functional_testsuites/default.tail	
                                                                 	analyze.cfg 
                                                                 	environment.cfg 
                                                                 	events.cfg 
                                                                 	genesis 
                                                                 	inst_set.default 
                                                                 	organism.default 
                                                                 	tail.exp 
                                                                 	tail.sh 
    /avida/current/source/main/unit_testsuites	Makefile.am dejagnu.h 
    /avida/current/source/main/unit_testsuites/config	unix.exp 
    /avida/current/source/main/unit_testsuites/demo.hello	hello.cc 
                                                         	hello.exp 
  Log:
  
  Merge changes to branch kaben into branch HEAD.
  - provides demonstration testsuites in
      source/main/functional_testsuites/
    and
      source/main/unit_testsuites/
  
  
  
-------------- next part --------------
Index: avida/current/NEWS
diff -u avida/current/NEWS:1.25 avida/current/NEWS:1.26
--- avida/current/NEWS:1.25	Wed Sep 24 01:11:59 2003
+++ avida/current/NEWS	Fri Oct  3 14:48:15 2003
@@ -4,7 +4,6 @@
 [B] = Bug fix; something that used to work wrong will now be correct.
 [M] = Major change; avida will function differently in certain circumstances.
 
-
 For version 2.0 beta 6:
 
 September, 03
Index: avida/current/configure.in
diff -u avida/current/configure.in:1.32 avida/current/configure.in:1.33
--- avida/current/configure.in:1.32	Wed Sep 24 01:11:59 2003
+++ avida/current/configure.in	Fri Oct  3 14:48:15 2003
@@ -89,12 +89,26 @@
 AM_CONDITIONAL(BUILD_PRIMITIVE, test x$build_primitive = xtrue)
 
 
-AC_ARG_ENABLE(primitive,
-  [  --disable-primitive: Disable build of gui-less avida],
-  [build_primitive=false],
-  [build_primitive=true])
-AM_CONDITIONAL(BUILD_PRIMITIVE, test x$build_primitive = xtrue)
+dnl regression testsuites
 
+regression_tests=false;
+
+AC_ARG_ENABLE(all-tests,
+  [  --enable-all-tests: Comprehensive regression tests via 'make check'],
+  [all_tests=true; regression_tests=true], [all_tests=false])
+
+AC_ARG_ENABLE(default-tests,
+   [  --disable-default-tests: Disable default regression tests via 'make check'],
+   [default_tests=false], [default_tests=true; regression_tests=true])
+AM_CONDITIONAL(DEFAULT_TESTS, test x$default_tests = xtrue)
+
+AC_ARG_ENABLE(tedious-tests,
+  [  --enable-tedious-tests: Tedious regression tests via 'make check'],
+  [tedious_tests=true; regression_tests=true],
+  [if test x$all_tests = xtrue; then tedious_tests=true; else tedious_tests=false; fi])
+AM_CONDITIONAL(TEDIOUS_TESTS, test x$tedious_tests = xtrue)
+
+AM_CONDITIONAL(DEJAGNU_REGRESSION_TESTS, test x$regression_tests = xtrue)
 
 dnl ****************************************
 dnl Checks for ncurses viewer
@@ -184,6 +198,8 @@
   source/tools/Makefile source/cpu/Makefile
   source/event/Makefile source/viewers/Makefile
   source/main/Makefile
+  source/main/functional_testsuites/Makefile
+  source/main/unit_testsuites/Makefile
   source/support/Makefile
   source/support/preset_organisms/Makefile
   source/qt-viewer/Makefile
Index: avida/current/source/main/Makefile.am
diff -u avida/current/source/main/Makefile.am:1.32 avida/current/source/main/Makefile.am:1.33
--- avida/current/source/main/Makefile.am:1.32	Thu Aug  7 20:24:19 2003
+++ avida/current/source/main/Makefile.am	Fri Oct  3 14:48:15 2003
@@ -75,3 +75,7 @@
 endif
 
 EXTRA_DIST = main.pro main_sub.pri
+
+if DEJAGNU_REGRESSION_TESTS
+SUBDIRS = . unit_testsuites functional_testsuites
+endif
Index: avida/current/source/main/functional_testsuites/config/unix.exp
diff -u /dev/null avida/current/source/main/functional_testsuites/config/unix.exp:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/config/unix.exp	Fri Oct  3 14:48:15 2003
@@ -0,0 +1,170 @@
+# a hairy pattern to recognize text
+set text "\[- A-Za-z0-9\.\;\"\_\:\'\`\(\)\!\#\=\+\?\&\*]"
+
+# Execute the executable file, and analyse the output for the 
+# test state keywords.
+#    Returns:
+#       A "" (empty) string if everything worked, or an error message
+#       if there was a problem.
+proc executable_test {tool args} {
+    global text
+
+    set timeoutmsg "Timed out: Never got started, "
+    set timeout 100
+    set file all
+    set timetol 0
+    set arguments ""
+    
+    expect_before buffer_full { perror "Buffer full" }
+    
+    if { [llength $args] == 0} {
+        set executable $args
+    } else {
+        set executable [string trimleft [lindex [split $args " "] 0] "\{"]
+        set the_command [string trimleft $args "\{"]
+        set the_command [string trimright $the_command "\}"]
+    }
+
+    verbose "The executable is $executable" 2
+    if ![file exists ${executable}] {
+        perror "The executable \"$executable\" is missing" 0
+        return "No source file found"
+    }
+
+    # spawn the executable and look for the DejaGnu output messages from the
+    # test case.
+    # spawn -noecho -open [open "|./${executable}" "r"]
+    eval "spawn -noecho $the_command"
+    expect {
+        -re "\[0-9\]\[0-9\]:..:..:${text}\r\n" {
+            regsub "\[\n\r\t\]*NOTE: $text\r\n" $expect_out(0,string) "" output
+            verbose "$output" 3
+            set timetol 0
+            exp_continue
+        }
+        -re "NOTE:${text}*" {
+            regsub "\[\n\r\t\]*NOTE: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 6 end]
+            verbose "$output" 2
+            set timetol 0
+            exp_continue
+        }
+        -re "PASSED:${text}*" {
+            regsub "\[\n\r\t\]*PASSED: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 8 end]
+            pass "$output"
+            set timetol 0
+            exp_continue
+        }
+        -re "FAILED:${text}*" {
+            regsub "\[\n\r\t\]*FAILED: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 8 end]
+            fail "$output (See $tool.log for details.)"
+            set timetol 0
+            exp_continue
+        }
+        -re "UNTESTED:${text}*" {
+            regsub "\[\n\r\t\]*UNTESTED: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 10 end]
+            untested "$output"
+            set timetol 0
+            exp_continue
+        }
+        -re "UNRESOLVED:${text}*" {
+            regsub "\[\n\r\t\]*UNRESOLVED: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 12 end]
+            unresolved "$output"
+            set timetol 0
+            exp_continue
+        }
+        -re "Totals" {
+            verbose "All done" 2
+        }
+        eof {
+#           unresolved "${executable} died prematurely"
+#           catch close
+#           return "${executable} died prematurely"
+        }
+        timeout {
+            warning "Timed out executing test case"
+            if { $timetol <= 2 } {
+                incr timetol
+                exp_continue
+            } else {
+-               catch close
+                return "Timed out executing test case"
+            }
+        }
+    }
+
+    # force a close of the executable to be safe.
+    catch close
+    return ""
+}
+
+# Execute the executable file, and analyse the output for the 
+# expected last line.  
+#    Returns:
+#       A "" (empty) string if everything worked, or an error message
+#       if there was a problem.
+proc scripted_test {tool test args expected_output} {
+    global text
+
+    set timeoutmsg "Timed out: Never got started, "
+    set timeout 100
+    set file all
+    set timetol 0
+    set arguments ""
+     
+    expect_before buffer_full { perror "Buffer full" }
+
+    if { [llength $args] == 0} {
+        set executable $args
+    } else {
+        set executable [string trimleft [lindex [split $args " "] 0] "\{"]
+        set the_command [string trimleft $args "\{"]
+        set the_command [string trimright $the_command "\}"]
+    }
+
+    verbose "The executable is $executable" 2
+    if ![file exists ${executable}] {
+        perror "The executable \"$executable\" is missing" 0
+        return "No source file found"
+    }
+
+    # spawn the executable and look for the DejaGnu output messages from the
+    # test case.
+    # spawn -noecho -open [open "|./${executable}" "r"]
+    eval "spawn -noecho $the_command"
+    expect {
+        -re $expected_output {
+            # Tells dejagnu that the test has passed.
+            pass "$test"
+        }
+        default {
+            # Displays the output from the shell script.
+            puts "*** last lines of test output:"
+            puts $expect_out(buffer)
+            # Display expected output.
+            puts "*** expected $expected_output"
+            # Displays 'failed' message to user, and tells dejagnu that the
+            # test has failed.
+            fail "See $tool.log for details.";
+        }
+        timeout {
+            warning "Timed out executing test case"
+            if { $timetol <= 2 } {
+                incr timetol
+                exp_continue
+            } else {
+-               catch close
+                return "Timed out executing test case"
+            }
+        }
+    }
+
+    # force a close of the executable to be safe.
+    catch close
+    return ""
+}
+
Index: avida/current/source/main/functional_testsuites/default.md5sum/analyze.cfg
diff -u /dev/null avida/current/source/main/functional_testsuites/default.md5sum/analyze.cfg:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.md5sum/analyze.cfg	Fri Oct  3 14:48:16 2003
@@ -0,0 +1,9 @@
+#############################################################################
+# This file is used to setup avida when it is in analysis-only mode (by
+# running "avida -a".  It allows variety of methods to load organisms
+# (specifying the type of each) and analyze them once loaded.
+#
+# See the documentation in doc/analyze_mode.html for usage, or the file
+# doc/analyze_samples.html for guidelines on writing programs.
+#
+#############################################################################
Index: avida/current/source/main/functional_testsuites/default.md5sum/environment.cfg
diff -u /dev/null avida/current/source/main/functional_testsuites/default.md5sum/environment.cfg:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.md5sum/environment.cfg	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,23 @@
+##############################################################################
+#
+# This is the setup file for the task/resource system.  From here, you can
+# setup the available resources (including their inflow and outflow rates) as
+# well as the reactions that the organisms can trigger by performing tasks.
+#
+# This file is currently setup to reward 9 tasks, all of which use the
+# "infinite" resource, which is undepletable.
+#
+# For information on how to use this file, see:  doc/environment.html
+# For other sample environments, see:  source/support/config/ 
+#
+##############################################################################
+
+REACTION  NOT  not   process:value=1.0:type=pow  requisite:max_count=1
+REACTION  NAND nand  process:value=1.0:type=pow  requisite:max_count=1
+REACTION  AND  and   process:value=2.0:type=pow  requisite:max_count=1
+REACTION  ORN  orn   process:value=2.0:type=pow  requisite:max_count=1
+REACTION  OR   or    process:value=3.0:type=pow  requisite:max_count=1
+REACTION  ANDN andn  process:value=3.0:type=pow  requisite:max_count=1
+REACTION  NOR  nor   process:value=4.0:type=pow  requisite:max_count=1
+REACTION  XOR  xor   process:value=4.0:type=pow  requisite:max_count=1
+REACTION  EQU  equ   process:value=5.0:type=pow  requisite:max_count=1
Index: avida/current/source/main/functional_testsuites/default.md5sum/events.cfg
diff -u /dev/null avida/current/source/main/functional_testsuites/default.md5sum/events.cfg:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.md5sum/events.cfg	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,38 @@
+##############################################################################
+#
+# This is the setup file for the events system.  From here, you can
+# configure any actions that you want to have happen during the course of
+# an experiment, including setting the times for data collection.
+#
+# basic syntax:  [trigger]  [start:interval:stop]  [event] [arguments...]
+#
+# This file is currently setup to start off a population full of the 
+# starting organism specified in genesis, and then record key information
+# every 100 updates.
+#
+# For information on how to use this file, see:  doc/events.html
+# For other sample event configurations, see:  source/support/config/
+#
+##############################################################################
+
+# Print all of the standard data files...
+u 0:100 print_dom                 # Save the most abundant genotypes
+u 0:100:end print_average_data    # Save info about they average genotypes
+u 0:100:end print_dominant_data   # Save info about most abundant genotypes
+u 0:100:end print_stats_data      # Collect satistics about entire pop.
+u 0:100:end print_count_data      # Count organisms, genotypes, species, etc.
+u 0:100:end print_tasks_data      # Save organisms counts for each task.
+u 0:100:end print_time_data       # Track time conversion (generations, etc.)
+u 0:100:end print_resource_data   # Track resource abundance.
+
+# A few data files not printed by default
+# u 100:100:end print_error_data      # Std. Error on averages.
+# u 100:100:end print_variance_data   # Variance on averages.
+# u 100:100:end print_totals_data     # Total counts over entire run.
+# u 100:100:end print_tasks_exe_data  # Num. times tasks have been executed.
+
+# Setup the exit time and full population data collection.
+u 100:100 detail_pop           # Save current state of population.
+u 100:100 dump_historic_pop    # Save ancestors of current population.
+u 100 exit                      # exit
+
Index: avida/current/source/main/functional_testsuites/default.md5sum/genesis
diff -u /dev/null avida/current/source/main/functional_testsuites/default.md5sum/genesis:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.md5sum/genesis	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,165 @@
+#############################################################################
+# This file includes all the basic run-time defines for avida.
+# For more information, see doc/genesis.html
+#############################################################################
+
+VERSION_ID 2.0b6		# Do not change this value!
+
+### Architecture Variables ###
+MAX_UPDATES  -1         # Maximum updates to run simulation (-1 = no limit)
+MAX_GENERATIONS -1      # Maximum generations to run simulation (-1 = no limit)
+END_CONDITION_MODE 0	# End run when ...
+			# 0 = MAX_UPDATES _OR_ MAX_GENERATIONS is reached
+			# 1 = MAX_UPDATES _AND_ MAX_GENERATIONS is reached
+WORLD-X 20		# Width of the world in Avida mode.
+WORLD-Y 20		# Height of the world in Avida mode.
+WORLD_GEOMETRY 2        # 1 = Bounded Grid
+                        # 2 = Torus (Default)
+RANDOM_SEED 1		# Random number seed. (0 for based on time)
+HARDWARE_TYPE 0		# 0 = Original CPUs
+			# 1 = New, Stack-based CPUs
+MAX_CPU_THREADS 1	# Number of Threads CPUs can spawn
+
+### Configuration Files ###
+DEFAULT_DIR ../work/              # Directory in which config files are found
+INST_SET inst_set.default         # File containing instruction set
+EVENT_FILE events.cfg             # File containing list of events during run
+ANALYZE_FILE analyze.cfg          # File used for analysis mode
+ENVIRONMENT_FILE environment.cfg  # File that describes the environment
+START_CREATURE organism.default   # Organism to seed the soup
+
+### Reproduction ###
+BIRTH_METHOD 4    # 0 = Replace random organism in neighborhood
+		  # 1 = Replace oldest organism in neighborhood
+		  # 2 = Replace largest Age/Merit in neighborhood
+		  # 3 = Place only in empty cells in neighborhood
+		  # 4 = Replace random from entire population (Mass Action)
+		  # 5 = Replace oldest in entire population (like Tierra)
+DEATH_METHOD 0    # 0 = Never die of old age.
+		  # 1 = Die when inst executed = AGE_LIMIT (with deviation)
+		  # 2 = Die when inst executed = length * AGE_LIMIT (+ dev.)
+AGE_LIMIT 5000    # Modifies DEATH_METHOD
+AGE_DEVIATION 0   # Modified DEATH_METHOD
+ALLOC_METHOD 0    # 0 = Allocated space is set to default instruction.
+                  # 1 = Set to section of dead genome (Necrophilia)
+                  # 2 = Allocated space is set to random instruction.
+DIVIDE_METHOD 1   # 0 = Divide leaves state of mother untouched.
+                  # 1 = Divide resets state of mother
+                  #     (after the divide, we have 2 children)
+
+GENERATION_INC_METHOD 1 # 0 = Only the generation of the child is
+                        #     increased on divide.
+			# 1 = Both the generation of the mother and child are
+			#     increased on divide (good with DIVIDE_METHOD 1).
+
+### Divide Restrictions ####
+CHILD_SIZE_RANGE 2.0	# Maximal differential between child and parent sizes.
+MIN_COPIED_LINES 0.5    # Code fraction which must be copied before divide.
+MIN_EXE_LINES    0.5    # Code fraction which must be executed before divide.
+REQUIRE_ALLOCATE   1    # Is a an allocate required before a divide? (0/1)
+REQUIRED_TASK -1  # Number of task required for successful divide.
+
+### Mutations ###
+
+# mutations that occur during execution..
+POINT_MUT_PROB  0.0     # Mutation rate (per-location per update)
+COPY_MUT_PROB   0.0075  # Mutation rate (per copy).
+
+# mutations that occur on divide...
+INS_MUT_PROB    0.0     # Insertion rate (per site, applied on divide).
+DEL_MUT_PROB    0.0     # Deletion rate (per site, applied on divide).
+DIV_MUT_PROB    0.0     # Mutation rate (per site, applied on divide).
+DIVIDE_MUT_PROB 0.0     # Mutation rate (per divide).
+DIVIDE_INS_PROB 0.05    # Insertion rate (per divide).
+DIVIDE_DEL_PROB 0.05    # Deletion rate (per divide).
+PARENT_MUT_PROB 0.0     # Per-site, in parent, on divide
+
+# heads based mutations
+# READ_SHIFT_PROB   0.0
+# READ INS_PROB     0.0
+# READ_DEL_PROB     0.0
+# WRITE_SHIFT_PROB  0.0
+# WRITE_INS_PROB    0.0
+# WRITE_DEL_PROB    0.0
+
+
+### Mutation reversions ###
+# these slow down avida a lot, and should be set to 0 normally.
+REVERT_FATAL       0.0  # Should any mutations be reverted on birth?
+REVERT_DETRIMENTAL 0.0  #   0.0 to 1.0; Probability of reversion.
+REVERT_NEUTRAL     0.0
+REVERT_BENEFICIAL  0.0
+
+STERILIZE_FATAL       0.0  # Should any mutations clear (kill) the organism?
+STERILIZE_DETRIMENTAL 0.0  #   0.0 to 1.0; Probability of reset.
+STERILIZE_NEUTRAL     0.0
+STERILIZE_BENEFICIAL  0.0
+
+FAIL_IMPLICIT     0	# Should copies that failed *not* due to mutations
+			# be eliminated?
+
+### Time Slicing ###
+AVE_TIME_SLICE 30
+SLICING_METHOD 2	# 0 = CONSTANT: all organisms get default...
+			# 1 = PROBABILISTIC: Run _prob_ proportional to merit.
+			# 2 = INTEGRATED: Perfectly integrated deterministic.
+SIZE_MERIT_METHOD 4	# 0 = off (merit is independent of size)
+			# 1 = Merit proportional to copied size
+			# 2 = Merit prop. to executed size
+			# 3 = Merit prop. to full size
+			# 4 = Merit prop. to min of executed or copied size
+			# 5 = Merit prop. to sqrt of the minimum size
+TASK_MERIT_METHOD 1	# 0 = No task bonuses
+			# 1 = Bonus just equals the task bonus
+THREAD_SLICING_METHOD 0 # 0 = One thread executed per time slice.
+			# 1 = All threads executed each time slice.
+
+MAX_LABEL_EXE_SIZE 1	# Max nops marked as executed when labels are used
+MERIT_TIME 1            # 0 = Merit Calculated when task completed
+		        # 1 = Merit Calculated on Divide
+MAX_NUM_TASKS_REWARDED -1  # -1 = Unlimited
+
+### Genotype Info ###
+THRESHOLD 3		# Number of organisms in a genotype needed for it
+			#   to be considered viable.
+GENOTYPE_PRINT 0	# 0/1 (off/on) Print out all threshold genotypes?
+GENOTYPE_PRINT_DOM 0	# Print out a genotype if it stays dominant for
+                        #   this many updates. (0 = off)
+SPECIES_THRESHOLD 2     # max failure count for organisms to be same species
+SPECIES_RECORDING 0	# 1 = full, 2 = limited search (parent only)
+SPECIES_PRINT 0		# 0/1 (off/on) Print out all species?
+TEST_CPU_TIME_MOD 20    # Time allocated in test CPUs (multiple of length)
+TRACK_MAIN_LINEAGE 1    # Track primary lineage leading to final population?
+
+### Log Files ###
+LOG_CREATURES 0		# 0/1 (off/on) toggle to print file.
+LOG_GENOTYPES 0		# 0 = off, 1 = print ALL, 2 = print threshold ONLY.
+LOG_THRESHOLD 0		# 0/1 (off/on) toggle to print file.
+LOG_SPECIES 0		# 0/1 (off/on) toggle to print file.
+LOG_LANDSCAPE 0		# 0/1 (off/on) toggle to print file.
+
+LOG_LINEAGES 0          # 0/1 (off/on) to log advantageous mutations
+# This one can slow down avida a lot. It is used to get an idea of how
+# often an advantageous mutation arises, and where it goes afterwards.
+# See also LINEAGE_CREATION_METHOD.
+
+LINEAGE_CREATION_METHOD 0
+# Lineage creation options are.  Works only when LOG_LINEAGES is set to 1.
+#   0 = manual creation (on inject, use successive integers as lineage labels).
+#   1 = when a child's (potential) fitness is higher than that of its parent.
+#   2 = when a child's (potential) fitness is higher than max in population.
+#   3 = when a child's (potential) fitness is higher than max in dom. lineage
+#	*and* the child is in the dominant lineage, or (2)
+#   4 = when a child's (potential) fitness is higher than max in dom. lineage
+#	(and that of its own lineage)
+#   5 = same as child's (potential) fitness is higher than that of the
+#       currently dominant organism, and also than that of any organism
+#       currently in the same lineage.
+#   6 = when a child's (potential) fitness is higher than any organism
+#       currently in the same lineage.
+#   7 = when a child's (potential) fitness is higher than that of any
+#       organism in its line of descent
+
+### END ###
+
+
Index: avida/current/source/main/functional_testsuites/default.md5sum/inst_set.default
diff -u /dev/null avida/current/source/main/functional_testsuites/default.md5sum/inst_set.default:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.md5sum/inst_set.default	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,52 @@
+nop-A      1   # a
+nop-B      1   # b
+nop-C      1   # c
+if-n-equ   1   # d
+if-less    1   # e
+pop        1   # f
+push       1   # g
+swap-stk   1   # h
+swap       1   # i 
+shift-r    1   # j
+shift-l    1   # k
+inc        1   # l
+dec        1   # m
+add        1   # n
+sub        1   # o
+nand       1   # p
+IO         1   # q   Puts current contents of register and gets new.
+h-alloc    1   # r   Allocate as much memory as organism can use.
+h-divide   1   # s   Cuts off everything between the read and write heads
+h-copy     1   # t   Combine h-read and h-write
+h-search   1   # u   Search for matching template, set flow head & return info
+               #   #   if no template, move flow-head here, set size&offset=0.
+mov-head   1   # v   Move ?IP? head to flow control.
+jmp-head   1   # w   Move ?IP? head by fixed amount in CX.  Set old pos in CX.
+get-head   1   # x   Get position of specified head in CX.
+if-label   1   # y
+set-flow   1   # z   Move flow-head to address in ?CX? 
+
+#adv-head   1
+#jump-f     1
+#jump-b     1
+#call       1
+#return     1
+#if-bit-1   1
+#get        1
+#put        1
+#h-read     1
+#h-write    1
+#set-head   1
+#search-f   1
+#search-b   1
+
+
+# Works on multiple nops:  pop  push  inc  dec  IO  adv-head 
+
+# What if we add a new head.  Search will return the location of something,
+# and put the new head there.  Then set-head will move another head to that
+# point.  In the case of the copy loop, it only needs to be set once and
+# this will speed up the code quite a bit!
+
+# Search with no template returns current position (abs line number) in
+# genome.
\ No newline at end of file
Index: avida/current/source/main/functional_testsuites/default.md5sum/md5sum.exp
diff -u /dev/null avida/current/source/main/functional_testsuites/default.md5sum/md5sum.exp:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.md5sum/md5sum.exp	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,20 @@
+# Note: the variables 'srcdir', 'subdir', and 'tool' (among others) are
+# preinitialized by dejagnu.
+
+# The default timeout period is 10 seconds but may be set as follows:
+  set timeout 30
+
+# Give this test a name.
+  set test "md5sum demo"
+
+# Set the commandline that performs this test.
+  set SHELLSCRIPT "$srcdir/$subdir/md5sum.sh $srcdir $subdir $AVIDA_BLDDIR/primitive"
+
+# Expected output (regular expression to match the last line of
+# detail_pop.100):
+  set expected_output "46519f71f37290204b73c7fb9584c6b2"
+
+# Launch the test.  Complain if there was a problem launching.
+if { [scripted_test "$tool" "$test" "$SHELLSCRIPT" "$expected_output"] != "" } {
+  perror "failed to spawn \"$SHELLSCRIPT\"." 0
+}
Index: avida/current/source/main/functional_testsuites/default.md5sum/md5sum.sh
diff -u /dev/null avida/current/source/main/functional_testsuites/default.md5sum/md5sum.sh:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.md5sum/md5sum.sh	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,37 @@
+# /bin/sh
+
+# read command-line arguments:
+TESTSUITE_DIR=$1       # path to top directory for test scripts.
+SUBDIR=$2              # subdir of TESTSUITE_DIR containing this script.
+AVIDA_PATH=$3          # path to avida executable.
+
+# specify paths to config files.
+CFG_DIR=$TESTSUITE_DIR/$SUBDIR
+GENESIS_FILE=$CFG_DIR/genesis
+INST_SET=$CFG_DIR/inst_set.default
+EVENT_FILE=$CFG_DIR/events.cfg
+ANALYZE_FILE=$CFG_DIR/analyze.cfg
+ENVIRONMENT_FILE=$CFG_DIR/environment.cfg
+START_CREATURE=$CFG_DIR/organism.default
+
+# make subdirectory for storing avida's output files.
+[ -d $SUBDIR ] || mkdir -p $SUBDIR
+cd $SUBDIR
+
+# run avida, and save all output to avida_run.log.
+$AVIDA_PATH \
+  -genesis $GENESIS_FILE \
+  -set INST_SET $INST_SET \
+  -set EVENT_FILE $EVENT_FILE \
+  -set ANALYZE_FILE $ANALYZE_FILE \
+  -set ENVIRONMENT_FILE $ENVIRONMENT_FILE \
+  -set START_CREATURE $START_CREATURE \
+  2>&1 > avida_run.log
+
+# send the md5sum of detail_pop.100 back to the testdriver for
+# verification.
+echo "md5sum of output file detail_pop.100:"
+md5sum detail_pop.100
+
+# sleeping for one second gives dejagnu/expect time to react.
+sleep 1;
Index: avida/current/source/main/functional_testsuites/default.md5sum/organism.default
diff -u /dev/null avida/current/source/main/functional_testsuites/default.md5sum/organism.default:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.md5sum/organism.default	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,100 @@
+h-alloc    # Allocate space for child
+h-search   # Locate the end of the organism
+nop-C      #
+nop-A      #
+mov-head   # Place write-head at beginning of offspring.
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+h-search   # Mark the beginning of the copy loop
+h-copy     # Do the copy
+if-label   # If we're done copying....
+nop-C      #
+nop-A      #
+h-divide   #    ...divide!
+mov-head   # Otherwise, loop back to the beginning of the copy loop.
+nop-A      # End label.
+nop-B      #
Index: avida/current/source/main/functional_testsuites/default.tail/analyze.cfg
diff -u /dev/null avida/current/source/main/functional_testsuites/default.tail/analyze.cfg:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.tail/analyze.cfg	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,9 @@
+#############################################################################
+# This file is used to setup avida when it is in analysis-only mode (by
+# running "avida -a".  It allows variety of methods to load organisms
+# (specifying the type of each) and analyze them once loaded.
+#
+# See the documentation in doc/analyze_mode.html for usage, or the file
+# doc/analyze_samples.html for guidelines on writing programs.
+#
+#############################################################################
Index: avida/current/source/main/functional_testsuites/default.tail/environment.cfg
diff -u /dev/null avida/current/source/main/functional_testsuites/default.tail/environment.cfg:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.tail/environment.cfg	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,23 @@
+##############################################################################
+#
+# This is the setup file for the task/resource system.  From here, you can
+# setup the available resources (including their inflow and outflow rates) as
+# well as the reactions that the organisms can trigger by performing tasks.
+#
+# This file is currently setup to reward 9 tasks, all of which use the
+# "infinite" resource, which is undepletable.
+#
+# For information on how to use this file, see:  doc/environment.html
+# For other sample environments, see:  source/support/config/ 
+#
+##############################################################################
+
+REACTION  NOT  not   process:value=1.0:type=pow  requisite:max_count=1
+REACTION  NAND nand  process:value=1.0:type=pow  requisite:max_count=1
+REACTION  AND  and   process:value=2.0:type=pow  requisite:max_count=1
+REACTION  ORN  orn   process:value=2.0:type=pow  requisite:max_count=1
+REACTION  OR   or    process:value=3.0:type=pow  requisite:max_count=1
+REACTION  ANDN andn  process:value=3.0:type=pow  requisite:max_count=1
+REACTION  NOR  nor   process:value=4.0:type=pow  requisite:max_count=1
+REACTION  XOR  xor   process:value=4.0:type=pow  requisite:max_count=1
+REACTION  EQU  equ   process:value=5.0:type=pow  requisite:max_count=1
Index: avida/current/source/main/functional_testsuites/default.tail/events.cfg
diff -u /dev/null avida/current/source/main/functional_testsuites/default.tail/events.cfg:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.tail/events.cfg	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,38 @@
+##############################################################################
+#
+# This is the setup file for the events system.  From here, you can
+# configure any actions that you want to have happen during the course of
+# an experiment, including setting the times for data collection.
+#
+# basic syntax:  [trigger]  [start:interval:stop]  [event] [arguments...]
+#
+# This file is currently setup to start off a population full of the 
+# starting organism specified in genesis, and then record key information
+# every 100 updates.
+#
+# For information on how to use this file, see:  doc/events.html
+# For other sample event configurations, see:  source/support/config/
+#
+##############################################################################
+
+# Print all of the standard data files...
+u 0:100 print_dom                 # Save the most abundant genotypes
+u 0:100:end print_average_data    # Save info about they average genotypes
+u 0:100:end print_dominant_data   # Save info about most abundant genotypes
+u 0:100:end print_stats_data      # Collect satistics about entire pop.
+u 0:100:end print_count_data      # Count organisms, genotypes, species, etc.
+u 0:100:end print_tasks_data      # Save organisms counts for each task.
+u 0:100:end print_time_data       # Track time conversion (generations, etc.)
+u 0:100:end print_resource_data   # Track resource abundance.
+
+# A few data files not printed by default
+# u 100:100:end print_error_data      # Std. Error on averages.
+# u 100:100:end print_variance_data   # Variance on averages.
+# u 100:100:end print_totals_data     # Total counts over entire run.
+# u 100:100:end print_tasks_exe_data  # Num. times tasks have been executed.
+
+# Setup the exit time and full population data collection.
+u 100:100 detail_pop           # Save current state of population.
+u 100:100 dump_historic_pop    # Save ancestors of current population.
+u 100 exit                      # exit
+
Index: avida/current/source/main/functional_testsuites/default.tail/genesis
diff -u /dev/null avida/current/source/main/functional_testsuites/default.tail/genesis:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.tail/genesis	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,165 @@
+#############################################################################
+# This file includes all the basic run-time defines for avida.
+# For more information, see doc/genesis.html
+#############################################################################
+
+VERSION_ID 2.0b6		# Do not change this value!
+
+### Architecture Variables ###
+MAX_UPDATES  -1         # Maximum updates to run simulation (-1 = no limit)
+MAX_GENERATIONS -1      # Maximum generations to run simulation (-1 = no limit)
+END_CONDITION_MODE 0	# End run when ...
+			# 0 = MAX_UPDATES _OR_ MAX_GENERATIONS is reached
+			# 1 = MAX_UPDATES _AND_ MAX_GENERATIONS is reached
+WORLD-X 20		# Width of the world in Avida mode.
+WORLD-Y 20		# Height of the world in Avida mode.
+WORLD_GEOMETRY 2        # 1 = Bounded Grid
+                        # 2 = Torus (Default)
+RANDOM_SEED 1		# Random number seed. (0 for based on time)
+HARDWARE_TYPE 0		# 0 = Original CPUs
+			# 1 = New, Stack-based CPUs
+MAX_CPU_THREADS 1	# Number of Threads CPUs can spawn
+
+### Configuration Files ###
+DEFAULT_DIR ../work/              # Directory in which config files are found
+INST_SET inst_set.default         # File containing instruction set
+EVENT_FILE events.cfg             # File containing list of events during run
+ANALYZE_FILE analyze.cfg          # File used for analysis mode
+ENVIRONMENT_FILE environment.cfg  # File that describes the environment
+START_CREATURE organism.default   # Organism to seed the soup
+
+### Reproduction ###
+BIRTH_METHOD 4    # 0 = Replace random organism in neighborhood
+		  # 1 = Replace oldest organism in neighborhood
+		  # 2 = Replace largest Age/Merit in neighborhood
+		  # 3 = Place only in empty cells in neighborhood
+		  # 4 = Replace random from entire population (Mass Action)
+		  # 5 = Replace oldest in entire population (like Tierra)
+DEATH_METHOD 0    # 0 = Never die of old age.
+		  # 1 = Die when inst executed = AGE_LIMIT (with deviation)
+		  # 2 = Die when inst executed = length * AGE_LIMIT (+ dev.)
+AGE_LIMIT 5000    # Modifies DEATH_METHOD
+AGE_DEVIATION 0   # Modified DEATH_METHOD
+ALLOC_METHOD 0    # 0 = Allocated space is set to default instruction.
+                  # 1 = Set to section of dead genome (Necrophilia)
+                  # 2 = Allocated space is set to random instruction.
+DIVIDE_METHOD 1   # 0 = Divide leaves state of mother untouched.
+                  # 1 = Divide resets state of mother
+                  #     (after the divide, we have 2 children)
+
+GENERATION_INC_METHOD 1 # 0 = Only the generation of the child is
+                        #     increased on divide.
+			# 1 = Both the generation of the mother and child are
+			#     increased on divide (good with DIVIDE_METHOD 1).
+
+### Divide Restrictions ####
+CHILD_SIZE_RANGE 2.0	# Maximal differential between child and parent sizes.
+MIN_COPIED_LINES 0.5    # Code fraction which must be copied before divide.
+MIN_EXE_LINES    0.5    # Code fraction which must be executed before divide.
+REQUIRE_ALLOCATE   1    # Is a an allocate required before a divide? (0/1)
+REQUIRED_TASK -1  # Number of task required for successful divide.
+
+### Mutations ###
+
+# mutations that occur during execution..
+POINT_MUT_PROB  0.0     # Mutation rate (per-location per update)
+COPY_MUT_PROB   0.0075  # Mutation rate (per copy).
+
+# mutations that occur on divide...
+INS_MUT_PROB    0.0     # Insertion rate (per site, applied on divide).
+DEL_MUT_PROB    0.0     # Deletion rate (per site, applied on divide).
+DIV_MUT_PROB    0.0     # Mutation rate (per site, applied on divide).
+DIVIDE_MUT_PROB 0.0     # Mutation rate (per divide).
+DIVIDE_INS_PROB 0.05    # Insertion rate (per divide).
+DIVIDE_DEL_PROB 0.05    # Deletion rate (per divide).
+PARENT_MUT_PROB 0.0     # Per-site, in parent, on divide
+
+# heads based mutations
+# READ_SHIFT_PROB   0.0
+# READ INS_PROB     0.0
+# READ_DEL_PROB     0.0
+# WRITE_SHIFT_PROB  0.0
+# WRITE_INS_PROB    0.0
+# WRITE_DEL_PROB    0.0
+
+
+### Mutation reversions ###
+# these slow down avida a lot, and should be set to 0 normally.
+REVERT_FATAL       0.0  # Should any mutations be reverted on birth?
+REVERT_DETRIMENTAL 0.0  #   0.0 to 1.0; Probability of reversion.
+REVERT_NEUTRAL     0.0
+REVERT_BENEFICIAL  0.0
+
+STERILIZE_FATAL       0.0  # Should any mutations clear (kill) the organism?
+STERILIZE_DETRIMENTAL 0.0  #   0.0 to 1.0; Probability of reset.
+STERILIZE_NEUTRAL     0.0
+STERILIZE_BENEFICIAL  0.0
+
+FAIL_IMPLICIT     0	# Should copies that failed *not* due to mutations
+			# be eliminated?
+
+### Time Slicing ###
+AVE_TIME_SLICE 30
+SLICING_METHOD 2	# 0 = CONSTANT: all organisms get default...
+			# 1 = PROBABILISTIC: Run _prob_ proportional to merit.
+			# 2 = INTEGRATED: Perfectly integrated deterministic.
+SIZE_MERIT_METHOD 4	# 0 = off (merit is independent of size)
+			# 1 = Merit proportional to copied size
+			# 2 = Merit prop. to executed size
+			# 3 = Merit prop. to full size
+			# 4 = Merit prop. to min of executed or copied size
+			# 5 = Merit prop. to sqrt of the minimum size
+TASK_MERIT_METHOD 1	# 0 = No task bonuses
+			# 1 = Bonus just equals the task bonus
+THREAD_SLICING_METHOD 0 # 0 = One thread executed per time slice.
+			# 1 = All threads executed each time slice.
+
+MAX_LABEL_EXE_SIZE 1	# Max nops marked as executed when labels are used
+MERIT_TIME 1            # 0 = Merit Calculated when task completed
+		        # 1 = Merit Calculated on Divide
+MAX_NUM_TASKS_REWARDED -1  # -1 = Unlimited
+
+### Genotype Info ###
+THRESHOLD 3		# Number of organisms in a genotype needed for it
+			#   to be considered viable.
+GENOTYPE_PRINT 0	# 0/1 (off/on) Print out all threshold genotypes?
+GENOTYPE_PRINT_DOM 0	# Print out a genotype if it stays dominant for
+                        #   this many updates. (0 = off)
+SPECIES_THRESHOLD 2     # max failure count for organisms to be same species
+SPECIES_RECORDING 0	# 1 = full, 2 = limited search (parent only)
+SPECIES_PRINT 0		# 0/1 (off/on) Print out all species?
+TEST_CPU_TIME_MOD 20    # Time allocated in test CPUs (multiple of length)
+TRACK_MAIN_LINEAGE 1    # Track primary lineage leading to final population?
+
+### Log Files ###
+LOG_CREATURES 0		# 0/1 (off/on) toggle to print file.
+LOG_GENOTYPES 0		# 0 = off, 1 = print ALL, 2 = print threshold ONLY.
+LOG_THRESHOLD 0		# 0/1 (off/on) toggle to print file.
+LOG_SPECIES 0		# 0/1 (off/on) toggle to print file.
+LOG_LANDSCAPE 0		# 0/1 (off/on) toggle to print file.
+
+LOG_LINEAGES 0          # 0/1 (off/on) to log advantageous mutations
+# This one can slow down avida a lot. It is used to get an idea of how
+# often an advantageous mutation arises, and where it goes afterwards.
+# See also LINEAGE_CREATION_METHOD.
+
+LINEAGE_CREATION_METHOD 0
+# Lineage creation options are.  Works only when LOG_LINEAGES is set to 1.
+#   0 = manual creation (on inject, use successive integers as lineage labels).
+#   1 = when a child's (potential) fitness is higher than that of its parent.
+#   2 = when a child's (potential) fitness is higher than max in population.
+#   3 = when a child's (potential) fitness is higher than max in dom. lineage
+#	*and* the child is in the dominant lineage, or (2)
+#   4 = when a child's (potential) fitness is higher than max in dom. lineage
+#	(and that of its own lineage)
+#   5 = same as child's (potential) fitness is higher than that of the
+#       currently dominant organism, and also than that of any organism
+#       currently in the same lineage.
+#   6 = when a child's (potential) fitness is higher than any organism
+#       currently in the same lineage.
+#   7 = when a child's (potential) fitness is higher than that of any
+#       organism in its line of descent
+
+### END ###
+
+
Index: avida/current/source/main/functional_testsuites/default.tail/inst_set.default
diff -u /dev/null avida/current/source/main/functional_testsuites/default.tail/inst_set.default:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.tail/inst_set.default	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,52 @@
+nop-A      1   # a
+nop-B      1   # b
+nop-C      1   # c
+if-n-equ   1   # d
+if-less    1   # e
+pop        1   # f
+push       1   # g
+swap-stk   1   # h
+swap       1   # i 
+shift-r    1   # j
+shift-l    1   # k
+inc        1   # l
+dec        1   # m
+add        1   # n
+sub        1   # o
+nand       1   # p
+IO         1   # q   Puts current contents of register and gets new.
+h-alloc    1   # r   Allocate as much memory as organism can use.
+h-divide   1   # s   Cuts off everything between the read and write heads
+h-copy     1   # t   Combine h-read and h-write
+h-search   1   # u   Search for matching template, set flow head & return info
+               #   #   if no template, move flow-head here, set size&offset=0.
+mov-head   1   # v   Move ?IP? head to flow control.
+jmp-head   1   # w   Move ?IP? head by fixed amount in CX.  Set old pos in CX.
+get-head   1   # x   Get position of specified head in CX.
+if-label   1   # y
+set-flow   1   # z   Move flow-head to address in ?CX? 
+
+#adv-head   1
+#jump-f     1
+#jump-b     1
+#call       1
+#return     1
+#if-bit-1   1
+#get        1
+#put        1
+#h-read     1
+#h-write    1
+#set-head   1
+#search-f   1
+#search-b   1
+
+
+# Works on multiple nops:  pop  push  inc  dec  IO  adv-head 
+
+# What if we add a new head.  Search will return the location of something,
+# and put the new head there.  Then set-head will move another head to that
+# point.  In the case of the copy loop, it only needs to be set once and
+# this will speed up the code quite a bit!
+
+# Search with no template returns current position (abs line number) in
+# genome.
\ No newline at end of file
Index: avida/current/source/main/functional_testsuites/default.tail/organism.default
diff -u /dev/null avida/current/source/main/functional_testsuites/default.tail/organism.default:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.tail/organism.default	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,100 @@
+h-alloc    # Allocate space for child
+h-search   # Locate the end of the organism
+nop-C      #
+nop-A      #
+mov-head   # Place write-head at beginning of offspring.
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+h-search   # Mark the beginning of the copy loop
+h-copy     # Do the copy
+if-label   # If we're done copying....
+nop-C      #
+nop-A      #
+h-divide   #    ...divide!
+mov-head   # Otherwise, loop back to the beginning of the copy loop.
+nop-A      # End label.
+nop-B      #
Index: avida/current/source/main/functional_testsuites/default.tail/tail.exp
diff -u /dev/null avida/current/source/main/functional_testsuites/default.tail/tail.exp:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.tail/tail.exp	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,20 @@
+# Note: the variables 'srcdir', 'subdir', and 'tool' (among others) are
+# preinitialized by dejagnu.
+
+# The default timeout period is 10 seconds but may be set as follows:
+  set timeout 30
+
+# Give this test a name.
+  set test "tail demo"
+
+# Set the commandline that performs this test.
+  set SHELLSCRIPT "$srcdir/$subdir/tail.sh $srcdir $subdir $AVIDA_BLDDIR/primitive"
+
+# Expected output (regular expression to match the last line of
+# detail_pop.100):
+  set expected_output "55 49 24 1 1 99 0 0 0 100 -1 2 cccccccccccccccccccccccccccccccccccccccccutycusvabrucavcccccccccccccccccccccccccccccccccccccccccccc"
+
+# Launch the test.  Complain if there was a problem launching.
+if { [scripted_test "$tool" "$test" "$SHELLSCRIPT" "$expected_output"] != "" } {
+  perror "failed to spawn \"$SHELLSCRIPT\"." 0
+}
Index: avida/current/source/main/functional_testsuites/default.tail/tail.sh
diff -u /dev/null avida/current/source/main/functional_testsuites/default.tail/tail.sh:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/functional_testsuites/default.tail/tail.sh	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,37 @@
+# /bin/sh
+
+# read command-line arguments:
+TESTSUITE_DIR=$1       # path to top directory for test scripts.
+SUBDIR=$2              # subdir of TESTSUITE_DIR containing this script.
+AVIDA_PATH=$3          # path to avida executable.
+
+# specify paths to config files.
+CFG_DIR=$TESTSUITE_DIR/$SUBDIR
+GENESIS_FILE=$CFG_DIR/genesis
+INST_SET=$CFG_DIR/inst_set.default
+EVENT_FILE=$CFG_DIR/events.cfg
+ANALYZE_FILE=$CFG_DIR/analyze.cfg
+ENVIRONMENT_FILE=$CFG_DIR/environment.cfg
+START_CREATURE=$CFG_DIR/organism.default
+
+# make subdirectory for storing avida's output files.
+[ -d $SUBDIR ] || mkdir -p $SUBDIR
+cd $SUBDIR
+
+# run avida, and save all output to avida_run.log.
+$AVIDA_PATH \
+  -genesis $GENESIS_FILE \
+  -set INST_SET $INST_SET \
+  -set EVENT_FILE $EVENT_FILE \
+  -set ANALYZE_FILE $ANALYZE_FILE \
+  -set ENVIRONMENT_FILE $ENVIRONMENT_FILE \
+  -set START_CREATURE $START_CREATURE \
+  2>&1 > avida_run.log
+
+# send the last line of detail_pop.100 back to the testdriver for
+# verification.
+echo "last line of output file detail_pop.100:"
+tail -n 1 detail_pop.100
+
+# sleeping for one second gives dejagnu/expect time to react.
+sleep 1;
Index: avida/current/source/main/unit_testsuites/Makefile.am
diff -u /dev/null avida/current/source/main/unit_testsuites/Makefile.am:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/unit_testsuites/Makefile.am	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,13 @@
+AUTOMAKE_OPTIONS = dejagnu
+TESTSUITES =
+EXTRA_DIST = dejagnu.h
+
+EXTRA_DIST += demo.hello
+noinst_PROGRAMS = hello
+hello_SOURCES = demo.hello/hello.cc
+if DEFAULT_TESTS
+TESTSUITES += demo
+endif
+
+DEJATOOL = $(TESTSUITES)
+AM_RUNTESTFLAGS = AVIDA_BLDDIR=`pwd`/..
Index: avida/current/source/main/unit_testsuites/dejagnu.h
diff -u /dev/null avida/current/source/main/unit_testsuites/dejagnu.h:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/unit_testsuites/dejagnu.h	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,292 @@
+/* 
+ *   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __DEJAGNU_H__
+#define __DEJAGNU_H__
+
+#include <stdio.h>
+#include <stdarg.h> 
+#include <string.h>
+
+/* If you have problems with dejagnu dropping failed, untested, or 
+ * unresolved messages generated by a unit testcase, 
+ */
+
+/* #define _DEJAGNU_WAIT_ 
+ */
+
+#ifdef _DEJAGNU_WAIT_
+#      include <sys/time.h>
+#      include <sys/types.h>
+#      include <unistd.h>
+#endif
+
+#define _BUFFER_SIZE_ 512
+
+static int passed;
+static int failed;
+static int untest;
+static int unresolve;
+
+static char buffer[ _BUFFER_SIZE_ ];
+
+#ifdef _DEJAGNU_WAIT_
+void
+wait(void) {
+       fd_set rfds;
+       struct timeval tv;
+
+       FD_ZERO(&rfds);
+       tv.tv_sec = 0;
+       tv.tv_usec = 1;
+
+       select(0, &rfds, NULL, NULL, &tv);
+}
+#endif
+
+inline void
+pass (const char* fmt, ... ) {
+	va_list ap;
+	
+    passed++;
+	va_start( ap, fmt );
+	vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
+	va_end( ap );
+    printf ("\tPASSED: %s\n", buffer );
+#ifdef _DEJAGNU_WAIT_
+       wait();
+#endif
+}
+
+inline void
+fail (const char* fmt, ... ) {
+	va_list ap;
+
+    failed++;
+	va_start( ap, fmt );
+	vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
+	va_end( ap );
+    printf ("\tFAILED: %s\n", buffer );
+#ifdef _DEJAGNU_WAIT_
+       wait();
+#endif
+}
+
+inline void
+untested (const char* fmt, ... ) {
+	va_list ap;
+
+    untest++;
+	va_start( ap, fmt );
+	vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
+	va_end( ap );
+    printf ("\tUNTESTED: %s\n", buffer );
+#ifdef _DEJAGNU_WAIT_
+       wait();
+#endif
+}
+
+inline void
+unresolved (const char* fmt, ... ) {
+	va_list ap;
+
+    unresolve++;
+	va_start( ap, fmt );
+	vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
+	va_end( ap );
+    printf ("\tUNRESOLVED: %s\n", buffer );
+#ifdef _DEJAGNU_WAIT_
+       wait();
+#endif
+}
+
+inline void
+note (const char* fmt, ... ) {
+	va_list ap;
+
+	va_start( ap, fmt );
+	vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
+	va_end( ap );
+    printf ("\tNOTE: %s\n", buffer );
+#ifdef _DEJAGNU_WAIT_
+       wait();
+#endif
+}
+
+inline void
+totals (void) {
+    printf ("\nTotals:\n");
+    printf ("\t#passed:\t\t%d\n", passed);
+    printf ("\t#failed:\t\t%d\n", failed);
+    if (untest)
+        printf ("\t#untested:\t\t%d\n", untest);
+    if (unresolve)
+        printf ("\t#unresolved:\t\t%d\n", unresolved);
+}
+
+#ifdef __cplusplus
+
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <string>
+#if 0
+#ifdef __STDC___
+#include <sstream>
+#else
+#include <strstream>
+#endif
+#endif
+
+const char *outstate_list[] = {
+    "FAILED: ",
+    "PASSED: ",
+    "UNTESTED: ",
+    "UNRESOLVED: "
+};
+
+const char ** outstate = outstate_list;
+
+#if 0
+extern ios& __iomanip_testout (ios&, int);
+inline smanip<int> testout (int n) {
+    return smanip<int> (__iomanip_testout, n);
+}
+ios & __iomanip_testout (ios& i, int x) {
+    return i;
+}
+
+template<class T>
+class OMANIP {
+ private:
+    T i;
+    ostream &(*f)(ostream&, T);
+ public:
+    OMANIP(ostream& (*ff)(ostream&, T), T ii) : f(ff), i(ii) {
+    }
+    friend ostream operator<<(ostream& us, OMANIP& m) {
+      return m.f(os,m.i);
+    }
+};
+
+ostream&
+freakout(ostream& os, int x) {
+    return os << "FREAKOUT" ;
+//    return x << "TESTOUT " << x ;
+}
+
+OMANIP<int> testout(int i) {
+    return OMANIP<int>(&freakout,i);
+}
+#endif
+
+enum teststate {FAILED, PASSED,UNTESTED,UNRESOLVED} laststate;
+
+class TestState {
+ private:
+    teststate laststate;
+    std::string lastmsg;
+ public:
+    TestState(void) {
+        passed = 0;
+        failed = 0;
+        untest = 0;
+        unresolve = 0;
+    }
+    ~TestState(void) {
+        totals();
+    };
+
+    void testrun (bool b, std::string s) {
+        if (b)
+            pass (s);
+        else
+            fail (s);
+    }
+
+    void pass (std::string s) {
+        passed++;
+        laststate = PASSED;
+        lastmsg = s;
+        std::cout << "\t" << outstate[PASSED] << s << std::endl;
+    }
+    void pass (const char *c) {
+        std::string s = c;
+        pass (s);
+    }
+
+    void fail (std::string s) {
+        failed++;
+        laststate = FAILED;
+        lastmsg = s;
+        std::cout << "\t" << outstate[FAILED] << s << std::endl;
+    }
+    void fail (const char *c) {
+        std::string s = c;
+        fail (s);
+    }
+
+    void untested (std::string s) {
+        untest++;
+        laststate = UNTESTED;
+        lastmsg = s;
+        std::cout << "\t" << outstate[UNTESTED] << s << std::endl;
+    }
+    void untested (const char *c) {
+        std::string s = c;
+        untested (s);
+    }
+
+    void unresolved (std::string s) {
+        unresolve++;
+        laststate = UNRESOLVED;
+        lastmsg = s;
+        std::cout << "\t" << outstate[UNRESOLVED] << s << std::endl;
+    }
+    void unresolved (const char *c) {
+        std::string s = c;
+        unresolved (s);
+    }
+
+    void totals (void) {
+        std::cout << "\t#passed:\t\t" << passed << std::endl;
+        std::cout << "\t#failed:\t\t" << failed << std::endl;
+        if (untest)
+            std::cout << "\t#untested:\t\t" << untest << std::endl;
+        if (unresolve)
+            std::cout << "\t#unresolved:\t\t" << unresolve << std::endl;
+    }
+
+    // This is so this class can be printed in an ostream.
+    friend std::ostream & operator << (std::ostream &os, TestState& t) {
+        return os << "\t" << outstate[t.laststate] << t.lastmsg ;
+    }
+
+    int GetState(void) {
+        return laststate;
+    }
+    std::string GetMsg(void) {
+        return lastmsg;
+    }
+};
+
+#endif		// __cplusplus
+#endif          // _DEJAGNU_H_
+
+
Index: avida/current/source/main/unit_testsuites/config/unix.exp
diff -u /dev/null avida/current/source/main/unit_testsuites/config/unix.exp:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/unit_testsuites/config/unix.exp	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,170 @@
+# a hairy pattern to recognize text
+set text "\[- A-Za-z0-9\.\;\"\_\:\'\`\(\)\!\#\=\+\?\&\*]"
+
+# Execute the executable file, and analyse the output for the 
+# test state keywords.
+#    Returns:
+#       A "" (empty) string if everything worked, or an error message
+#       if there was a problem.
+proc executable_test {tool args} {
+    global text
+
+    set timeoutmsg "Timed out: Never got started, "
+    set timeout 100
+    set file all
+    set timetol 0
+    set arguments ""
+    
+    expect_before buffer_full { perror "Buffer full" }
+    
+    if { [llength $args] == 0} {
+        set executable $args
+    } else {
+        set executable [string trimleft [lindex [split $args " "] 0] "\{"]
+        set the_command [string trimleft $args "\{"]
+        set the_command [string trimright $the_command "\}"]
+    }
+
+    verbose "The executable is $executable" 2
+    if ![file exists ${executable}] {
+        perror "The executable \"$executable\" is missing" 0
+        return "No source file found"
+    }
+
+    # spawn the executable and look for the DejaGnu output messages from the
+    # test case.
+    # spawn -noecho -open [open "|./${executable}" "r"]
+    eval "spawn -noecho $the_command"
+    expect {
+        -re "\[0-9\]\[0-9\]:..:..:${text}\r\n" {
+            regsub "\[\n\r\t\]*NOTE: $text\r\n" $expect_out(0,string) "" output
+            verbose "$output" 3
+            set timetol 0
+            exp_continue
+        }
+        -re "NOTE:${text}*" {
+            regsub "\[\n\r\t\]*NOTE: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 6 end]
+            verbose "$output" 2
+            set timetol 0
+            exp_continue
+        }
+        -re "PASSED:${text}*" {
+            regsub "\[\n\r\t\]*PASSED: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 8 end]
+            pass "$output"
+            set timetol 0
+            exp_continue
+        }
+        -re "FAILED:${text}*" {
+            regsub "\[\n\r\t\]*FAILED: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 8 end]
+            fail "$output (See $tool.log for details.)"
+            set timetol 0
+            exp_continue
+        }
+        -re "UNTESTED:${text}*" {
+            regsub "\[\n\r\t\]*UNTESTED: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 10 end]
+            untested "$output"
+            set timetol 0
+            exp_continue
+        }
+        -re "UNRESOLVED:${text}*" {
+            regsub "\[\n\r\t\]*UNRESOLVED: $text\r\n" $expect_out(0,string) "" output
+            set output [string range $output 12 end]
+            unresolved "$output"
+            set timetol 0
+            exp_continue
+        }
+        -re "Totals" {
+            verbose "All done" 2
+        }
+        eof {
+#           unresolved "${executable} died prematurely"
+#           catch close
+#           return "${executable} died prematurely"
+        }
+        timeout {
+            warning "Timed out executing test case"
+            if { $timetol <= 2 } {
+                incr timetol
+                exp_continue
+            } else {
+-               catch close
+                return "Timed out executing test case"
+            }
+        }
+    }
+
+    # force a close of the executable to be safe.
+    catch close
+    return ""
+}
+
+# Execute the executable file, and analyse the output for the 
+# expected last line.  
+#    Returns:
+#       A "" (empty) string if everything worked, or an error message
+#       if there was a problem.
+proc scripted_test {tool test args expected_output} {
+    global text
+
+    set timeoutmsg "Timed out: Never got started, "
+    set timeout 100
+    set file all
+    set timetol 0
+    set arguments ""
+     
+    expect_before buffer_full { perror "Buffer full" }
+
+    if { [llength $args] == 0} {
+        set executable $args
+    } else {
+        set executable [string trimleft [lindex [split $args " "] 0] "\{"]
+        set the_command [string trimleft $args "\{"]
+        set the_command [string trimright $the_command "\}"]
+    }
+
+    verbose "The executable is $executable" 2
+    if ![file exists ${executable}] {
+        perror "The executable \"$executable\" is missing" 0
+        return "No source file found"
+    }
+
+    # spawn the executable and look for the DejaGnu output messages from the
+    # test case.
+    # spawn -noecho -open [open "|./${executable}" "r"]
+    eval "spawn -noecho $the_command"
+    expect {
+        -re $expected_output {
+            # Tells dejagnu that the test has passed.
+            pass "$test"
+        }
+        default {
+            # Displays the output from the shell script.
+            puts "*** last lines of test output:"
+            puts $expect_out(buffer)
+            # Display expected output.
+            puts "*** expected $expected_output"
+            # Displays 'failed' message to user, and tells dejagnu that the
+            # test has failed.
+            fail "See $tool.log for details.";
+        }
+        timeout {
+            warning "Timed out executing test case"
+            if { $timetol <= 2 } {
+                incr timetol
+                exp_continue
+            } else {
+-               catch close
+                return "Timed out executing test case"
+            }
+        }
+    }
+
+    # force a close of the executable to be safe.
+    catch close
+    return ""
+}
+
Index: avida/current/source/main/unit_testsuites/demo.hello/hello.cc
diff -u /dev/null avida/current/source/main/unit_testsuites/demo.hello/hello.cc:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/unit_testsuites/demo.hello/hello.cc	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,17 @@
+#ifndef __DEJAGNU_H__
+#include "../dejagnu.h"
+#endif
+
+using namespace std;
+
+int main(int argc, char *argv[]){
+  TestState test;
+  for(int i = 0; i < argc; i++) cout << argv[i] << " ";
+  cout << endl;
+  test.pass("pass message.");
+  //test.fail("fail message.");
+  //test.untested("untested message.");
+  //test.unresolved("untested message.");
+  //test.totals();
+  sleep(1);
+}
Index: avida/current/source/main/unit_testsuites/demo.hello/hello.exp
diff -u /dev/null avida/current/source/main/unit_testsuites/demo.hello/hello.exp:1.2
--- /dev/null	Fri Oct  3 14:48:18 2003
+++ avida/current/source/main/unit_testsuites/demo.hello/hello.exp	Fri Oct  3 14:48:17 2003
@@ -0,0 +1,17 @@
+# Note: the variables 'srcdir', 'subdir', and 'tool' (among others) are
+# preinitialized by dejagnu.
+
+# The default timeout period is 10 seconds but may be set as follows:
+  set timeout 10
+
+# Give this test a name.
+  set test "hello demo"
+
+# Set the commandline that performs this test.
+  set COMMAND "./hello there, how are you?"
+
+# Launch the test.  Complain if there was a problem launching.
+if { [executable_test "$tool" "$COMMAND"] != "" } {
+  perror "failed to spawn \"$COMMAND\"." 0
+}
+


More information about the Avida-cvs mailing list