From 3a884f5c9b67e2e1d09762c36bcab44d81c44865 Mon Sep 17 00:00:00 2001 From: Benoit Chevallier-Mames Date: Tue, 8 Aug 2023 11:47:42 +0200 Subject: [PATCH] test(frontend): add a --patch option to ML tests to test the removal of workarounds, or the use of new Concrete features closes #442 --- ci/scripts/test_cml.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/ci/scripts/test_cml.sh b/ci/scripts/test_cml.sh index d42b2e6d00..17c1a02830 100755 --- a/ci/scripts/test_cml.sh +++ b/ci/scripts/test_cml.sh @@ -12,14 +12,15 @@ function usage() { echo "About ML repository:" echo "--ml_branch Specify the branch of ML repo (default is main)" echo + echo "About patches to apply to ML sources/tests, to test the removal of workarounds:" + echo "--patch patch_diff_file Specify a local patch to apply. Patches are obtained by" + echo " modifying ML files, and then `git diff > patch.diff`" + echo echo "About CP version:" echo "--cp_version x.y.z Install the chosen version of CP" echo "--last_nightly_cp_version Install the last nightly of CP" echo "--use-wheel /path/to/wheel Install CP from this wheel" echo - echo "About the tests to run" - echo "--use_cml_command_line Use exactly commandline by ML team" - echo echo "And the other options" echo "--quick_debug_of_the_script Do not use, unless you debug the script" echo "--python Which python to use (eg, python3.9, default is python)" @@ -52,6 +53,8 @@ ML_BRANCH="main" # Specify wheel's path if we want to install CP from wheel WHEEL="" +PATCH="" + while [ -n "$1" ] do case "$1" in @@ -70,6 +73,11 @@ do CP_VERSION="wheel" ;; + "--patch" ) + shift + PATCH="${1}" + ;; + "--quick_debug_of_the_script" ) DO_QUICK_SCRIPT_DEBUG=1 ;; @@ -102,6 +110,12 @@ do shift done +# The patch is assumed to be local +if [ "$PATCH" != "" ] +then + PATCH="$PWD/$PATCH" +fi + # Directory for tests echo echo "Creating a temporary directory for CML tests" @@ -179,6 +193,14 @@ INSTALLED_CP=`pip freeze | grep "concrete-python"` echo echo "Installed Concrete-Python: ${INSTALLED_CP}" +if [ "$PATCH" != "" ] +then + echo "Applying patch $PATCH" + git apply $PATCH + echo "Modifications in ML repository:" + git diff +fi + # Launch CML tests with pytest (and ignore flaky ones) # As compared to regular `make pytest`, known flaky errors from Concrete ML are simply ignored # and coverage is disabled