Created
May 12, 2025 01:21
-
-
Save aabccd021/7da84b2f1e4e6625a2a93d00ec5967fc to your computer and use it in GitHub Desktop.
check duplicate scenario
This file contains hidden or 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
| { | |
| checkDuplicateScenario = pkgs.runCommand "checkDuplicateScenario" | |
| { env.HISTORIES = "${snapshot-scenarioHistories}/test/scenario-histories"; } '' | |
| scenarioDirFiles=$(ls "$HISTORIES") | |
| checked="" | |
| for scenario1 in $scenarioDirFiles; do | |
| for scenario2 in $scenarioDirFiles; do | |
| if [ "$scenario1" = "$scenario2" ]; then | |
| continue | |
| fi | |
| if echo "$checked" | grep -q " $scenario2 "; then | |
| continue | |
| fi | |
| if [ ! -f "./$scenario1" ]; then | |
| cat "$HISTORIES/$scenario1" | cut -d' ' -f2- > "./$scenario1" | |
| fi | |
| if [ ! -f "./$scenario2" ]; then | |
| cat "$HISTORIES/$scenario2" | cut -d' ' -f2- > "./$scenario2" | |
| fi | |
| if [ "$(diff -q $scenario1 $scenario2)" = "" ]; then | |
| echo "Duplicate scenario found: $scenario1 and $scenario2" | |
| exit 1 | |
| fi | |
| done | |
| checked="$checked $scenario1" | |
| done | |
| touch $out | |
| ''; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment