From a8289642cbe924394373540f6c5c84cedd787c3b Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Thu, 25 Jul 2024 11:15:51 -0700 Subject: [PATCH] Setup scripts for running tests. --- experiment/sapling/env.sh | 4 +++ experiment/setup.sh | 73 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 experiment/sapling/env.sh create mode 100755 experiment/setup.sh diff --git a/experiment/sapling/env.sh b/experiment/sapling/env.sh new file mode 100644 index 0000000..f558e43 --- /dev/null +++ b/experiment/sapling/env.sh @@ -0,0 +1,4 @@ +export FUZZER_MACHINE=sapling +export FUZZER_THREADS=20 + +export CC=gcc CXX=g++ diff --git a/experiment/setup.sh b/experiment/setup.sh new file mode 100755 index 0000000..0ac968f --- /dev/null +++ b/experiment/setup.sh @@ -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