Skip to content

Commit 3a5b4dd

Browse files
chore: cleanup cdm unit test scripts
1 parent 2a3d3a3 commit 3a5b4dd

7 files changed

Lines changed: 34 additions & 10 deletions

File tree

docs/PR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This PR delivers comprehensive function and expression generation support
2121
- Closed gaps and resolved issues in the handling of inheritance and attributes.
2222

2323
4. **Significant load performance improvement**
24-
- Load time reduced by approximately 85% (~120 s → ~15 s).
24+
- Load time reduced by approximately 98% (~120 s → ~2 s).
2525
- Mutually recursive elements partitioned into a small cyclic bundle (~6% of CDM types) with the remainder emitted as standalone files
2626

2727
5. **Completion of support for Type Aliases** — type aliases are resolved with flattened naming conventions and collision handling.

python-test/cdm-tests/run_cdm_tests.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ cd ${MY_PATH} || error
1818
PROJECT_ROOT_PATH="$MY_PATH/../.."
1919
PYTHON_SETUP_PATH="$MY_PATH/../env-setup"
2020

21-
22-
source "$MY_PATH/../common.sh" || { echo "Failed to source common.sh"; exit 1; }
21+
source "$MY_PATH/../ensure_jar_exists.sh" || { echo "Failed to source ensure_jar_exists.sh"; exit 1; }
2322

2423

2524
usage() {
@@ -87,12 +86,16 @@ fi
8786

8887
echo "***** setting up common environment"
8988
# source $PYTHON_SETUP_PATH/setup_python_env.sh # Called by setup_cdm_test_env.sh
90-
source $MY_PATH/setup_cdm_test_env.sh || error
89+
_SAVED_MY_PATH="$MY_PATH"
90+
source $MY_PATH/setup/setup_cdm_test_env.sh || error
91+
MY_PATH="$_SAVED_MY_PATH"
92+
unset _SAVED_MY_PATH
9193

9294

9395
# run tests — venv is active at this point; use bare 'python' so the venv's
9496
# interpreter is used, not the system python path cached in $PYEXE
9597
echo "***** run tests"
98+
echo $MY_PATH
9699
python -m pip install pytest
97100
python -m pytest -p no:cacheprovider $MY_PATH
98101
TEST_EXIT_CODE=$?

python-test/cdm-tests/setup/build_cdm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ CDM_VERSION="1.2.3"
5757
cd ${MY_PATH} || error
5858

5959

60-
source "$MY_PATH/../../common.sh" || { echo "Failed to source common.sh"; exit 1; }
60+
source "$MY_PATH/../../ensure_jar_exists.sh" || { echo "Failed to source ensure_jar_exists.sh"; exit 1; }
6161

6262
# Parse command-line arguments
6363
# CDM_BRANCH="master"

python-test/cdm-tests/setup_cdm_test_env.sh renamed to python-test/cdm-tests/setup/setup_cdm_test_env.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,18 @@ fi
4040
MY_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4141
cd ${MY_PATH} || error
4242

43+
# Parse arguments (only meaningful when run directly, not sourced)
44+
KEEP_ENV=0
45+
for arg in "$@"; do
46+
case "$arg" in
47+
-k|--keep-env)
48+
KEEP_ENV=1
49+
;;
50+
esac
51+
done
52+
4353
echo "***** setting up common environment"
44-
PYTHONSETUPPATH="../env-setup"
54+
PYTHONSETUPPATH="../../env-setup"
4555
source $MY_PATH/$PYTHONSETUPPATH/setup_python_env.sh -r
4656

4757
echo "***** activating virtual environment"
@@ -52,7 +62,7 @@ source "$MY_PATH/$PYTHONSETUPPATH/$VENV_PATH/${PY_SCRIPTS}/activate" || error
5262

5363

5464
# install cdm package
55-
PYTHONCDMDIR="../../target/python-cdm"
65+
PYTHONCDMDIR="../../../target/python-cdm"
5666

5767
# Construct pip install command
5868
PIP_ARGS=( "$MY_PATH/$PYTHONCDMDIR"/*-*-py3-none-any.whl "--force-reinstall" "--pre" )
@@ -71,4 +81,15 @@ _reuse_env_saved="${REUSE_ENV:-}"
7181
export REUSE_ENV=1
7282
source "$MY_PATH/$PYTHONSETUPPATH/setup_python_env.sh"
7383
export REUSE_ENV="$_reuse_env_saved"
74-
source "$MY_PATH/$PYTHONSETUPPATH/$VENV_PATH/${PY_SCRIPTS}/activate" || error
84+
source "$MY_PATH/$PYTHONSETUPPATH/$VENV_PATH/${PY_SCRIPTS}/activate" || error
85+
86+
# When run directly (not sourced), clean up unless -k was given
87+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
88+
if [[ $KEEP_ENV -eq 1 ]]; then
89+
echo "***** -k specified: virtual environment kept at $MY_PATH/$PYTHONSETUPPATH/$VENV_PATH"
90+
else
91+
echo "***** cleaning up virtual environment"
92+
deactivate
93+
source "$MY_PATH/$PYTHONSETUPPATH/cleanup_python_env.sh"
94+
fi
95+
fi

python-test/env-setup/setup_python_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ echo "***** Get and Install Runtime"
9999
# If RUNE_RUNTIME_DIR is not specified or the directory does not exist, it will install from GitHub.
100100
# Set RUNE_RUNTIME_REF to control which branch/tag/commit is used (default: main).
101101
# Example: export RUNE_RUNTIME_REF="feature/function_support"
102-
RUNE_RUNTIME_DIR="/Users/dls/projects/rune/rune-python-runtime/FINOS/rune-python-runtime"
102+
RUNE_RUNTIME_DIR="../../../../../rune/rune-python-runtime/FINOS/rune-python-runtime"
103103
RUNE_RUNTIME_REF="feature/function_support"
104104

105105
if [ -n "$RUNE_RUNTIME_DIR" ] && [ -d "$RUNE_RUNTIME_DIR" ]; then

python-test/unit-tests/run_python_unit_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ cd "${MY_PATH}" || error
115115
PROJECT_ROOT_PATH="$MY_PATH/../.."
116116
PYTHON_SETUP_PATH="$MY_PATH/../env-setup"
117117

118-
source "$MY_PATH/../common.sh" || { echo "Failed to source common.sh"; exit 1; }
118+
source "$MY_PATH/../ensure_jar_exists.sh" || { echo "Failed to source ensure_jar_exists.sh"; exit 1; }
119119

120120
JAR_PATH="$PROJECT_ROOT_PATH/target/python-0.0.0.main-SNAPSHOT.jar"
121121

0 commit comments

Comments
 (0)