daml/ledger/ledger-api-test-tool/test-extract.sh
Moritz Kiefer 41e049339b
Fix --extract option in ledger api test tool (#9029)
This broke in #8894

changelog_begin
changelog_end

windows is great

changelog_begin
changelog_end
2021-03-04 18:32:18 +00:00

48 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Golden scenario tests
#
set -eu
export LC_ALL="en_US.UTF-8"
# --- begin runfiles.bash initialization ---
# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash).
if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
if [[ -f "$0.runfiles_manifest" ]]; then
export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest"
elif [[ -f "$0.runfiles/MANIFEST" ]]; then
export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST"
elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
export RUNFILES_DIR="$0.runfiles"
fi
fi
if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash"
elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \
"$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)"
else
echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash"
exit 1
fi
# --- end runfiles.bash initialization ---
JAVA=$(rlocation "$TEST_WORKSPACE/$1")
TEST_TOOL=$(rlocation "$TEST_WORKSPACE/$2")
DIR=$(mktemp -d)
trap "rm -rf $$DIR" EXIT
cd $DIR
$JAVA -jar $TEST_TOOL --extract
if [[ $(ls | wc -l) != 4 ]]; then
echo "Expected 4 DARs but got:"
ls
exit 1
fi