Skip to content

Commit

Permalink
scripts: Update run_tests.sh to call functions for different test suites
Browse files Browse the repository at this point in the history
Signed-off-by: Siddharth Chandrasekaran <[email protected]>
  • Loading branch information
sidcha committed Aug 4, 2024
1 parent 82ef13e commit a6a0fa4
Showing 1 changed file with 41 additions and 31 deletions.
72 changes: 41 additions & 31 deletions scripts/run_tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,44 @@ set -e
TEST_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ROOT_DIR="${TEST_DIR}/../"

echo "[-] Running make check"
pushd ${ROOT_DIR}
rm -rf build
./configure.sh -f
make check
popd

echo "[-] Running cmake unit-tests"
rm -rf build && mkdir build && pushd build
cmake ${ROOT_DIR}
make check-ut
popd

echo "[-] Creating an isolated environment.."
pushd ${TEST_DIR}
rm -rf __pycache__/
rm -rf .venv ${ROOT_DIR}/python/{build,dist,libosdp.egg-info,vendor}
python3 -m venv .venv
source ./.venv/bin/activate
pip install --upgrade pip

echo "[-] Installing dependencies.."
pushd "${ROOT_DIR}/tests/pytest"
pip install -r requirements.txt

echo "[-] Installing libosdp.."
pip install "${ROOT_DIR}/python"

echo "[-] Running tests capturing all output.."
pytest -vv --show-capture=all
popd
function run_make_check() {
echo "[-] Running make check"
pushd ${ROOT_DIR}
rm -rf build
./configure.sh -f
make check
popd
}

function run_cmake_unit_test() {
echo "[-] Running cmake unit-tests"
rm -rf build && mkdir build && pushd build
cmake ${ROOT_DIR}
make check-ut
popd
}

function run_pytest() {
echo "[-] Creating an isolated environment.."
pushd ${TEST_DIR}
rm -rf __pycache__/
rm -rf .venv ${ROOT_DIR}/python/{build,dist,libosdp.egg-info,vendor}
python3 -m venv .venv
source ./.venv/bin/activate
pip install --upgrade pip

echo "[-] Installing dependencies.."
pushd "${ROOT_DIR}/tests/pytest"
pip install -r requirements.txt

echo "[-] Installing libosdp.."
pip install "${ROOT_DIR}/python"

echo "[-] Running tests capturing all output.."
pytest -vv --show-capture=all
popd
}

run_make_check
run_cmake_unit_test
run_pytest

0 comments on commit a6a0fa4

Please sign in to comment.