Skip to content

Commit

Permalink
Setup scripts for running tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter committed Jul 25, 2024
1 parent 35b7448 commit a828964
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
4 changes: 4 additions & 0 deletions experiment/sapling/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export FUZZER_MACHINE=sapling
export FUZZER_THREADS=20

export CC=gcc CXX=g++
73 changes: 73 additions & 0 deletions experiment/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash

set -e

if [[ -z ${FUZZER_MACHINE} ]]; then
echo "Did you remember to source experiments/MY_MACHINE/env.sh? (For an appropriate value of MY_MACHINE)"
exit 1
fi

function build_legion_config {
config_name="$1"
cmake_build_type="$2"

build_dir="build_${config_name}"
install_dir="$PWD/install_${config_name}"

if [[ -e $build_dir ]]; then
return
fi

mkdir "$build_dir"
pushd "$build_dir"
cmake_flags=(
-DCMAKE_BUILD_TYPE="$cmake_build_type"
-DCMAKE_INSTALL_PREFIX="$install_dir"
-DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_FLAGS_DEBUG='-g -O2' # improve performance of debug code
)
if [[ $cmake_build_type = Debug ]]; then
cmake_flags+=(
-DBUILD_SHARED_LIBS=ON # to improve link speed
-DBUILD_MARCH= # to avoid -march=native for valgrind compatibility
)
fi
cmake "${cmake_flags[@]}" ..
make install -j${FUZZER_THREADS:-4}
popd
}

function build_fuzzer_config {
config_name="$1"
cmake_build_type="$2"

build_dir="build_${config_name}"
legion_install_dir="$PWD/legion/install_${config_name}"

if [[ -e $build_dir ]]; then
return
fi

mkdir "$build_dir"
pushd "$build_dir"
cmake_flags=(
-DCMAKE_BUILD_TYPE="$cmake_build_type"
-DCMAKE_PREFIX_PATH="$legion_install_dir"
-DCMAKE_CXX_FLAGS="-Wall -Werror"
)
cmake "${cmake_flags[@]}" ..
make -j${FUZZER_THREADS:-4}
popd
}

if [[ ! -e legion ]]; then
git clone https://gitlab.com/StanfordLegion/legion.git
fi

pushd legion
build_legion_config debug_single Debug
build_legion_config release_single Release
popd

build_fuzzer_config debug_single RelWithDebInfo
build_fuzzer_config release_single Release

0 comments on commit a828964

Please sign in to comment.