Skip to content

Commit

Permalink
added temporary memory test script for new translator
Browse files Browse the repository at this point in the history
temporary script memtestn.in (template) tests the expression tests (all)
and the translator tests (currently 1 to 3 only) using the new
translator routine; CMakeLists.txt modified to generate memtestn

this is temporary until the new translator implementation is complete
  • Loading branch information
thunder422 committed Jul 14, 2013
1 parent f965e0f commit 06bd286
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Expand Up @@ -103,6 +103,11 @@ if (NOT WIN32)
"${PROJECT_SOURCE_DIR}/memtest.in"
"${PROJECT_BINARY_DIR}/memtest" @ONLY
)
# TEMPORARY
configure_file(
"${PROJECT_SOURCE_DIR}/memtestn.in"
"${PROJECT_BINARY_DIR}/memtestn" @ONLY
)
endif (NOT WIN32)

# add the binary tree to the search path for include files
Expand Down
67 changes: 67 additions & 0 deletions memtestn.in
@@ -0,0 +1,67 @@
# vim:ts=4:sw=4:filetype=sh:
#
# Interactive BASIC Compiler Project
# File: memtestn - script to run selected tests with new translator
# Copyright (C) 2010-2012 Thunder422
#
# 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 3 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.
#
# For a copy of the GNU General Public License,
# see <http://www.gnu.org/licenses/>.
#
#
# Change History:
#
# 2013-07-13 temporary script (based on memtest.in)
#
#
# Usage:
# regtestn
#
# Details:
# output files are directed to current (IBCP) directory, and then
# comparing to the established output files in the test directory
# reporting any changes as FAIL; also checks for memory issues
# (including memory leaks) and reports a failure if any
#
# Notes:
# memory checking requires the valgrind utility, which is only
# available on Linux
#

rm -f expression*.txt translator*.txt
dir=@ibcp_SOURCE_DIR@/test/
./ibcp -v
for input in ${dir}expression*.dat ${dir}translator0[1-3].dat
do
base=${input##*/}
output=${base%.dat}.txt
memout=${base%.dat}.mem
valgrind --leak-check=full --suppressions=${dir}ibcp.supp ./ibcp -n $input >$output 2>$memout
result=""
cmp -s $dir$output $output
if [ $? -ne 0 ]
then
result=" Results"
fi
errsum=(`grep "ERROR SUMMARY" $memout`)
if [ ${errsum[3]} -ne 0 ]
then
result="$result Memory(${errsum[3]})"
fi
if [ "X$result" == "X" ]
then
result="OK"
else
result="FAIL: $result"
fi
echo Test File $base... $result
done

0 comments on commit 06bd286

Please sign in to comment.