From 230d60d64a651041cf2f09d52851b07f374bbbf8 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Fri, 22 Nov 2019 16:20:57 +0000 Subject: [PATCH 01/16] Add test case for issue #35. --- test/test_issue35.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/test_issue35.py diff --git a/test/test_issue35.py b/test/test_issue35.py new file mode 100644 index 0000000..e10188c --- /dev/null +++ b/test/test_issue35.py @@ -0,0 +1,8 @@ +import cdd + + +# this should not segfault +def test_issue35(): + m = cdd.Matrix([[0, 0, 0]], number_type="float") + m.rep_type = cdd.RepType.INEQUALITY + m.canonicalize() From 7ccb5296815ab5c815b1d6719aa06a6658e7dc70 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 17 Sep 2024 11:00:15 +0100 Subject: [PATCH 02/16] Update test for v3.0.0. --- test/test_issue35.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/test_issue35.py b/test/test_issue35.py index e10188c..4a43509 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -3,6 +3,5 @@ # this should not segfault def test_issue35(): - m = cdd.Matrix([[0, 0, 0]], number_type="float") - m.rep_type = cdd.RepType.INEQUALITY - m.canonicalize() + mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) + cdd.matrix_canonicalize(mat) From 8150b2a66b6b4dab9b56d0092b5b9461ac25579b Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 17 Sep 2024 11:02:09 +0100 Subject: [PATCH 03/16] Minor fixes. --- test/test_issue35.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_issue35.py b/test/test_issue35.py index 4a43509..2890eb8 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -2,6 +2,6 @@ # this should not segfault -def test_issue35(): +def test_issue35() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) cdd.matrix_canonicalize(mat) From 95e0ff1638e8caf80724ad04ed8ce31ca4c95060 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 13:17:14 +0100 Subject: [PATCH 04/16] Add segfault tests for other canonicalize functions. --- test/test_issue35_2.py | 7 +++++++ test/test_issue35_3.py | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 test/test_issue35_2.py create mode 100644 test/test_issue35_3.py diff --git a/test/test_issue35_2.py b/test/test_issue35_2.py new file mode 100644 index 0000000..60368d7 --- /dev/null +++ b/test/test_issue35_2.py @@ -0,0 +1,7 @@ +import cdd + + +# this should not segfault +def test_issue35_2() -> None: + mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) + cdd.matrix_canonicalize(mat) diff --git a/test/test_issue35_3.py b/test/test_issue35_3.py new file mode 100644 index 0000000..a9e888c --- /dev/null +++ b/test/test_issue35_3.py @@ -0,0 +1,7 @@ +import cdd + + +# this should not segfault +def test_issue35_3() -> None: + mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) + cdd.matrix_canonicalize_linearity(mat) From 65f87fa1af14b03146913ea14bafa53046466b46 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 13:22:05 +0100 Subject: [PATCH 05/16] Temp disable test for regression. --- test/test_issue35.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_issue35.py b/test/test_issue35.py index 2890eb8..788c8f2 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -1,7 +1,9 @@ import cdd +import pytest # this should not segfault +@pytest.mark.skip # temporarily disabled to check other tests def test_issue35() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) cdd.matrix_canonicalize(mat) From f8d49f274e92b4ae4c0434797b549a2f4c3c13f0 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 13:24:32 +0100 Subject: [PATCH 06/16] Correct test. --- test/test_issue35_2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_issue35_2.py b/test/test_issue35_2.py index 60368d7..e1f8741 100644 --- a/test/test_issue35_2.py +++ b/test/test_issue35_2.py @@ -4,4 +4,4 @@ # this should not segfault def test_issue35_2() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) - cdd.matrix_canonicalize(mat) + cdd.matrix_redundancy_remove(mat) From e1f8cd2d26321c7d8ec4efb64a07f7db89dc379b Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 13:26:41 +0100 Subject: [PATCH 07/16] Merge tests. --- test/test_issue35.py | 10 ++++++++++ test/test_issue35_2.py | 7 ------- test/test_issue35_3.py | 7 ------- 3 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 test/test_issue35_2.py delete mode 100644 test/test_issue35_3.py diff --git a/test/test_issue35.py b/test/test_issue35.py index 788c8f2..7d93a62 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -7,3 +7,13 @@ def test_issue35() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) cdd.matrix_canonicalize(mat) + + +def test_issue35_2() -> None: + mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) + cdd.matrix_redundancy_remove(mat) + + +def test_issue35_3() -> None: + mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) + cdd.matrix_canonicalize_linearity(mat) diff --git a/test/test_issue35_2.py b/test/test_issue35_2.py deleted file mode 100644 index e1f8741..0000000 --- a/test/test_issue35_2.py +++ /dev/null @@ -1,7 +0,0 @@ -import cdd - - -# this should not segfault -def test_issue35_2() -> None: - mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) - cdd.matrix_redundancy_remove(mat) diff --git a/test/test_issue35_3.py b/test/test_issue35_3.py deleted file mode 100644 index a9e888c..0000000 --- a/test/test_issue35_3.py +++ /dev/null @@ -1,7 +0,0 @@ -import cdd - - -# this should not segfault -def test_issue35_3() -> None: - mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) - cdd.matrix_canonicalize_linearity(mat) From 81634270cd0cfd4b0e28234cf9de5c4a497c934b Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 13:28:16 +0100 Subject: [PATCH 08/16] Enhance tests. --- test/test_issue35.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_issue35.py b/test/test_issue35.py index 7d93a62..c02b77f 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -11,9 +11,11 @@ def test_issue35() -> None: def test_issue35_2() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) - cdd.matrix_redundancy_remove(mat) + assert cdd.matrix_redundancy_remove(mat) == ({0}, [None]) + assert mat.array == [] def test_issue35_3() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) - cdd.matrix_canonicalize_linearity(mat) + assert cdd.matrix_canonicalize_linearity(mat) == ({0}, [None]) + assert mat.array == [] From 18667ef5b2d2a70c6fc6b070d2fa2cf901c47888 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 13:29:27 +0100 Subject: [PATCH 09/16] Test more special cases. --- test/test_issue35.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_issue35.py b/test/test_issue35.py index c02b77f..201b31c 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -19,3 +19,15 @@ def test_issue35_3() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) assert cdd.matrix_canonicalize_linearity(mat) == ({0}, [None]) assert mat.array == [] + + +def test_issue35_4() -> None: + mat = cdd.matrix_from_array([], rep_type=cdd.RepType.INEQUALITY) + assert cdd.matrix_redundancy_remove(mat) == (set(), []) + assert mat.array == [] + + +def test_issue35_5() -> None: + mat = cdd.matrix_from_array([], rep_type=cdd.RepType.INEQUALITY) + assert cdd.matrix_canonicalize_linearity(mat) == (set(), []) + assert mat.array == [] From e60c57332477034a1d29eac1924ad7a21dc2bd14 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 13:32:06 +0100 Subject: [PATCH 10/16] One more test. --- test/test_issue35.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/test_issue35.py b/test/test_issue35.py index 201b31c..99caece 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -4,9 +4,10 @@ # this should not segfault @pytest.mark.skip # temporarily disabled to check other tests -def test_issue35() -> None: +def test_issue35_1() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) - cdd.matrix_canonicalize(mat) + assert cdd.matrix_canonicalize(mat) == ({0}, None) + assert mat.array == [] def test_issue35_2() -> None: @@ -23,11 +24,17 @@ def test_issue35_3() -> None: def test_issue35_4() -> None: mat = cdd.matrix_from_array([], rep_type=cdd.RepType.INEQUALITY) - assert cdd.matrix_redundancy_remove(mat) == (set(), []) + assert cdd.matrix_canonicalize(mat) == (set(), set(), []) assert mat.array == [] def test_issue35_5() -> None: + mat = cdd.matrix_from_array([], rep_type=cdd.RepType.INEQUALITY) + assert cdd.matrix_redundancy_remove(mat) == (set(), []) + assert mat.array == [] + + +def test_issue35_6() -> None: mat = cdd.matrix_from_array([], rep_type=cdd.RepType.INEQUALITY) assert cdd.matrix_canonicalize_linearity(mat) == (set(), []) assert mat.array == [] From e2c248cf731da7b4ac5bfb0794a49bf097412217 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 19:45:27 +0100 Subject: [PATCH 11/16] Bump vcpkg. --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf373d0..bc85c9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: branches: [ develop ] env: - VCPKG_HASH: '5645ad4f3d73b652515ac8fdb50de70fdd331a34' + VCPKG_HASH: 'fdc2dae3058fcbc01df4c6249110cb66d67e5f18' jobs: build-sdist: @@ -85,7 +85,7 @@ jobs: id: vcpkg-installed-cache with: path: installed/ - key: vcpkg-1-${{ env.VCPKG_HASH }}-${{ matrix.os }} + key: vcpkg-0-${{ env.VCPKG_HASH }}-${{ matrix.os }} - uses: actions/checkout@v4 if: steps.vcpkg-installed-cache.outputs.cache-hit != 'true' with: From e72f6d0b9648e4e99e707e8019e59853c8ea539e Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 20:00:34 +0100 Subject: [PATCH 12/16] Test vcpkg without segfault patch to verify impact. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc85c9a..bdc382e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: branches: [ develop ] env: - VCPKG_HASH: 'fdc2dae3058fcbc01df4c6249110cb66d67e5f18' + VCPKG_HASH: 'c5c74afb7f478818827850348a9cccabbd5ae5d9' jobs: build-sdist: From 9cecb153c3112536f91278ed45c1a360e5be6c1e Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 21:27:21 +0100 Subject: [PATCH 13/16] Unmark test as skip. --- test/test_issue35.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/test_issue35.py b/test/test_issue35.py index 99caece..c62e302 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -2,8 +2,6 @@ import pytest -# this should not segfault -@pytest.mark.skip # temporarily disabled to check other tests def test_issue35_1() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) assert cdd.matrix_canonicalize(mat) == ({0}, None) From 27ee42d3c79c376a6f4db0c44762e29e82bac6ff Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 21:27:32 +0100 Subject: [PATCH 14/16] Revert "Test vcpkg without segfault patch to verify impact." This reverts commit e72f6d0b9648e4e99e707e8019e59853c8ea539e. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bdc382e..bc85c9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: branches: [ develop ] env: - VCPKG_HASH: 'c5c74afb7f478818827850348a9cccabbd5ae5d9' + VCPKG_HASH: 'fdc2dae3058fcbc01df4c6249110cb66d67e5f18' jobs: build-sdist: From 1d1d5b0f4a0daf78c74766587cd293ff5d1c2bff Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 21:35:15 +0100 Subject: [PATCH 15/16] Fix test. --- test/test_issue35.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_issue35.py b/test/test_issue35.py index c62e302..593871b 100644 --- a/test/test_issue35.py +++ b/test/test_issue35.py @@ -4,7 +4,7 @@ def test_issue35_1() -> None: mat = cdd.matrix_from_array([[0, 0, 0]], rep_type=cdd.RepType.INEQUALITY) - assert cdd.matrix_canonicalize(mat) == ({0}, None) + assert cdd.matrix_canonicalize(mat) == ({0}, set(), [None]) assert mat.array == [] From bb3b2a04ed962d43d61b9c77fc2ee5576dd30585 Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 24 Sep 2024 22:26:36 +0100 Subject: [PATCH 16/16] Add more NULL assignments. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc85c9a..c1e0985 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: branches: [ develop ] env: - VCPKG_HASH: 'fdc2dae3058fcbc01df4c6249110cb66d67e5f18' + VCPKG_HASH: '08efacc0dcaf652c44de424befa1fe97c91a4896' jobs: build-sdist: