Skip to content

Commit

Permalink
Cleaner systest output
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Apr 14, 2024
1 parent 9c46a3c commit a17049a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 48 deletions.
33 changes: 31 additions & 2 deletions ci/tests/run-system-tests.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
#!/bin/bash
set -euo pipefail
set -uo pipefail

source "$(dirname "$BASH_SOURCE")/common.sh"

BUILD_DIR=${1-${PWD}}

export NANO_NODE_EXE=${BUILD_DIR}/nano_node$(get_exec_extension)
cd ../systest && ./RUNALL
export NANO_RPC_EXE=${BUILD_DIR}/nano_rpc$(get_exec_extension)

overall_status=0

for script in $(dirname "$BASH_SOURCE")/../../systests/*.sh; do
name=$(basename ${script})

echo "::group::Running: $name"

# Redirecting output to a file to prevent it from being mixed with the output of the action
./$script > "${name}.log" 2>&1
status=$?
cat "${name}.log"

echo "::endgroup::"

if [ $status -eq 0 ]; then
echo "Passed: $name"
else
echo "::error Systest failed: $name ($?)"
overall_status=1
fi
done

if [ $overall_status -eq 0 ]; then
echo "::notice::All systests passed."
else
echo "::error::Some systests failed."
exit 1
fi
23 changes: 3 additions & 20 deletions systest/cli_wallet_create.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
#!/bin/sh
#!/bin/bash
set -eux

set -e -x

DATADIR=data.systest
DATADIR=$(mktemp -d)

SEED=CEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEED

# the caller should set the env var NANO_NODE_EXE to point to the nano_node executable
# if NANO_NODE_EXE is unser ot empty then "../../build/nano_node" is used
NANO_NODE_EXE=${NANO_NODE_EXE:-../../build/nano_node}

clean_data_dir() {
rm -f $DATADIR/log/log_*.log
rm -f $DATADIR/wallets.ldb*
rm -f $DATADIR/data.ldb*
rm -f $DATADIR/config-*.toml
rm -rf "$DATADIR"/rocksdb/
}

mkdir -p $DATADIR/log
clean_data_dir

# initialise data directory
$NANO_NODE_EXE --initialize --data_path $DATADIR

Expand All @@ -34,5 +18,4 @@ $NANO_NODE_EXE --wallet_decrypt_unsafe --wallet $wallet_id --data_path $DATADIR
$NANO_NODE_EXE --wallet_list --data_path $DATADIR | grep -q "Wallet ID: $wallet_id"

# if it got this far then it is a pass
echo $0: PASSED
exit 0
33 changes: 7 additions & 26 deletions systest/node_initialize.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
#!/bin/sh
#!/bin/bash
set -eux

set -e

DATADIR=data.systest

# the caller should set the env var NANO_NODE_EXE to point to the nano_node executable
# if NANO_NODE_EXE is unser ot empty then "../../build/nano_node" is used
NANO_NODE_EXE=${NANO_NODE_EXE:-../../build/nano_node}

clean_data_dir() {
rm -f "$DATADIR"/log/log_*.log
rm -f "$DATADIR"/wallets.ldb*
rm -f "$DATADIR"/data.ldb*
rm -f "$DATADIR"/config-*.toml
rm -rf "$DATADIR"/rocksdb/
}

test_initialize_cmd() {
test_cmd() {
netmatch="$1"
netcmd="$2"
netarg="$3"
genesishash="$4"

clean_data_dir
DATADIR=$(mktemp -d)

# initialise data directory
$NANO_NODE_EXE --initialize --data_path "$DATADIR" "$netcmd" "$netarg"
Expand All @@ -37,13 +22,9 @@ test_initialize_cmd() {
$NANO_NODE_EXE --debug_block_dump --data_path "$DATADIR" "$netcmd" "$netarg" | head -n 1 | grep -qi "$genesishash"
}

mkdir -p "$DATADIR/log"

#test_initialize_cmd "live" "" "" "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948"
test_initialize_cmd "live" "--network" "live" "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948"
test_initialize_cmd "beta" "--network" "beta" "E1227CF974C1455A8B630433D94F3DDBF495EEAC9ADD2481A4A1D90A0D00F488"
test_initialize_cmd "test" "--network" "test" "B1D60C0B886B57401EF5A1DAA04340E53726AA6F4D706C085706F31BBD100CEE"
test_cmd "live" "--network" "live" "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948"
test_cmd "beta" "--network" "beta" "E1227CF974C1455A8B630433D94F3DDBF495EEAC9ADD2481A4A1D90A0D00F488"
test_cmd "test" "--network" "test" "B1D60C0B886B57401EF5A1DAA04340E53726AA6F4D706C085706F31BBD100CEE"

# if it got this far then it is a pass
echo $0: PASSED
exit 0

0 comments on commit a17049a

Please sign in to comment.