Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Release smoke test: the app opens a model and sculpts (tests/ui/release_smoke.sfui); sculptforge-cli opens, sculpts, saves and reopens (tests/release_smoke.py); both also run under ctest

islandmed140a11e0835c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 961b720a..392e9dcf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -563,6 +563,9 @@ if(SCULPTFORGE_BUILD_TESTS)
-- --cli ${SCULPTFORGE_CLI_RUNNER})
set_tests_properties(blender_addon PROPERTIES TIMEOUT 300)
endif()
+ # The release smoke test (tests/release_smoke.py, run by release.yml on every package): open, sculpt, save, reopen.
+ add_test(NAME release_smoke COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/release_smoke.py
+ --cli ${SCULPTFORGE_CLI_RUNNER} --out ${CMAKE_CURRENT_BINARY_DIR}/release-smoke)
# Proof mode results: the validator and website list tool (tools/benchmark/submit.py, docs/benchmark.md).
add_test(NAME benchmark_submit COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark/submit.py selftest)
add_test(NAME guide_site COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/guide/build_site.py --check
diff --git a/tests/release_smoke.py b/tests/release_smoke.py
new file mode 100644
index 00000000..15582216
--- /dev/null
+++ b/tests/release_smoke.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+# SculptForge - open source digital sculpting
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Release smoke test for a packaged sculptforge-cli (.github/workflows/release.yml runs it on every installed or
+# unpacked package before anything is published; ctest runs it on the build tree): open a model, sculpt one stroke,
+# save a project, open that project again and check that it holds the sculpted mesh.
+#
+# python3 tests/release_smoke.py --cli path/to/sculptforge-cli [--out DIR]
+import argparse
+import os
+import re
+import subprocess
+import sys
+import tempfile
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+MODEL = os.path.join(HERE, "data", "marble-bust.glb") # 17456 triangles, about 0.27 x 0.52 x 0.30
+
+
+def run(cli, script):
+ p = subprocess.run([cli, "-c", script], capture_output=True, text=True, timeout=300)
+ sys.stdout.write(p.stdout)
+ sys.stderr.write(p.stderr)
+ if p.returncode != 0:
+ sys.exit(f"sculptforge-cli failed ({p.returncode}): {script}")
+ return p.stdout
+
+
+def vertices(path):
+ with open(path, encoding="utf-8") as f:
+ return [line for line in f if line.startswith("v ")]
+
+
+def main():
+ ap = argparse.ArgumentParser()
+ ap.add_argument("--cli", required=True)
+ ap.add_argument("--out")
+ a = ap.parse_args()
+ out = a.out or tempfile.mkdtemp(prefix="sf-release-smoke-")
+ os.makedirs(out, exist_ok=True)
+ before, after, again = (os.path.join(out, n) for n in ("before.obj", "after.obj", "reopened.obj"))
+ project = os.path.join(out, "smoke.sfproj")
+
+ # A Clay stroke across the face, drawn in front of it and projected onto the surface (front view).
+ run(a.cli, f'open path="{MODEL}"; save_obj path="{before}"; '
+ f'stroke brush=Clay points="-0.06,0.30,0.3 0.0,0.33,0.3 0.06,0.30,0.3" strength=1; '
+ f'save_project path="{project}"; save_obj path="{after}"')
+ info = run(a.cli, f'open path="{project}"; mesh_info; save_obj path="{again}"')
+
+ failures = []
+ if not os.path.getsize(project) > 0:
+ failures.append("the saved project is empty")
+ m = re.search(r"(\d+) triangles", info)
+ if not m or int(m.group(1)) != 17456:
+ failures.append(f"the reopened project should have 17456 triangles: {info.strip()}")
+ vb, va, vr = vertices(before), vertices(after), vertices(again)
+ if len(vb) != len(va) or not vb:
+ failures.append(f"vertex count changed by a sculpt stroke: {len(vb)} -> {len(va)}")
+ moved = sum(1 for x, y in zip(vb, va) if x != y)
+ if moved == 0:
+ failures.append("the stroke moved no vertex")
+ if va != vr:
+ failures.append("the reopened project's mesh differs from the one saved")
+ for f in failures:
+ print("FAILED:", f)
+ if failures:
+ return 1
+ print(f"release smoke: OK ({moved} vertices moved by the stroke, project {os.path.getsize(project)} bytes)")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tests/ui/release_smoke.sfui b/tests/ui/release_smoke.sfui
new file mode 100644
index 00000000..c1f0daab
--- /dev/null
+++ b/tests/ui/release_smoke.sfui
@@ -0,0 +1,9 @@
+# The release smoke test on the real UI (.github/workflows/release.yml runs it on every packaged app before
+# publishing; ctest runs it like any UI test): the app starts, opens a model dropped on the window and sculpts.
+drop ../data/marble-bust.glb
+expect_value triangles == 17456
+click "Clay##brush.clay"
+stroke 0.4 0.35 0.6 0.4
+expect_value can_undo == 1
+expect_value dirty == 1
+shot smoke