import os import platform import re import pytest import framework.utils as utils import host_tools.cargo_build as host # pylint: disable=import-error import host_tools.proc as proc # AMD has a slightly different coverage due to # the appearance of the brand string. On Intel, # this contains the frequency while on AMD it does not. # Checkout the cpuid crate. In the future other # differences may appear. COVERAGE_DICT = {"Intel": 84.22, "AMD": 84.19} PROC_MODEL = proc.proc_type() COVERAGE_MAX_DELTA = 0.05 CARGO_KCOV_REL_PATH = os.path.join(host.CARGO_BUILD_REL_PATH, 'kcov') KCOV_COVERAGE_FILE = 'index.js' """kcov will aggregate coverage data in this file.""" KCOV_COVERED_LINES_REGEX = r'"covered_lines":"(\d+)"' """Regex for extracting number of total covered lines found by kcov.""" KCOV_TOTAL_LINES_REGEX = r'"total_lines" : "(\d+)"' """Regex for extracting number of total executable lines found by kcov."""
If variable exists in `os.environ`, its value will be used as the s3 bucket for microvm test images. """ SCRIPT_FOLDER = os.path.dirname(os.path.realpath(__file__)) # This codebase uses Python features available in Python 3.6 or above if sys.version_info < (3, 6): raise SystemError("This codebase requires Python 3.6 or above.") # Some tests create system-level resources; ensure we run as root. if os.geteuid() != 0: raise PermissionError("Test session needs to be run as root.") # Style related tests are run only on AMD. if "AMD" not in proc.proc_type(): collect_ignore = [os.path.join(SCRIPT_FOLDER, "integration_tests/style")] if "AMD" in proc.proc_type(): collect_ignore = [ os.path.join(SCRIPT_FOLDER, "integration_tests/performance/test_snapshot_perf.py") ] def _test_images_s3_bucket(): """Auxiliary function for getting this session's bucket name.""" return os.environ.get(ENV_TEST_IMAGES_S3_BUCKET, DEFAULT_TEST_IMAGES_S3_BUCKET)
from framework.s3fetcher import MicrovmImageS3Fetcher from framework.scheduler import PytestScheduler # Tests root directory. SCRIPT_FOLDER = os.path.dirname(os.path.realpath(__file__)) # This codebase uses Python features available in Python 3.6 or above if sys.version_info < (3, 6): raise SystemError("This codebase requires Python 3.6 or above.") # Some tests create system-level resources; ensure we run as root. if os.geteuid() != 0: raise PermissionError("Test session needs to be run as root.") # Style related tests and dependency enforcements are run only on Intel. if "Intel" not in proc.proc_type(): TEST_DIR = "integration_tests" collect_ignore = [ os.path.join(SCRIPT_FOLDER, "{}/style".format(TEST_DIR)), os.path.join(SCRIPT_FOLDER, "{}/build/test_dependencies.py".format(TEST_DIR)) ] def _test_images_s3_bucket(): """Auxiliary function for getting this session's bucket name.""" return os.environ.get(defs.ENV_TEST_IMAGES_S3_BUCKET, defs.DEFAULT_TEST_IMAGES_S3_BUCKET) ARTIFACTS_COLLECTION = ArtifactCollection(_test_images_s3_bucket())
If variable exists in `os.environ`, its value will be used as the s3 bucket for microvm test images. """ SCRIPT_FOLDER = os.path.dirname(os.path.realpath(__file__)) # This codebase uses Python features available in Python 3.6 or above if sys.version_info < (3, 6): raise SystemError("This codebase requires Python 3.6 or above.") # Some tests create system-level resources; ensure we run as root. if os.geteuid() != 0: raise PermissionError("Test session needs to be run as root.") # Style related tests are run only on AMD. if "AMD" not in proc.proc_type(): collect_ignore = [os.path.join(SCRIPT_FOLDER, "integration_tests/style")] if proc.proc_type() == "AMD": collect_ignore = [ os.path.join(SCRIPT_FOLDER, "integration_tests/performance/test_snapshot_perf.py") ] def _test_images_s3_bucket(): """Auxiliary function for getting this session's bucket name.""" return os.environ.get(ENV_TEST_IMAGES_S3_BUCKET, DEFAULT_TEST_IMAGES_S3_BUCKET)