| #!/bin/bash |
| |
| # Copyright 2019 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. |
| |
| WD=$(pwd) |
| cd "$(dirname "$(realpath "${0}")")" || exit |
| |
| ENDPOINT="chromite.api.%(SERVICE)s/%(METHOD)s" |
| INPUT="./$(basename "${0}")_input.json" |
| OUTPUT="./$(basename "${0}")_output.json" |
| OUTPUT_BIN="./$(basename "${0}")_output.bin" |
| CONFIG="./config.json" |
| |
| if [ ! -e "${INPUT}" ]; then |
| echo "Input file not found: ${INPUT}." |
| exit 1 |
| fi; |
| |
| echo "" > "${OUTPUT}" |
| echo "Running ${ENDPOINT}" |
| ../../../bin/build_api "${ENDPOINT}" \ |
| --input-json "${INPUT}" \ |
| --output-json "${OUTPUT}" --output-binary "${OUTPUT_BIN}" \ |
| --config-json "${CONFIG}" \ |
| --debug |
| RESULT=$? |
| |
| echo "Completed ${ENDPOINT}" |
| |
| if [ "${RESULT}" -eq 0 ]; then |
| echo "Success!" |
| fi; |
| |
| echo "Return Code: ${RESULT}" |
| echo "Result:" |
| cat "${OUTPUT}" |
| echo "" |
| |
| cd "${WD}" || exit |