Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ jobs:
- uses: gap-actions/run-pkg-tests@v4
with:
mode: onlyneeded
- name: Regenerate tracked test fixtures
run: |
gap -q --packagedirs . regen_tests.g
git diff --exit-code
- uses: gap-actions/process-coverage@v3
- uses: codecov/codecov-action@v5
with:
Expand Down
41 changes: 33 additions & 8 deletions regen_tests.g
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ SetInfoLevel(InfoAutoDoc, 1);
SetInfoLevel(InfoGAPDoc, 0);

AUTODOC_RegenWorkSheetExpected := function(wsdir, ws)
local sheetdir, expecteddir, filenames, old, f, tstfiles, x;
local sheetdir, expecteddir, tmpdir, actualdir, filenames, old, f,
tstfiles, x, actualtstdir, expectedtstdir;

sheetdir := Filename(wsdir, Concatenation(ws, ".sheet"));
if not IsString(sheetdir) or not IsDirectoryPath(sheetdir) then
Expand All @@ -22,6 +23,17 @@ AUTODOC_RegenWorkSheetExpected := function(wsdir, ws)
AUTODOC_CreateDirIfMissing(expecteddir);
expecteddir := Directory(expecteddir);

# Generate worksheet output outside the package tree so GAPDoc resolves
# _Chunks.xml relative to the output dir instead of re-prefixing the
# package-local path.
tmpdir := Filename(DirectoryTemporary(),
Concatenation("autodoc-regen-", ws, ".expected"));
if IsDirectoryPath(tmpdir) then
RemoveDirectoryRecursively(tmpdir);
fi;
AUTODOC_CreateDirIfMissing(tmpdir);
actualdir := Directory(tmpdir);

filenames := DirectoryContents(sheetdir);
filenames := Filtered(filenames, f -> f <> "." and f <> "..");
filenames := Filtered(filenames,
Expand All @@ -31,27 +43,40 @@ AUTODOC_RegenWorkSheetExpected := function(wsdir, ws)

old := InfoLevel(InfoGAPDoc);
SetInfoLevel(InfoGAPDoc, 0);
AutoDocWorksheet(filenames, rec(dir := expecteddir, extract_examples := true) : nopdf);
AutoDocWorksheet(filenames,
rec(dir := actualdir, extract_examples := true) : nopdf);
SetInfoLevel(InfoGAPDoc, old);

# Keep only deterministic reference outputs.
filenames := DirectoryContents(expecteddir);
filenames := DirectoryContents(actualdir);
filenames := Filtered(filenames, f -> f <> "." and f <> "..");
for f in filenames do
if f = "tst" then
tstfiles := DirectoryContents(Filename(expecteddir, "tst"));
AUTODOC_CreateDirIfMissing(Filename(expecteddir, "tst"));
actualtstdir := Directory(Filename(actualdir, "tst"));
expectedtstdir := Directory(Filename(expecteddir, "tst"));
tstfiles := DirectoryContents(actualtstdir);
tstfiles := Filtered(tstfiles, x -> x <> "." and x <> "..");
for x in tstfiles do
if PositionSublist(x, ".tst") <> Length(x) - 3 then
RemoveFile(Filename(Filename(expecteddir, "tst"), x));
if PositionSublist(x, ".tst") = Length(x) - 3 then
Exec(Concatenation(
"cp \"", Filename(actualtstdir, x),
"\" \"", Filename(expectedtstdir, x),
"\""
));
fi;
od;
continue;
fi;
if PositionSublist(f, ".xml") <> Length(f) - 3 then
RemoveFile(Filename(expecteddir, f));
if PositionSublist(f, ".xml") = Length(f) - 3 then
Exec(Concatenation(
"cp \"", Filename(actualdir, f),
"\" \"", Filename(expecteddir, f), "\""
));
fi;
od;

RemoveDirectoryRecursively(tmpdir);
end;

AUTODOC_DetectedWorkSheets := function(wsdir)
Expand Down