From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11F584559C; Fri, 5 Jul 2024 20:33:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0279A43283; Fri, 5 Jul 2024 20:33:13 +0200 (CEST) Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by mails.dpdk.org (Postfix) with ESMTP id A572A43254 for ; Fri, 5 Jul 2024 20:33:11 +0200 (CEST) Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-79504120b7eso6846185a.1 for ; Fri, 05 Jul 2024 11:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720204391; x=1720809191; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vdjUIA9jlPN9uHmFZnapa1ylQH8Y2+ogcYQultocLg0=; b=Uth8s5szCNAWtTIPdc3P8+2cJbyfLrtY8RlsJHmxZBTQkdMBNx2QbIfdqbc81Qo3B+ CYtKCkJc21lFdi+xqTK9TsmL8kvvNw2VzfPyIMMv4VgHSl9ogKrxbvZuQg7TEjPQNxUa gy9qoj+gT4kRL1NtNx2HDXh4GOCdwI0iybr44= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720204391; x=1720809191; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vdjUIA9jlPN9uHmFZnapa1ylQH8Y2+ogcYQultocLg0=; b=IVjbTSIgwCcPkPOrhmG6VqiJ7121rd4ujSnuj21VyxybHlHuKqhqt6QX8ygmVPtTOd UajQgWT+QTr6Wsg/KwmmEIZA/OJjiz/ksVGvZd5u8rIxOuARFhPOaQzsnG7oMAa8aEfr er5UoxBLXy9KhVfjuwzglyONQrM6/2vIwJxayQ1FY1Z5aQiQUoZQIVu2FZ8RRLsN6tCG DYEMDSoHqZraZnv+8nVxeoxIfDYFWuEAqJttFcaTwEolmCOy3Vp6FYhies8pUh3YwWam w4K9W10lXf4MxFHTpL0gqbNMuuNomvENXFSmlsKry7FRW2n2v4Av4FQMR+xg1FNZ93yO cRSg== X-Gm-Message-State: AOJu0YwoiGOlOCJVgZWQ/Y2IrL93Hvku/9k1jG+WOlzRZl1NCdAhPqvN QP2TIzDlg+3ZNvXUoDTPjMtXDEgOcJtTATFKylf3qeqc6kZ9XmDBDJAAViPn+dQ= X-Google-Smtp-Source: AGHT+IHkxERl+4cyYLfApqg1dRj33Yazv1WkQdE8h0YGcdYxXPAa9dAzbtAF2lMxbUEzcStjcHNnVg== X-Received: by 2002:ad4:594d:0:b0:6b5:e3ba:5256 with SMTP id 6a1803df08f44-6b5ed08c228mr55909526d6.3.1720204390915; Fri, 05 Jul 2024 11:33:10 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1257::1003]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b5d27a4b55sm37606326d6.106.2024.07.05.11.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 11:33:10 -0700 (PDT) From: Nicholas Pratte To: dmarx@iol.unh.edu, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, luca.vizzarro@arm.com, probb@iol.unh.edu, Honnappa.Nagarahalli@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v2 5/6] dts: add conditional behavior for test suite Date: Fri, 5 Jul 2024 14:33:06 -0400 Message-ID: <20240705183306.31915-1-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240705171341.23894-2-npratte@iol.unh.edu> References: <20240705171341.23894-2-npratte@iol.unh.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org There is some odd functionality/behavior in how the --test-suite parameters interacts in conjunction with the 'test_suites' attribute in the config file. If a user leaves an empty list underneath 'test_suites,' or if they negate the attribute entirely, even if said user adds test suites via the --test-suite parameter, a schema violation is thrown. This patch mitigates this, by removing the schema requirement if the user has indicated test suites within main.py parameters, allowing for the 'test_suites' attribute to be optional. Bugzilla ID: 1360 Signed-off-by: Nicholas Pratte --- dts/framework/config/__init__.py | 7 ++++++- dts/framework/runner.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py index ed1c979fb6..82182b5c99 100644 --- a/dts/framework/config/__init__.py +++ b/dts/framework/config/__init__.py @@ -553,7 +553,7 @@ def from_dict(cls, d: ConfigurationDict) -> Self: return cls(test_runs=test_runs) -def load_config(config_file_path: Path) -> Configuration: +def load_config(config_file_path: Path, test_suites: list[TestSuiteConfig]) -> Configuration: """Load DTS test run configuration from a file. Load the YAML test run configuration file @@ -576,6 +576,11 @@ def load_config(config_file_path: Path) -> Configuration: with open(schema_path, "r") as f: schema = json.load(f) + if test_suites: + schema["properties"]["test_runs"]["items"]["required"].remove("test_suites") + for test_run in config_data["test_runs"]: + if not hasattr(test_run, "test_suites"): + test_run["test_suites"] = [] config = warlock.model_factory(schema, name="_Config")(config_data) config_obj: Configuration = Configuration.from_dict(dict(config)) # type: ignore[arg-type] return config_obj diff --git a/dts/framework/runner.py b/dts/framework/runner.py index 2a1019899a..edda5510af 100644 --- a/dts/framework/runner.py +++ b/dts/framework/runner.py @@ -85,7 +85,7 @@ class DTSRunner: def __init__(self): """Initialize the instance with configuration, logger, result and string constants.""" - self._configuration = load_config(SETTINGS.config_file_path) + self._configuration = load_config(SETTINGS.config_file_path, SETTINGS.test_suites) self._logger = get_dts_logger() if not os.path.exists(SETTINGS.output_dir): os.makedirs(SETTINGS.output_dir) -- 2.44.0