1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Add --gen-check option to test.pl to check autogenerated code.

Make sure that auto-generated code does not change during CI.

This is useful for catching missed code generation, especially help.auto.c.
This commit is contained in:
David Steele
2021-03-31 10:36:22 -04:00
parent e89452557e
commit 1615cb0261
2 changed files with 23 additions and 1 deletions
+22
View File
@@ -87,6 +87,7 @@ test.pl [options]
--no-performance do not run performance tests
--gen-only only run auto-generation
--no-gen do not run code generation
--gen-check check that auto-generated files are correct (used in CI to detect changes)
--code-count generate code counts
--smart perform bin/package builds only when source timestamps have changed
--dev --smart --no-optimize
@@ -168,6 +169,7 @@ my $bCOnly = false;
my $bContainerOnly = false;
my $bNoPerformance = false;
my $bGenOnly = false;
my $bGenCheck = false;
my $bNoGen = false;
my $bCodeCount = false;
my $bSmart = false;
@@ -223,6 +225,7 @@ GetOptions ('q|quiet' => \$bQuiet,
'container-only' => \$bContainerOnly,
'no-performance' => \$bNoPerformance,
'gen-only' => \$bGenOnly,
'gen-check' => \$bGenCheck,
'no-gen' => \$bNoGen,
'code-count' => \$bCodeCount,
'smart' => \$bSmart,
@@ -515,6 +518,12 @@ eval
push(@stryModifiedList, @stryBuilt);
}
# Error when checking that files have already been generated but they change
if ($bGenCheck && @stryBuilt)
{
confess &log(ERROR, "unexpected autogeneration of version in configure.ac script: " . join(', ', @stryBuilt));
}
&log(INFO,
" autogenerated version in configure.ac script: " . (@stryBuilt ? join(', ', @stryBuilt) : 'no changes'));
}
@@ -567,6 +576,12 @@ eval
push(@stryModifiedList, @stryBuilt);
}
# Error when checking that files have already been generated but they change
if ($bGenCheck && @stryBuilt)
{
confess &log(ERROR, "unexpected autogeneration of configure script: " . join(', ', @stryBuilt));
}
&log(INFO, " autogenerated configure script: " . (@stryBuilt ? join(', ', @stryBuilt) : 'no changes'));
}
@@ -605,6 +620,13 @@ eval
};
my @stryBuilt = buildAll("${strBackRestBase}/src", $rhBuild);
# Error when checking that files have already been generated but they change
if ($bGenCheck && @stryBuilt)
{
confess &log(ERROR, "unexpected autogeneration of C code: " . join(', ', @stryBuilt));
}
&log(INFO, " autogenerated C code: " . (@stryBuilt ? join(', ', @stryBuilt) : 'no changes'));
if (@stryBuilt)