Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
script for detecting memory issues as each of the regression tests are run; requires the valgrind program, which is only available on Linux, so this script is not configured on Windows systems
- Loading branch information
1 parent
1d427d7
commit da0014b
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# vim:ts=4:sw=4:filetype=sh: | ||
# | ||
# Interactive BASIC Compiler Project | ||
# File: memtest - script to run all tests and check for memory issues | ||
# 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: | ||
# | ||
# 2012-10-25 initial release (started from regtest) | ||
# | ||
# | ||
# Usage: | ||
# memtest | ||
# | ||
# 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 parser*.txt expression*.txt translator*.txt | ||
dir=@ibcp_SOURCE_DIR@/test/ | ||
for input in ${dir}parser*.dat ${dir}expression*.dat ${dir}translator*.dat | ||
do | ||
base=${input##*/} | ||
output=${base%.dat}.txt | ||
memout=${base%.dat}.mem | ||
valgrind --leak-check=full ./ibcp -t $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 |