| #!/usr/bin/env bash |
| # |
| # Copyright 2020 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Used to run the constrain checks on project configuration. Assumes that |
| # it is running in a project directory where the program constraints: |
| # ./program/generated/config.jsonproto |
| # and project configuration: |
| # ./generated/config.jsonproto |
| # can be found. |
| |
| # Exit if any command fails. |
| set -e |
| |
| function usage() { |
| echo "Usage: $0" >&2 |
| echo " where you are assumed to be in a project's root directory and" >&2 |
| echo " and program and project config are in the standard locations," >&2 |
| echo " that is:" >&2 |
| echo " ./program/generated/config.jsonproto" >&2 |
| echo " ./generated/config.jsonproto" >&2 |
| exit 1 |
| } |
| |
| if [[ $# -ne 0 ]]; then |
| usage |
| fi |
| |
| readonly script_dir="$(dirname "$(realpath -e "${BASH_SOURCE[0]}")")" |
| source "${script_dir}/common.sh" |
| |
| create_venv |
| |
| if ! ./config/payload_utils/checker.py \ |
| --program ./program/generated/config.jsonproto \ |
| --project ./generated/config.jsonproto \ |
| --factory_dir=./factory; then |
| echo 'checker.py constraint checks failed' |
| exit 1 |
| fi |
| |
| deactivate |