forked from IntersectMBO/cardano-node-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_test_env.sh
executable file
·61 lines (51 loc) · 1.33 KB
/
prepare_test_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
if ! (return 0 2>/dev/null); then
echo "This script is supposed to be sourced, not executed." >&2
exit 1
fi
if [ -z "${IN_NIX_SHELL:-""}" ]; then
echo "This script is supposed to be sourced from nix shell." >&2
return 1
fi
case "${1:-""}" in
"babbage")
export CLUSTER_ERA=babbage
;;
"conway")
export CLUSTER_ERA=conway COMMAND_ERA=conway
;;
*)
echo "Usage: $0 {babbage|conway}"
return 1
;;
esac
_cur_file="${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}"
REPODIR="$(readlink -m "${_cur_file%/*}")"
cd "$REPODIR" || return 1
unset _cur_file
export WORKDIR="$REPODIR/dev_workdir"
rm -rf "${WORKDIR:?}"
mkdir -p "$WORKDIR"
# shellcheck disable=SC1091
. "$REPODIR/.github/setup_venv.sh"
export \
CARDANO_NODE_SOCKET_PATH="$PWD/dev_workdir/state-cluster0/bft1.socket" \
TMPDIR="$PWD/dev_workdir/tmp" \
DEV_CLUSTER_RUNNING=1 \
CLUSTERS_COUNT=1 \
FORBID_RESTART=1 \
NO_ARTIFACTS=1
_scripts_dest="$WORKDIR/${CLUSTER_ERA}_fast"
if [ ! -d "$_scripts_dest" ]; then
PYTHONPATH=$PYTHONPATH:$PWD cardano_node_tests/prepare_cluster_scripts.py \
-s "cardano_node_tests/cluster_scripts/${CLUSTER_ERA}_fast" \
-d "$_scripts_dest"
fi
unset _scripts_dest
echo
echo
echo "----------------------------------------"
echo
echo "To start local testnet, run:"
echo "$WORKDIR/${CLUSTER_ERA}_fast/start-cluster"
echo