Skip to content

Commit

Permalink
chore: add summary
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrery committed Sep 29, 2023
1 parent 49f5aaa commit b49bf6a
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions script/make_utils/run_use_case_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ else
fi
fi

for EXAMPLE in ${LIST_OF_USE_CASES[@]}
declare -a success_examples
declare -a failed_examples

for EXAMPLE in "${LIST_OF_USE_CASES[@]}"
do
EXAMPLE_NAME=$(basename "${EXAMPLE}")

if [ -f "${EXAMPLE}/Makefile" ]; then
echo "*** Processing example ${EXAMPLE_NAME}"
else
if [ ! -f "${EXAMPLE}/Makefile" ]; then
continue
fi

echo "*** Processing example ${EXAMPLE_NAME}"

# Setup a new venv
VENV_PATH="/tmp/virtualenv_${EXAMPLE_NAME}"
if [ -d "$VENV_PATH" ]; then
Expand All @@ -69,6 +72,7 @@ do
if [ $hresult -ne 0 ]; then
echo "Could not install Concrete ML in the virtualenv, see /tmp/log_cml_pip_${EXAMPLE_NAME}"
rm -rf "$VENV_PATH"
failed_examples+=("$EXAMPLE_NAME")
continue
fi
echo " - Concrete ML installed in $VENV_PATH"
Expand All @@ -81,6 +85,7 @@ do
if [ $hresult -ne 0 ]; then
echo "Could not install example requirements in the virtualenv, see /tmp/log_reqs_${EXAMPLE_NAME}"
rm -rf "$VENV_PATH"
failed_examples+=("$EXAMPLE_NAME")
continue
fi
echo " - Requirements installed in $VENV_PATH"
Expand All @@ -100,9 +105,24 @@ do
hresult="${PIPESTATUS[0]}"
if [ "$hresult" -ne 0 ]; then
echo "Error while running example ${EXAMPLE_NAME}"
failed_examples+=("$EXAMPLE_NAME")
else
success_examples+=("$EXAMPLE_NAME")
fi
set -e

# Remove the virtualenv
rm -rf "$VENV_PATH"
done

# Print summary
echo
echo "Summary:"
echo "Successes: ${#success_examples[@]} examples"
for example in "${success_examples[@]}"; do
echo " - $example"
done
echo "Failures: ${#failed_examples[@]} examples"
for example in "${failed_examples[@]}"; do
echo " - $example"
done

0 comments on commit b49bf6a

Please sign in to comment.