Created debug and release build scripts.

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D609
This commit is contained in:
Matej Ferencevic 2017-07-30 10:58:19 +02:00
parent c84d8f6bd7
commit 4a3c029c19
5 changed files with 71 additions and 9 deletions

24
tools/apollo/build_debug Normal file
View File

@ -0,0 +1,24 @@
# WARNING: do not run this script without defining THREADS!
# If THREADS isn't defined then this script will call 'make -j'.
# From the manpage: "If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously."
# That means that the whole build will be started simultaneously and IT WILL CRASH YOUR COMPUTER!
cd ../..
TIMEOUT=600 ./init
bash -c "doxygen Doxyfile >/dev/null 2>/dev/null"
cd build
cmake ..
TIMEOUT=1000 make -j$THREADS
cd ..
mkdir build_release
cd build_release
cmake -DCMAKE_BUILD_TYPE=release ..
TIMEOUT=1000 make -j$THREADS memgraph_link_target
cd ../tools/apollo
./generate debug

View File

@ -3,7 +3,7 @@
# From the manpage: "If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously."
# That means that the whole build will be started simultaneously and IT WILL CRASH YOUR COMPUTER!
cd ..
cd ../..
TIMEOUT=600 ./init
bash -c "doxygen Doxyfile >/dev/null 2>/dev/null"
@ -19,6 +19,6 @@ cd build_release
cmake -DCMAKE_BUILD_TYPE=release ..
TIMEOUT=1000 make -j$THREADS memgraph_link_target
cd ../tools
cd ../tools/apollo
./apollo_generate
./generate diff

View File

@ -0,0 +1,17 @@
# WARNING: do not run this script without defining THREADS!
# If THREADS isn't defined then this script will call 'make -j'.
# From the manpage: "If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously."
# That means that the whole build will be started simultaneously and IT WILL CRASH YOUR COMPUTER!
cd ../..
TIMEOUT=600 ./init
bash -c "doxygen Doxyfile >/dev/null 2>/dev/null"
cd build
cmake -DCMAKE_BUILD_TYPE=release ..
TIMEOUT=1000 make -j$THREADS
cd ../tools/apollo
./generate release

View File

@ -5,8 +5,20 @@ cd "$DIR/../../"
errfile="$DIR/.cppcheck_errors"
files=$( git diff --name-only HEAD~1 HEAD | egrep '^(src|tests|poc)' | egrep '.(hpp|h|cpp)$' )
cppcheck --enable=all --force --suppress=missingInclude -Isrc $files 2>"$errfile"
if [ "$1" == "" ]; then
mode=diff
else
mode=$1
fi
if [ "$mode" == diff ]; then
files=$( git diff --name-only HEAD~1 HEAD | egrep '^(src|tests|poc)' | egrep '.(hpp|h|cpp)$' )
flags=""
else
files=src/
flags="-j$THREADS"
fi
cppcheck --enable=all --force --suppress=missingInclude $flags -Isrc $files 2>"$errfile"
cat "$errfile" >&2

View File

@ -25,8 +25,8 @@ sys.stderr = UnbufferedFile(sys.stderr)
# paths
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
BASE_DIR = os.path.join(*os.path.split(SCRIPT_DIR)[:-1])
WORKSPACE_DIR = os.path.join(*os.path.split(BASE_DIR)[:-1])
BASE_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, "..", ".."))
WORKSPACE_DIR = os.path.normpath(os.path.join(BASE_DIR, ".."))
BASE_DIR_NAME = os.path.basename(BASE_DIR)
BUILD_DIR = os.path.join(BASE_DIR, "build")
TESTS_DIR = os.path.join(BUILD_DIR, "tests")
@ -36,6 +36,12 @@ OUTPUT_DIR = os.path.join(BUILD_DIR, "apollo")
ARCHIVES = []
RUNS = []
# generation mode
if len(sys.argv) >= 2:
mode = sys.argv[1]
else:
mode = "diff"
# helper functions
def run_cmd(cmd, cwd):
ret = subprocess.run(cmd, cwd = cwd, stdout = subprocess.PIPE, check = True)
@ -99,7 +105,7 @@ check_dirs = list(map(lambda x: os.path.join(BASE_DIR, x), ["src", "tests",
archive = create_archive("cppcheck", check_dirs, WORKSPACE_DIR)
cmd = os.path.relpath(cppcheck, WORKSPACE_DIR)
outfile_paths = "\./" + cmd.replace("cppcheck", ".cppcheck_errors").replace(".", "\\.")
RUNS.append(generate_run("cppcheck", commands = './{}'.format(cmd),
RUNS.append(generate_run("cppcheck", commands = './{} {}'.format(cmd, mode),
infile = archive, outfile_paths = outfile_paths))
# ctest tests
@ -173,7 +179,10 @@ RUNS.append(generate_run("quality_assurance", commands = commands,
BASE_DIR_NAME)))
# macro benchmark tests
BUILD_RELEASE_DIR = os.path.join(BASE_DIR, "build_release")
if mode == "release":
BUILD_RELEASE_DIR = os.path.join(BASE_DIR, "build")
else:
BUILD_RELEASE_DIR = os.path.join(BASE_DIR, "build_release")
binary_release_name = run_cmd(["find", ".", "-maxdepth", "1", "-executable",
"-type", "f", "-name", "memgraph*"], BUILD_RELEASE_DIR).split("\n")[0][2:]
binary_release_path = os.path.join(BUILD_RELEASE_DIR, binary_release_name)