mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
The idea is to check the order following:
SUPPORTED_KEYS = [
'summary',
'details',
'backends',
'systems',
'manual',
'priority',
'warn-timeout',
'kill-timeout',
'environment',
'prepare',
'restore',
'debug',
'execute'
]
and that the mandatory keys are included in the test:
MANDATORY_KEYS = [
'summary',
'execute'
]
22 lines
692 B
Bash
Executable File
22 lines
692 B
Bash
Executable File
#!/bin/bash
|
|
|
|
BACKEND="${1:-linode:}"
|
|
ITERATIONS=${2:-10}
|
|
OUTPUT_FILE="${3:-${PWD}/benchmark.out}"
|
|
SUCCESSFUL_EXECUTIONS=0
|
|
|
|
rm -f "$OUTPUT_FILE"
|
|
|
|
for i in $(seq "$ITERATIONS"); do
|
|
echo "Running iteration $i of $ITERATIONS"
|
|
START_TIME=$SECONDS
|
|
if spread -v "$BACKEND"; then
|
|
SUCCESSFUL_EXECUTIONS=$((SUCCESSFUL_EXECUTIONS + 1))
|
|
ITERATION_TIME=$((SECONDS - START_TIME))
|
|
TOTAL_TIME=$((TOTAL_TIME + ITERATION_TIME))
|
|
echo "$ITERATION_TIME" >> "$OUTPUT_FILE"
|
|
fi
|
|
done
|
|
echo "$SUCCESSFUL_EXECUTIONS successful executions out of $ITERATIONS" >> "$OUTPUT_FILE"
|
|
echo "Average: $(echo "scale=2; $TOTAL_TIME / $SUCCESSFUL_EXECUTIONS" | bc)s" >> "$OUTPUT_FILE"
|