-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Python module testing and cleanup memory leaks (#26353)
Make more of the Python package module tests run more frequently. While doing this, I also cleaned up as many of the Python memory leaks in the Python module as I could find. Some of the tests rely on external Python dependencies like torch and numba. Previously, these tests were always skipped and a "compileOnly" version was tested. This PR adds a step to the skipif to install the dependencies locally if they are missing. This allows the tests to actually be executed in more cases This PR also adds support for checking for unfree'ed references, controlled by the `--pyMemLeaks` flag. This relies on an external python dependency, so this uses similar external Python dependencies testing support as above Testing - [x] `start_test test/library/packages/Python` - [x] `start_test -memleaks test/library/packages/Python` Future Work: - remove global `toFree` list [Reviewed by @DanilaFe]
- Loading branch information
Showing
54 changed files
with
385 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
__pycache__ | ||
python_libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
__pycache__ | ||
python_libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# if CHPL_TEST_VENV_DIR is set and not none, make sure to set VIRTUAL_ENV to match | ||
if [ -n "$CHPL_TEST_VENV_DIR" ] && [ "$CHPL_TEST_VENV_DIR" != "none" ]; then | ||
echo "VIRTUAL_ENV=$CHPL_TEST_VENV_DIR" | ||
fi | ||
|
||
# make sure to add the libs dir to the PYTHONPATH if it exists | ||
FILE_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) ; pwd) | ||
MY_LIB_DIR=$FILE_DIR/python_libs | ||
if [ -d "$MY_LIB_DIR" ]; then | ||
echo "PYTHONPATH=$MY_LIB_DIR:$PYTHONPATH" | ||
fi | ||
|
||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../CLEANFILES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../COMPOPTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../EXECENV |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../CLEANFILES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../EXECENV | ||
../../EXECENV |
16 changes: 2 additions & 14 deletions
16
test/library/packages/Python/examples/bs4/findLinks.skipif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
# respect CHPL_TEST_VENV_DIR if it is set and not none | ||
if [ -n "$CHPL_TEST_VENV_DIR" ] && [ "$CHPL_TEST_VENV_DIR" != "none" ]; then | ||
chpl_python=$CHPL_TEST_VENV_DIR/bin/python3 | ||
else | ||
chpl_python=$($CHPL_HOME/util/config/find-python.sh) | ||
fi | ||
|
||
# try and import bs4, if it fails, skip the test | ||
if ! $chpl_python -c "import bs4" &>/dev/null; then | ||
echo "True" | ||
else | ||
echo "False" | ||
fi | ||
FILE_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) ; pwd) | ||
$FILE_DIR/../../skipIfAndInstallPackage.sh $FILE_DIR bs4 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.