Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion start-test-validator/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 2 additions & 1 deletion write-program-buffer/tests/integration/assert-authority.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion write-program-buffer/tests/integration/assert-clamp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion write-program-buffer/tests/integration/assert-delta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion write-program-buffer/tests/integration/assert-fresh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion write-program-buffer/tests/integration/assert-nearmax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

Expand Down
2 changes: 1 addition & 1 deletion write-program-buffer/tests/integration/prepare-clamp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion write-program-buffer/tests/integration/prepare-delta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion write-program-buffer/tests/integration/prepare-nearmax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading