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 0C58D4559B; Fri, 5 Jul 2024 19:20:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECA7442F6D; Fri, 5 Jul 2024 19:20:13 +0200 (CEST) Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) by mails.dpdk.org (Postfix) with ESMTP id 15D8642F5B for ; Fri, 5 Jul 2024 19:20:12 +0200 (CEST) Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-6b5dedc59bdso2064596d6.2 for ; Fri, 05 Jul 2024 10:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720200011; x=1720804811; 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=Cz69HOxm9wAwbY8HGQF/9u8e6y08YHFa1nww2+XoxCXkuJqCNOznuq0NUOpAdXJXc7 U6PmuS6sc7b3jw3a0nbER+w5WFTYWKo7kedxqSiXWUjDFS5s0jDuU2LfTW4QiAaTbUlb 8PsshpiZk9VIMv0wd41FPKzCQk4ek1v+1r3iI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720200011; x=1720804811; 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=ehSGom6mfLpf0LFb66FukkOGXpxvn/PttYbmqGhKDeeHHum8DP5HgAhRT35LXlO7tF hZoZh+GtE+M9qUGK5C/vb9pijH/CtSmAY63TWfRDxBTG5ZpHxD/FRUX1OkYr06VRftDH e6HiBttrKsj2qHI52M+6HKP+6P5ZBxZCqoINrgic1bN54B6+s3Pr9M0qs2E6vUK/rVbh IjjJHVjRZN2k5mONO+WVqHBDvh7bBOz01DjoIir5cKGur1AXu8e8rfJ9cqzqeUBW65pl 4k/IN+n37OJ+SCZVmmCvckpNhMEH+Y3PUj9fdxCpTO3fLvRG00R7coBXVQQOFGUhQ6hZ E0Pw== X-Gm-Message-State: AOJu0YxAt+W175nnNISjMiSMMcQfEgpS+5NoFrr0aq5ZxoqQXxGJK3E+ X795TAP2+isBg+4REt+gD5NJaigKzZXGgI1DTykahWb6UQU6L5WaaFXD70N96S8= X-Google-Smtp-Source: AGHT+IE2eVPPexIQRMq3QUWYCFGkKsrXxu9PCk6KJQeRiXUImrycsWqpA5EiOFFyxkOGnw18JkSMcQ== X-Received: by 2002:a05:6214:19ca:b0:6b2:b621:559c with SMTP id 6a1803df08f44-6b5ed22409amr54918556d6.4.1720200011400; Fri, 05 Jul 2024 10:20:11 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1257::1003]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b5f92e7a08sm6534366d6.74.2024.07.05.10.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 10:20:10 -0700 (PDT) From: Nicholas Pratte To: probb@iol.unh.edu, dmarx@iol.unh.edu, jspewock@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v2 5/6] dts: add conditional behavior for test suite Date: Fri, 5 Jul 2024 13:13:41 -0400 Message-ID: <20240705171341.23894-12-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240613201831.9748-3-npratte@iol.unh.edu> References: <20240613201831.9748-3-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