Before I take a dive into the code on github...
What is the basic methodology of creating and running automated tests of
OpenSCAD?
How does one verify that a module actually makes the correct shape, without
visual inspection?
Thanks!
Len
On 10/9/25 9:20 AM, Leonard Martin Struttmann via Discuss wrote:
Before I take a dive into the code on github...
What is the basic methodology of creating and running automated tests
of OpenSCAD?
How does one verify that a module actually makes the correct shape,
without visual inspection?
There are tests which do visual comparisons.
Look under tests directory.
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Linux/UNIX#Compiling_the_test_suite
This one might be stale:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Windows#Compiling_the_regression_tests
Attached please find the script that I use to run the tests. I usually
run it under MSYS2 on Windows. I haven't run it on Linux in a long
time, but I think it used to work there. From inside the repo, say
"osc.tests <build dir> [ <ctest args> ]".
You can find this and a few other things (some useful, some not) at
https://github.com/jordanbrown0/tools
In particular, there are
osclone - clone an OpenSCAD repo and fully set it up for builds.
osc.cmk - run cmake to create makefiles
osc.mk - build
Just running ctest from the build directory will run the tests. I use ctest -j 8 on my laptop. Unlike the build, these use very little memory and are cpu-bound.
IIRC make tests/all will (re-)build them.
-Cory
On October 9, 2025 10:03:33 AM PDT, Jordan Brown via Discuss discuss@lists.openscad.org wrote:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Linux/UNIX#Compiling_the_test_suite
This one might be stale:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Windows#Compiling_the_regression_tests
Attached please find the script that I use to run the tests. I usually
run it under MSYS2 on Windows. I haven't run it on Linux in a long
time, but I think it used to work there. From inside the repo, say
"osc.tests <build dir> [ <ctest args> ]".
You can find this and a few other things (some useful, some not) at
https://github.com/jordanbrown0/tools
In particular, there are
osclone - clone an OpenSCAD repo and fully set it up for builds.
osc.cmk - run cmake to create makefiles
osc.mk - build
My goal is to write some regression tests for my own personal library and I
wanted to see how the "pros" do it. :-)
On Thu, Oct 9, 2025 at 5:27 PM Cory Cross via Discuss <
discuss@lists.openscad.org> wrote:
Just running ctest from the build directory will run the tests. I use
ctest -j 8 on my laptop. Unlike the build, these use very little memory
and are cpu-bound.
IIRC make tests/all will (re-)build them.
-Cory
On October 9, 2025 10:03:33 AM PDT, Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Linux/UNIX#Compiling_the_test_suite
This one might be stale:
Attached please find the script that I use to run the tests. I usually
run it under MSYS2 on Windows. I haven't run it on Linux in a long time,
but I think it used to work there. From inside the repo, say "osc.tests
<build dir> [ <ctest args> ]".
You can find this and a few other things (some useful, some not) at
https://github.com/jordanbrown0/tools
In particular, there are
osclone - clone an OpenSCAD repo and fully set it up for builds.
osc.cmk - run cmake to create makefiles
osc.mk - build
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On Oct 9, 2025, at 19:55, Leonard Martin Struttmann via Discuss discuss@lists.openscad.org wrote:
My goal is to write some regression tests for my own personal library and I wanted to see how the "pros" do it. :-)
In terms of the technical solution:
What we do is a bit suboptimal; we take a screenshot (render to PNG) from a single angle, then compare with a golden image with some fuzzy image compare. “Fuzzy” has evolved over time and currently uses a pretty small Python script: https://github.com/openscad/openscad/blob/master/tests/image_compare.py
The whole thing is driven my CMake/CTest using some very custom scripts and CMake functions. It’s very much not recommended to copy any of the scripts, but if you go all the way back to the start of the framework, you may be able to find a more minimal configuration: https://github.com/openscad/openscad/commit/9642787a2710324be48d99505a83f0d1f9f83a90
-Marius
On 10/9/25 4:55 PM, Leonard Martin Struttmann via Discuss wrote:
My goal is to write some regression tests for my own personal library
and I wanted to see how the "pros" do it. :-)
Aha. Check out BOSL2 too then.
Cory
On Thu, Oct 9, 2025 at 5:27 PM Cory Cross via Discuss
discuss@lists.openscad.org wrote:
Just running `ctest` from the build directory will run the tests.
I use `ctest -j 8` on my laptop. Unlike the build, these use very
little memory and are cpu-bound.
IIRC `make tests/all` will (re-)build them.
-Cory
On October 9, 2025 10:03:33 AM PDT, Jordan Brown via Discuss
<discuss@lists.openscad.org> wrote:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Linux/UNIX#Compiling_the_test_suite
This one might be stale:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Windows#Compiling_the_regression_tests
Attached please find the script that I use to run the tests.
I usually run it under MSYS2 on Windows. I haven't run it on
Linux in a long time, but I think it used to work there. From
inside the repo, say "osc.tests <build dir> [ <ctest args> ]".
You can find this and a few other things (some useful, some
not) at
https://github.com/jordanbrown0/tools
In particular, there are
osclone - clone an OpenSCAD repo and fully set it up for builds.
osc.cmk - run cmake to create makefiles
osc.mk <http://osc.mk> - build
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org
Obvious (simplistic) answer is to generate the same examples with both old and new versions and difference the results.
Is there a way to detect a “null model” besides just looking at the screen? Plan B would be to do a ‘diff’ on the output STLs.
Just tried it with two identical cubes: Console shows “CGAL cache size in bytes” of 0 for both preview and render…not sure if that’s definitive.
But trying to export the STL gives “ERROR: Current top level object is empty”, which might be detectable programmatically.
From: Leonard Martin Struttmann via Discuss discuss@lists.openscad.org
Sent: Thursday, October 9, 2025 4:56 PM
To: OpenSCAD general discussion Mailing-list discuss@lists.openscad.org
Cc: Leonard Martin Struttmann lenstruttmann@gmail.com
Subject: [OpenSCAD] Re: Automated Testing
My goal is to write some regression tests for my own personal library and I wanted to see how the "pros" do it. :-)
On Thu, Oct 9, 2025 at 5:27 PM Cory Cross via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org > wrote:
Just running ctest from the build directory will run the tests. I use ctest -j 8 on my laptop. Unlike the build, these use very little memory and are cpu-bound.
IIRC make tests/all will (re-)build them.
-Cory
On October 9, 2025 10:03:33 AM PDT, Jordan Brown via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org > wrote:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Linux/UNIX#Compiling_the_test_suite
This one might be stale:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Windows#Compiling_the_regression_tests
Attached please find the script that I use to run the tests. I usually run it under MSYS2 on Windows. I haven't run it on Linux in a long time, but I think it used to work there. From inside the repo, say "osc.tests <build dir> [ <ctest args> ]".
You can find this and a few other things (some useful, some not) at
https://github.com/jordanbrown0/tools
In particular, there are
osclone - clone an OpenSCAD repo and fully set it up for builds.
osc.cmk - run cmake to create makefiles
osc.mk http://osc.mk - build
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org
Actually BOSL2 doesn't have any automated checks on geometry output. There
are regression tests for function outputs, but not modules. The only check
on module correctness is the documentation wiki. If we see something wonky
in there---or if it fails to process---then we know we've caught a bug.
On Thu, Oct 9, 2025 at 9:02 PM Cory Cross via Discuss <
discuss@lists.openscad.org> wrote:
On 10/9/25 4:55 PM, Leonard Martin Struttmann via Discuss wrote:
My goal is to write some regression tests for my own personal library and
I wanted to see how the "pros" do it. :-)
Aha. Check out BOSL2 too then.
Cory
On Thu, Oct 9, 2025 at 5:27 PM Cory Cross via Discuss <
discuss@lists.openscad.org> wrote:
Just running ctest from the build directory will run the tests. I use
ctest -j 8 on my laptop. Unlike the build, these use very little memory
and are cpu-bound.
IIRC make tests/all will (re-)build them.
-Cory
On October 9, 2025 10:03:33 AM PDT, Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Linux/UNIX#Compiling_the_test_suite
This one might be stale:
Attached please find the script that I use to run the tests. I usually
run it under MSYS2 on Windows. I haven't run it on Linux in a long time,
but I think it used to work there. From inside the repo, say "osc.tests
<build dir> [ <ctest args> ]".
You can find this and a few other things (some useful, some not) at
https://github.com/jordanbrown0/tools
In particular, there are
osclone - clone an OpenSCAD repo and fully set it up for builds.
osc.cmk - run cmake to create makefiles
osc.mk - build
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Ok, thanks, everyone for the ideas. I am going to start (I'm running on
MacOS) by writing a bunch of zsh scripts that generate .OBJ files and will
compare them to previously generated "golden" files.
This should be interesting...
On Thu, Oct 9, 2025 at 8:35 PM Adrian Mariano via Discuss <
discuss@lists.openscad.org> wrote:
Actually BOSL2 doesn't have any automated checks on geometry output.
There are regression tests for function outputs, but not modules. The only
check on module correctness is the documentation wiki. If we see something
wonky in there---or if it fails to process---then we know we've caught a
bug.
On Thu, Oct 9, 2025 at 9:02 PM Cory Cross via Discuss <
discuss@lists.openscad.org> wrote:
On 10/9/25 4:55 PM, Leonard Martin Struttmann via Discuss wrote:
My goal is to write some regression tests for my own personal library and
I wanted to see how the "pros" do it. :-)
Aha. Check out BOSL2 too then.
Cory
On Thu, Oct 9, 2025 at 5:27 PM Cory Cross via Discuss <
discuss@lists.openscad.org> wrote:
Just running ctest from the build directory will run the tests. I use
ctest -j 8 on my laptop. Unlike the build, these use very little memory
and are cpu-bound.
IIRC make tests/all will (re-)build them.
-Cory
On October 9, 2025 10:03:33 AM PDT, Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Linux/UNIX#Compiling_the_test_suite
This one might be stale:
Attached please find the script that I use to run the tests. I usually
run it under MSYS2 on Windows. I haven't run it on Linux in a long time,
but I think it used to work there. From inside the repo, say "osc.tests
<build dir> [ <ctest args> ]".
You can find this and a few other things (some useful, some not) at
https://github.com/jordanbrown0/tools
In particular, there are
osclone - clone an OpenSCAD repo and fully set it up for builds.
osc.cmk - run cmake to create makefiles
osc.mk - build
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org