Skip to content

Make the tests independent of polymake's convex hull backend - #28

Merged
fingolfin merged 3 commits into
masterfrom
portable-tests
Aug 16, 2026
Merged

fingolfin merged 3 commits into
masterfrom
portable-tests

Conversation

@fingolfin

@fingolfin fingolfin commented Aug 16, 2026 •

Copy link
Copy Markdown
Member

Fixes #18. Stacked on #27.

The failure was caused by different convex hull backends producing different (but equally valid) results.

To fix this, canonicalise before comparing:

  • FACES -- sort by dimension, then lexicographically, so the expected value
    still reads like a face lattice.

  • FACETS -- scale each row to a primitive integer vector, then sort. Signs
    are preserved: every differing pair I checked differs by a positive factor,
    and facet orientation is meaningful, so normalising it away would discard
    real information.

  • VERTICES_IN_FACETS -- sort. The VERTICES order is stable (that
    expectation already passed).

  • ADJACENCY -- checked structurally instead. It is the covering relation of
    FACES, and the same call returns both in the same node order, so no
    relabelling is needed:

    gap> List(adj, Set) = CoversOfFaceList(faces);
    true

    Canonicalising it by relabelling would have produced a 46-line literal that
    nobody could review. A degree-sequence check is included alongside. Note the
    relation is directed upward only, so a symmetry check would be wrong.

The suite no longer rewrites checked-in files

polymaking.tst pointed the data directory at the package's own tst/ and
read pplane.poly from there. polymake upgrades old-format files in place, so
running the tests dirtied the working tree and made a second run test a
different input. This happens on the CI runner too, not just on Gentoo:

polymake: upgrading /home/runner/work/polymaking/polymaking/tst/pplane.poly from old plain file format

Now copied to a temporary directory first, with git diff --exit-code in CI to
catch a regression.

Testing

Set POLYMAKING_CHULL to pick a backend:

POLYMAKING_CHULL=cdd gap tst/testall.g

0 failures under ppl, cdd, lrs, beneath_beyond and the default, and
git status is clean afterwards. CI gains cdd and beneath_beyond jobs;
beneath_beyond is built into polymake so it is always available, and cdd is
what Debian and Gentoo builds tend to use.

I used an environment variable rather than writing gap.ini because I could
not confirm that gap-actions/run-pkg-tests reads gap.ini; an env var is
immune to how CI invokes GAP, and makes local reproduction a single line.

While here, repaired visual.tst, which had rotted while excluded from the
suite -- it expected no output from LoadPackage and had a stray trailing
space. It passes when run manually now.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.23%. Comparing base (47eb6ec) to head (c02c5f9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   72.00%   72.23%   +0.23%     
==========================================
  Files          15       15              
  Lines         868      868              
==========================================
+ Hits          625      627       +2     
+ Misses        243      241       -2     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from quiet-polymake to master August 16, 2026 21:51
fingolfin and others added 2 commits August 16, 2026 23:51
polymake enumerates facets in an order that depends on which convex hull
backend it picks -- ppl, cdd, lrs or the built-in beneath_beyond -- and FACETS
rows are only determined up to a positive scalar. Four expectations in
polymaking.tst encoded one particular backend's answer, so the suite failed for
anyone whose polymake was built without ppl.

Canonicalise before comparing: sort faces by dimension and then
lexicographically, scale each FACETS row to a primitive integer vector keeping
its sign, and sort the facet list. ADJACENCY, whose node numbering follows the
same facet order, is instead checked structurally: it is the covering relation
of FACES, which the same call returns in the same node order.

Also stop the suite from rewriting files it does not own. It pointed the data
directory at the package's own tst directory and read pplane.poly from there,
which polymake upgrades in place, so running the tests dirtied the working tree
and made a second run test a different input. Copy to a temporary directory
first, and let CI catch a regression with git diff --exit-code.

Set POLYMAKING_CHULL to test a specific backend, e.g.
POLYMAKING_CHULL=cdd gap tst/testall.g. CI now covers cdd and beneath_beyond
in addition to the default.

While here, repair visual.tst, which had rotted while excluded from the suite.

Fixes #18.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
It was only declared in GAP 4.11, and polymaking still supports older
versions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment thread tst/polymaking.tst Outdated
@fingolfin
fingolfin merged commit 661f50f into master Aug 16, 2026
7 checks passed
@fingolfin
fingolfin deleted the portable-tests branch August 16, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failures

1 participant