From 325329545c27e6a4e3150b36cfe685408121a111 Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Tue, 19 Sep 2023 20:47:17 +0200 Subject: [PATCH] Self-review --- testsuite/README.md | 6 +- testsuite/drivers/driver/shared_build.py | 22 ------ testsuite/run.py | 4 +- .../build/hashes/compiler-input/test.yaml | 3 +- .../build/hashes/compiler-missing/test.yaml | 3 +- .../tests/build/hashes/config-types/test.yaml | 3 +- .../build/hashes/hashing-inputs/test.yaml | 3 +- .../build/hashes/incomplete-config/test.yaml | 3 +- testsuite/tests/config/shared-deps/test.yaml | 3 +- .../compiler-installed-shared-build/test.py | 78 ------------------- .../compiler-installed-shared-build/test.yaml | 7 -- .../tests/solver/compiler-installed/test.yaml | 3 - 12 files changed, 16 insertions(+), 122 deletions(-) delete mode 100644 testsuite/drivers/driver/shared_build.py delete mode 100644 testsuite/tests/solver/compiler-installed-shared-build/test.py delete mode 100644 testsuite/tests/solver/compiler-installed-shared-build/test.yaml diff --git a/testsuite/README.md b/testsuite/README.md index 51472b77c..5a212dbe0 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -38,6 +38,6 @@ $ ./run.py # Creating tests All tests are based on running a Python script. There are three test drivers: -- `python-script`: run in host in sandboxed build mode -- `shared-build`: run in host in shared build mode -- `docker-wrapper`: run in a pristine docker Ubuntu image in shared build mode +- `python-script`: run in host in both sandboxed and shared build mode. + - The build mode can be narrowed down with the `build_mode` attribute. +- `docker-wrapper`: run in a pristine docker Ubuntu image in shared build mode. diff --git a/testsuite/drivers/driver/shared_build.py b/testsuite/drivers/driver/shared_build.py deleted file mode 100644 index d8f6f2a88..000000000 --- a/testsuite/drivers/driver/shared_build.py +++ /dev/null @@ -1,22 +0,0 @@ - -from drivers.driver.python_script import PythonScriptDriver -from drivers.alr import run_alr - - -class SharedBuildDriver(PythonScriptDriver): - """ - A specialization of the regular PythonScriptDriver that activates shared - builds for the test. See notes in PythonScriptDriver for more details. - """ - - def run(self): - # Inherited set up - env = self.prepare() - - # Activate shared builds. We must do it this way because the final - # environment doesn't apply to us yet. - run_alr("-c", env["ALR_CONFIG"], - "config", "--global", "--set", "dependencies.shared", "true") - - # Run as inherited - self.run_script(env) diff --git a/testsuite/run.py b/testsuite/run.py index 60ad1d9ed..8254dbbad 100755 --- a/testsuite/run.py +++ b/testsuite/run.py @@ -17,7 +17,6 @@ import e3.testsuite.driver from drivers.driver.docker_wrapper import DockerWrapperDriver from drivers.driver.python_script import PythonScriptDriver -from drivers.driver.shared_build import SharedBuildDriver from drivers.helpers import on_windows @@ -25,8 +24,7 @@ class Testsuite(e3.testsuite.Testsuite): tests_subdir = 'tests' test_driver_map = { 'python-script': PythonScriptDriver, - 'docker-wrapper': DockerWrapperDriver, - 'shared-build': SharedBuildDriver + 'docker-wrapper': DockerWrapperDriver } def add_options(self, parser): diff --git a/testsuite/tests/build/hashes/compiler-input/test.yaml b/testsuite/tests/build/hashes/compiler-input/test.yaml index 08a0a278b..80973aefa 100644 --- a/testsuite/tests/build/hashes/compiler-input/test.yaml +++ b/testsuite/tests/build/hashes/compiler-input/test.yaml @@ -1,4 +1,5 @@ -driver: shared-build +driver: python-script +build_mode: shared indexes: toolchain_index: in_fixtures: true diff --git a/testsuite/tests/build/hashes/compiler-missing/test.yaml b/testsuite/tests/build/hashes/compiler-missing/test.yaml index 4950b52ff..42e4f842f 100644 --- a/testsuite/tests/build/hashes/compiler-missing/test.yaml +++ b/testsuite/tests/build/hashes/compiler-missing/test.yaml @@ -1,3 +1,4 @@ -driver: shared-build +driver: python-script +build_mode: shared indexes: basic_no_compiler_index: {} diff --git a/testsuite/tests/build/hashes/config-types/test.yaml b/testsuite/tests/build/hashes/config-types/test.yaml index f11b337ad..90efa1f5a 100644 --- a/testsuite/tests/build/hashes/config-types/test.yaml +++ b/testsuite/tests/build/hashes/config-types/test.yaml @@ -1,3 +1,4 @@ -driver: shared-build +driver: python-script +build_mode: shared indexes: build_hash_index: {} diff --git a/testsuite/tests/build/hashes/hashing-inputs/test.yaml b/testsuite/tests/build/hashes/hashing-inputs/test.yaml index f11b337ad..90efa1f5a 100644 --- a/testsuite/tests/build/hashes/hashing-inputs/test.yaml +++ b/testsuite/tests/build/hashes/hashing-inputs/test.yaml @@ -1,3 +1,4 @@ -driver: shared-build +driver: python-script +build_mode: shared indexes: build_hash_index: {} diff --git a/testsuite/tests/build/hashes/incomplete-config/test.yaml b/testsuite/tests/build/hashes/incomplete-config/test.yaml index f11b337ad..90efa1f5a 100644 --- a/testsuite/tests/build/hashes/incomplete-config/test.yaml +++ b/testsuite/tests/build/hashes/incomplete-config/test.yaml @@ -1,3 +1,4 @@ -driver: shared-build +driver: python-script +build_mode: shared indexes: build_hash_index: {} diff --git a/testsuite/tests/config/shared-deps/test.yaml b/testsuite/tests/config/shared-deps/test.yaml index f11b337ad..90efa1f5a 100644 --- a/testsuite/tests/config/shared-deps/test.yaml +++ b/testsuite/tests/config/shared-deps/test.yaml @@ -1,3 +1,4 @@ -driver: shared-build +driver: python-script +build_mode: shared indexes: build_hash_index: {} diff --git a/testsuite/tests/solver/compiler-installed-shared-build/test.py b/testsuite/tests/solver/compiler-installed-shared-build/test.py deleted file mode 100644 index e5c16fcab..000000000 --- a/testsuite/tests/solver/compiler-installed-shared-build/test.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -Check that, for generic gnat dependencies, no compilers are installed (only a -locally available one is used). -""" - -import re - -from drivers.alr import run_alr, init_local_crate, alr_with -from drivers.asserts import assert_match, match_solution - -# With no compiler selected, the external compiler in the environment should be -# the only one available. We will verify this and capture its version (which is -# actually the version returned by `make`) for later use - -# Verify only external compiler available -p = run_alr("toolchain") -assert_match(".*\n" # Headers - "gnat_external.*Available.*Detected.*\n", - p.out) - -# Capture version -version = re.search("gnat_external ([0-9.]+)", p.out, re.MULTILINE).group(1) - -print(version) -# When no compiler is selected, since the external one is available, it should -# be used before offering to download a new compiler. - -# Create a crate for our experiments -init_local_crate("xxx") - -# Check that a generic dependency results in the external being used -alr_with("gnat") -match_solution(f"gnat={version} (gnat_external)", escape=True) - -# Check that requesting a version different to the one externally available -# results in missing compiler, as Alire won't try to install one. -alr_with("gnat", delete=True, manual=False) -alr_with(f"gnat/={version}") -match_solution(f"gnat/={version} (direct,hinted)", escape=True) -# Hinted because we know the crate exists as external - -# Now, if the user installs a cross compiler, it will be used - -run_alr("toolchain", "--install", "gnat_cross_2") -run_alr("update") -match_solution("gnat=1.0.0 (gnat_cross_2)", escape=True) - -# Likewise, if we install a native compiler, it will be preferred to a -# cross-compiler. - -run_alr("toolchain", "--install", "gnat_native") -run_alr("update") -match_solution("gnat=8888.0.0 (gnat_native)", escape=True) - -# If we remove the version exclusion, the external compiler will still be -# preferred as there is no selected compiler yet. - -alr_with("gnat", delete=True, manual=False) -alr_with("gnat") -match_solution(f"gnat={version} (gnat_external)", escape=True) - -# But, if the user selects a compiler as preferred, it will be used first - -run_alr("config", "--set", "toolchain.use.gnat", "gnat_cross_2=7777.0.0") -run_alr("update") -match_solution("gnat=1.0.0 (gnat_cross_2)", escape=True) - -# Finally, if the crate requests explicitly an uninstalled compiler, it will be -# downloaded, installed, and used before the rest of installed compilers. - -alr_with("gnat_cross_1") -match_solution("gnat=9999.0.0 (gnat_cross_1)", escape=True) -match_solution("gnat_cross_1=9999.0.0", escape=True) -# Verify it was actually installed -p = run_alr("toolchain") -assert_match(".*gnat_cross_1\s+9999.0.0\s+Available", p.out) - -print('SUCCESS') diff --git a/testsuite/tests/solver/compiler-installed-shared-build/test.yaml b/testsuite/tests/solver/compiler-installed-shared-build/test.yaml deleted file mode 100644 index 9a78c9327..000000000 --- a/testsuite/tests/solver/compiler-installed-shared-build/test.yaml +++ /dev/null @@ -1,7 +0,0 @@ -driver: python-script -build_mode: shared -# This test can't be run twice as it alters the environment in ways too complex -# to restore to the initial status. Instead we use a separate copy of the test. -indexes: - toolchain_index: - in_fixtures: true diff --git a/testsuite/tests/solver/compiler-installed/test.yaml b/testsuite/tests/solver/compiler-installed/test.yaml index cbfdd861b..8185c03b5 100644 --- a/testsuite/tests/solver/compiler-installed/test.yaml +++ b/testsuite/tests/solver/compiler-installed/test.yaml @@ -1,7 +1,4 @@ driver: python-script -build_mode: sandboxed -# This test can't be run twice as it alters the environment in ways too complex -# to restore to the initial status. Instead we use a separate copy of the test. indexes: toolchain_index: in_fixtures: true