-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16665 from mppf/start-test-missing-venv
Improve error message for start_test with no venv Follow-up to PRs #16644 and #16560. Improve error message for `start_test` with no venv or for a venv that is built without testing support (say, if one runs `make clobber && make docs` and then tries to use `start_test`). Additionally recent changes had broken workflows using `CHPL_TEST_VENV_DIR=none` / `CHPL_TEST_VENV_DIR=<dir> `. This PR improves the situation by adding a script `util/test/run-in-test-venv.bash` that is run from `paratest.server` and from the `start_test`, `sub_test`, and `genGraphs` wrappers. The new script includes the logic previously present in `util/test/activate_chpl_test_venv.py` to work with `CHPL_TEST_VENV_DIR=none` / `CHPL_TEST_VENV_DIR=<dir> `. Reviewed by @ronawho - thanks! - [x] verified expected error from `start_test` - [x] verified expected error from `paratest.server`
- Loading branch information
Showing
9 changed files
with
71 additions
and
12 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
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
# Active the virtual environment and run the command supplied | ||
# usage: ./run-in-test-venv prog [args] | ||
|
||
if [ -z "$CHPL_HOME" ]; then | ||
# compute the chpl home directory | ||
export CHPL_HOME=$(cd $(dirname $0) ; cd ..; cd ..; pwd) | ||
fi | ||
|
||
python=$($CHPL_HOME/util/config/find-python.sh) | ||
venv_dir=$("$python" "$CHPL_HOME/util/chplenv/chpl_home_utils.py" --test-venv) | ||
def_venv_dir=$("$python" "$CHPL_HOME/util/chplenv/chpl_home_utils.py" --venv) | ||
|
||
if [ "$venv_dir" = "none" ] | ||
then | ||
echo "Skipping virtualenv activation because CHPL_TEST_VENV_DIR=$venv_dir."\ | ||
"test-venv requirements must be available." | ||
|
||
else | ||
if [ "$venv_dir" != "$def_venv_dir" ] | ||
then | ||
echo "Using custom virtualenv because CHPL_TEST_VENV_DIR=$venv_dir."\ | ||
"test-venv requirements must be available" | ||
|
||
elif [ ! -f "$venv_dir/chpl-test-reqs" ] | ||
then | ||
make=$("$python" "$CHPL_HOME/util/chplenv/chpl_make.py") | ||
echo "Chapel test virtualenv not available."\ | ||
"Run a top-level $make test-venv" 1>&2 | ||
exit 1 | ||
|
||
fi | ||
|
||
if [ ! -f "$venv_dir/bin/activate" ] | ||
then | ||
echo "Activation file $venv_dir/bin/activate is missing" 1>&2 | ||
exit 1 | ||
|
||
fi | ||
|
||
source "$venv_dir/bin/activate" | ||
|
||
fi | ||
|
||
# now run the command in the (possibly) activated venv | ||
exec "$1" "${@:2}" |
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