From c53f9bcbd9c9572880caad0be32a515df7c8fdd8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 5 Jul 2017 17:27:32 -0700 Subject: [PATCH] Build benchmarks in Test mode for now --- script/benchmark | 47 +++++++++++++++++++------- test/helpers/record_alloc.cc | 1 - tests.gyp | 65 ++++++++++++++++-------------------- 3 files changed, 63 insertions(+), 50 deletions(-) diff --git a/script/benchmark b/script/benchmark index 68d64889..8fa65326 100755 --- a/script/benchmark +++ b/script/benchmark @@ -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 ;; diff --git a/test/helpers/record_alloc.cc b/test/helpers/record_alloc.cc index 9b5cee37..a3f0b49f 100644 --- a/test/helpers/record_alloc.cc +++ b/test/helpers/record_alloc.cc @@ -1,7 +1,6 @@ #include #include #include -#include "bandit/bandit.h" using std::map; using std::set; diff --git a/tests.gyp b/tests.gyp index fbf696f6..5515effb 100644 --- a/tests.gyp +++ b/tests.gyp @@ -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 @@ '