diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-20 00:09:31 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-20 00:09:31 +0300 |
commit | c991a74ffd36af636f3083fed93c0f6e81746f02 (patch) | |
tree | 740d15ad70d1b53220bc9c0a965ed977187ae582 /scripts | |
parent | 2a6df7f21e786ddbbedc664a54f6116589475477 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/merge-auto-explain-logs | 14 | ||||
-rw-r--r-- | scripts/rspec_helpers.sh | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/scripts/merge-auto-explain-logs b/scripts/merge-auto-explain-logs new file mode 100755 index 00000000000..0dff4fb33f8 --- /dev/null +++ b/scripts/merge-auto-explain-logs @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "set" +require "json" + +fingerprints = Set.new + +ARGF.each_line do |line| + fingerprint = JSON.parse(line)['fingerprint'] + $stdout.puts(line) && $stdout.flush if fingerprints.add?(fingerprint) +end + +warn("auto_explain log contains #{fingerprints.size} entries") diff --git a/scripts/rspec_helpers.sh b/scripts/rspec_helpers.sh index fd478cbd3ae..f92b10a19ff 100644 --- a/scripts/rspec_helpers.sh +++ b/scripts/rspec_helpers.sh @@ -483,3 +483,13 @@ function is_rspec_last_run_results_file_missing() { return 1 fi } + +function merge_auto_explain_logs() { + local auto_explain_logs_path="$(dirname "${RSPEC_AUTO_EXPLAIN_LOG_PATH}")/" + + for file in ${auto_explain_logs_path}*.gz; do + (gunzip -c "${file}" && rm -f "${file}" || true) + done | \ + scripts/merge-auto-explain-logs | \ + gzip -c > "${RSPEC_AUTO_EXPLAIN_LOG_PATH}" +} |