debian-mirror-gitlab/scripts/rspec_bisect_flaky

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
737 B
Text
Raw Normal View History

2022-01-26 12:08:38 +05:30
#!/usr/bin/env bash
## Usage: scripts/rspec_bisect_flaky <files...>
#
# The files should be listed in order, with the last file being the file where
# the flaky spec lives.
if [ $# -eq 0 ]; then
echo "Usage: scripts/rspec_bisect_flaky <files...>"
exit
fi
2022-04-04 11:22:00 +05:30
files=( "$@" )
2022-01-26 12:08:38 +05:30
len=${#files[@]}
target=${files[$len-1]}
# Trap interrupts and exit instead of continuing the loop
trap "echo Exited!; exit 2;" SIGINT SIGTERM
2022-04-04 11:22:00 +05:30
# Show which set of specs are running and exit immediately if they fail.
set -xe
2022-01-26 12:08:38 +05:30
# Do the speedy case first, run each spec with our failing spec
for file in "${files[@]}"; do
2022-04-04 11:22:00 +05:30
bin/rspec "$file" "$target"
2022-01-26 12:08:38 +05:30
done
# Do a full bisect given we did not find candidates with speedy cases
2022-04-04 11:22:00 +05:30
bin/rspec --bisect=verbose "$@"