• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 The ChromiumOS Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4"""Constraint checks related the model_sku.json factory file."""
5
6import pathlib
7
8from checker import constraint_suite
9from checker import io_utils
10
11from chromiumos.config.payload import config_bundle_pb2
12
13
14class CheckModelSkuJsonConstraintSuite(constraint_suite.ConstraintSuite):
15  """Constraint checks related the model_sku.json factory file."""
16
17  def check_model_present(
18      self,
19      program_config: config_bundle_pb2.ConfigBundle,
20      project_config: config_bundle_pb2.ConfigBundle,
21      factory_dir: pathlib.Path,
22  ):
23    """Checks that there is at least one model"""
24    del program_config, project_config
25
26    model_sku = io_utils.read_model_sku_json(factory_dir=factory_dir)
27    self.assertTrue(
28        model_sku.get('model'),
29        "'model' must be present and have at least one item.")
30