File: rspec_bisect_flaky

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (30 lines) | stat: -rwxr-xr-x 899 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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

files=( "$@" )
len=${#files[@]}
target=${files[$len-1]}

# Trap interrupts and exit instead of continuing the loop
trap "echo Exited!; exit 2;" SIGINT SIGTERM

# Show which set of specs are running and exit immediately if they fail.
set -xe

# Do the speedy case first, run each spec with our failing spec
for file in "${files[@]}"; do
  bin/rspec "$file" "$target"
done

# Do a full bisect given we did not find candidates with speedy cases
# Explicitly require macos.rb to ensure fork works correctly https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170190
bin/rspec --require ./config/initializers/macos.rb --bisect=verbose "$@"