Test build should not proceed if virtualenv creation fails
Currently CMake/GkfsPythonTesting.cmake
relies on the following code to install tests:
install(
CODE "message(\"Install pytest virtual environment...\")"
CODE "message(\"-- Create virtual environment: ${PYTEST_VIRTUALENV}\")"
CODE "execute_process(COMMAND ${Python3_EXECUTABLE} -m venv ${PYTEST_VIRTUALENV})"
CODE "message(\"-- Installing packages...\")"
CODE "execute_process(COMMAND ${PYTEST_VIRTUALENV}/bin/pip install --upgrade pip -v)"
CODE "execute_process(COMMAND ${PYTEST_VIRTUALENV}/bin/pip install -r ${CMAKE_CURRENT_BINARY_DIR}/requirements.txt --upgrade -v)"
)
This has two problems:
- The user is not cleanly notified of an error in the
CODE
chain (e.g. when the virtualenv is created). - The installation proceeds even if a previous step failed (see below).
-- Install configuration: "Debug"
-- Installing: /home/amiranda/var/projects/gekkofs/prefix/bin/gkfs_daemon
-- Set runtime path of "/home/amiranda/var/projects/gekkofs/prefix/bin/gkfs_daemon" to "/home/amiranda/var/projects/gekkofs/prefix/lib"
-- Installing: /home/amiranda/var/projects/gekkofs/prefix/lib/libgkfs_intercept.so
-- Set runtime path of "/home/amiranda/var/projects/gekkofs/prefix/lib/libgkfs_intercept.so" to "/home/amiranda/var/projects/gekkofs/prefix/lib"
-- Installing: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/pytest.ini
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/conftest.py
Install pytest virtual environment...
-- Create virtual environment: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/pytest-venv
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/pytest-venv/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']
-- Installing packages...
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/harness
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/harness/workspace.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/harness/io.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/harness/cli.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/harness/logger.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/harness/reporter.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/harness/cmd.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/harness/gkfs.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/directories
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/directories/test_directories.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/status
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/status/test_status.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/operations
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/operations/test_write_operations.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/operations/test_read_operations.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/position
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/position/test_lseek.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/data
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/data/test_truncate.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/data/test_data_integrity.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/shell
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/shell/test_concat.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/shell/test_cp.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/shell/test_stat.py
-- Up-to-date: /home/amiranda/var/projects/gekkofs/prefix/share/gkfs/tests/integration/shell/test_stat.py.bak
-- Installing: /home/amiranda/var/projects/gekkofs/prefix/bin/gkfs.io
-- Installing: /home/amiranda/var/projects/gekkofs/prefix/bin/tests