-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
99 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import os | ||
from typing import Any, Dict | ||
import e3 | ||
|
||
import drivers.helpers | ||
|
||
from e3.testsuite.control import YAMLTestControlCreator | ||
from e3.testsuite.driver.classic import ClassicTestDriver | ||
|
||
|
||
class BaseDriver(ClassicTestDriver): | ||
""" | ||
A common base driver from which the rest inherit, so common functionality | ||
can be shared by all drivers. In particular, enabling/disabling via the e3 | ||
control feature. | ||
""" | ||
|
||
# Environment variables that can be used to modify the testsuite behavior | ||
# in the control field of the test YAML file. | ||
# E.g.: | ||
# control: | ||
# - [SKIP, "skip_docker", "Docker is disabled"] | ||
MODIFIERS = { | ||
"distro" : 'ALIRE_DISABLE_DISTRO' | ||
, "docker" : 'ALIRE_DISABLE_DOCKER' | ||
, "local" : 'ALIRE_ENABLE_LOCAL_TESTS' | ||
, "network" : 'ALIRE_DISABLE_NETWORK_TESTS' | ||
} | ||
|
||
# In the constructor, prepare the features map based on the environment | ||
# variables. | ||
def __init__(self, env: e3.env.Env, test_env: Dict[str, Any]): | ||
super().__init__(env, test_env) | ||
|
||
# Prepare the features map based on the environment variables | ||
self.skip = {} | ||
|
||
for modifier, env_var in BaseDriver.MODIFIERS.items(): | ||
affirming = "ENABLE" in env_var | ||
key = f"skip_{modifier}" | ||
|
||
if env_var in os.environ: | ||
self.skip[key] = not affirming | ||
else: | ||
self.skip[key] = affirming | ||
|
||
# Hardcode OSes | ||
for osname in ["windows", "linux", "macos"]: | ||
self.skip[f"skip_{osname}"] = not getattr(drivers.helpers, f"on_{osname}")() | ||
|
||
@property | ||
def test_control_creator(self): | ||
# Give our custom dictionary to the control filter | ||
return YAMLTestControlCreator(self.skip) |
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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script is used to run the testsuite with some extra tests enabled, | ||
# intended only for the main developers in their local machines. | ||
|
||
export ALR_TESTSUITE_ALLOW=1 # So `alr` doesn't raise | ||
export ALIRE_ENABLE_LOCAL_TESTS=1 # So they're actually run | ||
|
||
clear | ||
./run.py -M1 "$@" |
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,7 +1,14 @@ | ||
driver: python-script | ||
build_mode: both # one of shared, sandboxed, both (default) | ||
control: # Used to disable test depending on one of: | ||
- [SKIP, "skip_distro", "Unknown distro testing disabled"] | ||
- [SKIP, "skip_docker", "Docker-hosted tests disabled"] | ||
- [SKIP, "skip_network", "Network-requiring tests disabled"] | ||
- [SKIP, "skip_linux", "Test is Linux-only"] | ||
- [SKIP, "skip_macos", "Test is macOS-only"] | ||
- [SKIP, "skip_windows", "Test is Windows-only"] | ||
indexes: | ||
compiler_only_index: {} | ||
# Note that shared builds require a detected compiler to be able to compute | ||
# build hashes, which is needed for many subcommands: build, get, printenv, | ||
# update... | ||
# update... |
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,4 +1,6 @@ | ||
driver: docker-wrapper | ||
control: | ||
- [SKIP, "skip_docker", "Docker disabled"] | ||
indexes: | ||
toolchain_index: | ||
copy_crates_src: True |
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,2 +1,5 @@ | ||
driver: docker-wrapper | ||
control: | ||
- [SKIP, "skip_docker", "Docker disabled"] | ||
- [SKIP, "skip_network", "Network disabled"] | ||
indexes: {} |
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,4 +1,6 @@ | ||
driver: python-script | ||
control: | ||
- [SKIP, "skip_windows", "Windows-only"] | ||
indexes: | ||
my_index: | ||
in_fixtures: false | ||
|