Commit 16f9a0be authored by Felix Lechner's avatar Felix Lechner

In test runner, add option to accept all tag changes.

With many tests focused on a single tag, large scale changes appeared
unlikely when calibrating expected tags interactively. The individual
approval of tag changes is cumbersome even for twenty tests, however,
especially if the changes are reviewed again in git.

Adds an option 'a' to the interactive calibration which will accept
all subsequent tag changes.
parent f88cf837
Pipeline #61218 failed with stage
in 60 minutes and 3 seconds
......@@ -359,6 +359,8 @@ if (-t STDOUT && !$unattended) {
say 'Offering to re-calibrate the tags expected in tests that failed.'
if @failed;
my $accept_all;
for my $scriptpath (@failed) {
my $workpath = dirname($scriptpath);
......@@ -375,23 +377,32 @@ if (-t STDOUT && !$unattended) {
my $diffpath = "$workpath/tagdiff";
if (-r $diffpath) {
say EMPTY;
unless ($accept_all) {
say EMPTY;
print colored($testpath, 'bold white on_blue')
. ' >>> Fix (y/a/n/q)? ';
print colored($testpath, 'bold white on_blue')
. ' >>> Fix (y/n/q)? ';
my $decision = <STDIN>;
chomp $decision;
last if $decision eq 'q';
next unless $decision eq 'y' || $decision eq 'a';
my $decision = <STDIN>;
chomp $decision;
last if $decision eq 'q';
next unless $decision eq 'y';
$accept_all = 1
if $decision eq 'a';
}
# create tags if needed; helps when writing new tests
my $tagspath = "$testpath/tags";
path($tagspath)->touch
unless -e $tagspath;
my @adjustargs = ($diffpath, $tagspath);
unshift(@adjustargs, '-i')
unless $accept_all;
die "Cannot run tagadjust for $testpath"
if system('tagadjust', '-i', $diffpath, $tagspath);
if system('tagadjust', @adjustargs);
# also copy the new tags to workpath; no need to rebuild
die "Cannot copy updated tags to $workpath"
......@@ -399,6 +410,9 @@ if (-t STDOUT && !$unattended) {
}
}
say NEWLINE . 'Accepted all remaining tag changes.'
if $accept_all;
} else {
my @crashed = $aggregator->parse_errors;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment