Created
April 3, 2024 06:58
-
-
Save p-offtermatt/6e107a8685ae2384c6f02e41297079d4 to your computer and use it in GitHub Desktop.
Useful files for working with Quint MBT traces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Replace 'your_command_here' with your actual command, ensuring it's properly quoted if it contains spaces or special characters | |
COMMAND='go test -v' | |
EXPECTED_OUT="Running traces from the traces folder done" | |
# Loop 1000 times | |
for i in {1..100} | |
do | |
output=$($COMMAND) | |
# Compare the output with the initial output | |
if ! echo "$output" | grep -q "$EXPECTED_OUT"; then | |
echo $output | |
echo "Error: Output at iteration $i does not contain the expected line." | |
exit 1 | |
fi | |
done | |
echo "All outputs were consistent across 1000 runs." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Assign the command line arguments to variables | |
filename=$1 | |
start_index=$2 | |
end_index=$3 | |
# Loop from start_index to end_index | |
for ((index=$start_index; index<=$end_index; index++)) | |
do | |
# Use jq to extract the state with the current index and save it to a file named "<index>.json" | |
jq --argjson idx $index '.states[] | select(."#meta".index == $idx)' $filename > "${index}.json" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Assign the command line arguments to variables | |
filename=$1 | |
start_index=$2 | |
end_index=$3 | |
# Loop from start_index to end_index | |
for ((index=$start_index; index<=$end_index; index++)) | |
do | |
# Use jq to extract the index and the consumersWithPowerChangesInThisEpoch value and print them | |
jq --argjson idx $index '.states[] | select(."#meta".index == $idx) | .currentState.providerState.consumersWithAddrAssignmentChangesInThisEpoch | "Index: \($idx) Value: \(.)"' $filename | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment