Build benchmarks in Test mode for now

This commit is contained in:
Max Brunsfeld 2017-07-05 17:27:32 -07:00
parent 782bf48772
commit c53f9bcbd9
3 changed files with 63 additions and 50 deletions

View file

@ -2,12 +2,41 @@
set -e
mode=normal
make -j2 benchmarks
cmd=out/release/benchmarks
function usage {
cat <<-EOF
USAGE
while getopts "df:l:SL" option; do
$0 [-Ld] [-l language-name] [-f example-file-name]
OPTIONS
-h print this message
-l run only the benchmarks for the given language
-f run only the benchmarks that parse the file with the given name
-d run tests in a debugger (either lldb or gdb)
-L run benchmarks with parse logging turned on
EOF
}
if [ "$(uname -s)" == "Darwin" ]; then
export LINK="clang++ -fsanitize=address"
fi
mode=normal
export BUILDTYPE=Test
cmd=out/Test/benchmarks
while getopts "dhf:l:SL" option; do
case ${option} in
h)
usage
exit
;;
d)
mode=debug
;;
@ -20,22 +49,16 @@ while getopts "df:l:SL" option; do
L)
export TREE_SITTER_BENCHMARK_LOG=1
;;
S)
mode=SVG
export TREE_SITTER_BENCHMARK_SVG=1
;;
esac
done
make -j2 benchmarks
case $mode in
debug)
lldb $cmd
;;
SVG)
$cmd 2> >(grep -v 'Assertion failed' > test.dot)
;;
normal)
exec $cmd
;;

View file

@ -1,7 +1,6 @@
#include <stdlib.h>
#include <map>
#include <set>
#include "bandit/bandit.h"
using std::map;
using std::set;

View file

@ -18,11 +18,8 @@
'test/helpers/load_language.cc',
'test/helpers/read_test_entries.cc',
'test/helpers/stderr_logger.cc',
'test/helpers/record_alloc.cc',
],
'configurations': {'Test': {}, 'Release': {}},
'default_configuration': 'Release',
'xcode_settings': {'CLANG_CXX_LANGUAGE_STANDARD': 'c++11'},
'cflags_cc': ['-std=c++11'],
},
{
'target_name': 'tests',
@ -45,40 +42,34 @@
'<!@(find test/integration -name "*.cc")',
'<!@(find test/helpers -name "*.cc")',
],
'libraries': [
'-ldl'
],
'default_configuration': 'Test',
'configurations': {'Test': {}, 'Release': {}},
'cflags': [
'-g',
'-O0',
}
],
'target_defaults': {
'default_configuration': 'Test',
'configurations': {'Test': {}, 'Release': {}},
'cflags': [
'-g',
'-O0',
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
'-Wno-unknown-pragmas',
],
'cflags_cc': ['-std=c++14'],
'ldflags': ['-g'],
'libraries': ['-ldl'],
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++14',
'OTHER_LDFLAGS': ['-g'],
'OTHER_CPLUSPLUSFLAGS': ['-fsanitize=address'],
'GCC_OPTIMIZATION_LEVEL': '0',
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'WARNING_CFLAGS': [
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
'-Wno-unknown-pragmas',
'-Wno-unused-parameter'
],
'cflags_c': [
'-std=c99',
],
'cflags_cc': [
'-std=c++14',
],
'ldflags': [
'-g',
],
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++14',
'OTHER_LDFLAGS': ['-g'],
'OTHER_CPLUSPLUSFLAGS': ['-fsanitize=address'],
'GCC_OPTIMIZATION_LEVEL': '0',
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'WARNING_CFLAGS': [
'-Wall',
'-Wextra',
'-Wno-unused-parameter'
],
},
}
]
},
}
}