diff --git a/start-test-validator/action.yaml b/start-test-validator/action.yaml index 4480ff5..1531310 100644 --- a/start-test-validator/action.yaml +++ b/start-test-validator/action.yaml @@ -24,7 +24,7 @@ runs: steps: - name: Start validator id: start - shell: bash + shell: bash -euo pipefail {0} env: LEDGER_DIR_INPUT: ${{ inputs.ledger-dir }} run: | diff --git a/write-program-buffer/tests/integration/assert-authority.sh b/write-program-buffer/tests/integration/assert-authority.sh index 9ac05da..7d1251a 100755 --- a/write-program-buffer/tests/integration/assert-authority.sh +++ b/write-program-buffer/tests/integration/assert-authority.sh @@ -15,7 +15,8 @@ fail() { BUFFER_INFO=$(solana program show "$BUFFER" -u "$RPC_URL") echo "$BUFFER_INFO" -AUTHORITY=$(echo "$BUFFER_INFO" | grep "Authority:" | awk '{print $2}') +AUTHORITY=$(echo "$BUFFER_INFO" | grep "Authority:" | awk '{print $2}' || true) +[ -n "$AUTHORITY" ] || fail "could not read authority of buffer $BUFFER" [ "$AUTHORITY" = "$BUFFER_AUTHORITY" ] || fail "buffer authority is $AUTHORITY, expected $BUFFER_AUTHORITY" [ "$AUTHORITY" != "$DEPLOYER" ] || fail "buffer authority still equals the deployer" diff --git a/write-program-buffer/tests/integration/assert-clamp.sh b/write-program-buffer/tests/integration/assert-clamp.sh index 44bb03f..2f05d9d 100755 --- a/write-program-buffer/tests/integration/assert-clamp.sh +++ b/write-program-buffer/tests/integration/assert-clamp.sh @@ -14,7 +14,8 @@ fail() { [ -n "${PROGRAM_ID:-}" ] || fail "PROGRAM_ID env not set" [ -n "${PRE_LEN:-}" ] || fail "PRE_LEN env not set" -POST_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1) +POST_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true) +[ -n "$POST_LEN" ] || fail "could not read data length of program $PROGRAM_ID" GROWTH=$((POST_LEN - PRE_LEN)) [ "$GROWTH" -eq "$MIN_EXTEND_SIZE" ] || fail "program grew by $GROWTH bytes, expected exactly $MIN_EXTEND_SIZE" diff --git a/write-program-buffer/tests/integration/assert-delta.sh b/write-program-buffer/tests/integration/assert-delta.sh index 8ce2731..2ea878f 100755 --- a/write-program-buffer/tests/integration/assert-delta.sh +++ b/write-program-buffer/tests/integration/assert-delta.sh @@ -18,7 +18,8 @@ REQUIRED_SIZE=$(wc -c < "$ARTIFACT" | tr -d ' ') EXPECTED_GROWTH=$((REQUIRED_SIZE - PRE_LEN)) [ "$EXPECTED_GROWTH" -gt "$MIN_EXTEND_SIZE" ] || fail "scenario setup invalid: expected growth $EXPECTED_GROWTH must exceed $MIN_EXTEND_SIZE" -POST_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1) +POST_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true) +[ -n "$POST_LEN" ] || fail "could not read data length of program $PROGRAM_ID" GROWTH=$((POST_LEN - PRE_LEN)) [ "$GROWTH" -eq "$EXPECTED_GROWTH" ] || fail "program grew by $GROWTH bytes, expected the exact delta $EXPECTED_GROWTH" diff --git a/write-program-buffer/tests/integration/assert-fresh.sh b/write-program-buffer/tests/integration/assert-fresh.sh index 31d3e88..fc57bfa 100755 --- a/write-program-buffer/tests/integration/assert-fresh.sh +++ b/write-program-buffer/tests/integration/assert-fresh.sh @@ -20,7 +20,8 @@ rm -f "$DUMP" BUFFER_INFO=$(solana program show "$BUFFER" -u "$RPC_URL") echo "$BUFFER_INFO" -AUTHORITY=$(echo "$BUFFER_INFO" | grep "Authority:" | awk '{print $2}') +AUTHORITY=$(echo "$BUFFER_INFO" | grep "Authority:" | awk '{print $2}' || true) +[ -n "$AUTHORITY" ] || fail "could not read authority of buffer $BUFFER" [ "$AUTHORITY" = "$DEPLOYER" ] || fail "buffer authority is $AUTHORITY, expected deployer $DEPLOYER" ABSENCE_CHECK=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" 2>&1 || true) diff --git a/write-program-buffer/tests/integration/assert-nearmax.sh b/write-program-buffer/tests/integration/assert-nearmax.sh index 6138c73..8882839 100755 --- a/write-program-buffer/tests/integration/assert-nearmax.sh +++ b/write-program-buffer/tests/integration/assert-nearmax.sh @@ -16,7 +16,8 @@ fail() { [ -n "${PROGRAM_ID:-}" ] || fail "PROGRAM_ID env not set" [ -n "${PRE_LEN:-}" ] || fail "PRE_LEN env not set" -POST_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1) +POST_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true) +[ -n "$POST_LEN" ] || fail "could not read data length of program $PROGRAM_ID" [ "$POST_LEN" -eq "$MAX_PROGRAM_SIZE" ] || fail "program data length is $POST_LEN, expected the exact maximum $MAX_PROGRAM_SIZE" echo "Program extended from $PRE_LEN to $POST_LEN (exact headroom of $((POST_LEN - PRE_LEN)) bytes)" diff --git a/write-program-buffer/tests/integration/prepare-clamp.sh b/write-program-buffer/tests/integration/prepare-clamp.sh index 24073f5..a327bdb 100755 --- a/write-program-buffer/tests/integration/prepare-clamp.sh +++ b/write-program-buffer/tests/integration/prepare-clamp.sh @@ -34,7 +34,7 @@ solana program deploy "$FIXTURES_DIR/program-small.so" \ -u "$RPC_URL" -k "$SCENARIO_DIR/deployer.json" \ --commitment confirmed -PRE_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1) +PRE_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true) if [ -z "$PRE_LEN" ]; then echo "Could not read deployed program size" >&2 exit 1 diff --git a/write-program-buffer/tests/integration/prepare-delta.sh b/write-program-buffer/tests/integration/prepare-delta.sh index 3d1d7ac..542377e 100755 --- a/write-program-buffer/tests/integration/prepare-delta.sh +++ b/write-program-buffer/tests/integration/prepare-delta.sh @@ -35,7 +35,7 @@ solana program deploy "$FIXTURES_DIR/program-small.so" \ -u "$RPC_URL" -k "$SCENARIO_DIR/deployer.json" \ --commitment confirmed -PRE_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1) +PRE_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true) if [ -z "$PRE_LEN" ]; then echo "Could not read deployed program size" >&2 exit 1 diff --git a/write-program-buffer/tests/integration/prepare-nearmax.sh b/write-program-buffer/tests/integration/prepare-nearmax.sh index 09fab15..bc6c412 100755 --- a/write-program-buffer/tests/integration/prepare-nearmax.sh +++ b/write-program-buffer/tests/integration/prepare-nearmax.sh @@ -46,11 +46,15 @@ solana program deploy "$FIXTURES_DIR/program-small.so" \ --commitment confirmed read_data_len() { - solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 + solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true } for i in 1 2 3; do CURRENT_LEN=$(read_data_len) + if [ -z "$CURRENT_LEN" ]; then + echo "Could not read program data length for $PROGRAM_ID" >&2 + exit 1 + fi REMAINING=$((TARGET_CURRENT - CURRENT_LEN)) if [ "$REMAINING" -le 0 ]; then break @@ -66,6 +70,10 @@ for i in 1 2 3; do done PRE_LEN=$(read_data_len) +if [ -z "$PRE_LEN" ]; then + echo "Could not read program data length for $PROGRAM_ID" >&2 + exit 1 +fi if [ "$PRE_LEN" -ne "$TARGET_CURRENT" ]; then echo "Setup failed: program data length is $PRE_LEN, expected $TARGET_CURRENT" >&2 exit 1