Skip to content

Commit

Permalink
Better regenerate process
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 27, 2024
1 parent 021fb53 commit 44a2061
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ contribs/dist: .build/build-dll.timestamp
mkdir -p $(dir $@)
CI=true LANGUAGE=en_US buildtools/retry node buildtools/check-example.js \
.build/examples-hosted/$*.html
buildtools/check-example .build/examples-hosted/$*.html.png examples/$*-ref.png
buildtools/check-example --generate .build/examples-hosted/$*.html.png examples/$*-ref.png
touch $@

.build/error.check.timestamp: .build/examples-ngeo.timestamp \
Expand All @@ -310,15 +310,15 @@ contribs/dist: .build/build-dll.timestamp
mkdir -p $(dir $@)
CI=true LANGUAGE=en_US buildtools/retry node buildtools/check-example.js \
.build/examples-hosted/contribs/gmf/$*.html
buildtools/check-example .build/examples-hosted/contribs/gmf/$*.html.png contribs/gmf/examples/$*-ref.png
buildtools/check-example --generate .build/examples-hosted/contribs/gmf/$*.html.png contribs/gmf/examples/$*-ref.png
touch $@

.build/contribs/gmf/apps/%.check.timestamp: .build/gmf-apps.timestamp \
.build/httpserver.timestamp
mkdir -p $(dir $@)
CI=true LANGUAGE=en_US buildtools/retry node buildtools/check-example.js \
.build/examples-hosted/contribs/gmf/apps/$*.html
buildtools/check-example .build/examples-hosted/contribs/gmf/apps/$*.html.png contribs/gmf/apps/$*-ref.png
buildtools/check-example --generate .build/examples-hosted/contribs/gmf/apps/$*.html.png contribs/gmf/apps/$*-ref.png
touch $@

.build/test-check-example/%.check.timestamp: \
Expand Down
15 changes: 9 additions & 6 deletions buildtools/check-example
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import argparse
import os
import shutil
import subprocess
Expand All @@ -42,6 +43,10 @@ def main():
Optional mask image (name from Reference image): examples/simple-mask.png
Generate diff image (name from Generated image): .build/examples-hosted/simple-diff.png
"""
parser = argparse.ArgumentParser(description=main.__doc__)
parser.add_argument("--generate", action="store_true", help="Regenerate the ref image")
args = parser.parse_args()

current = sys.argv[1]
ref = sys.argv[2]
mask = ref.replace("-ref", "-mask")
Expand All @@ -56,12 +61,10 @@ def main():
subprocess.run(["gm", "composite", "-compose", "Multiply", old_current, mask, current], check=True)
subprocess.run(["gm", "composite", "-compose", "Multiply", old_ref, mask, ref], check=True)

# Set to True to regenerate ref images
if False:
if "/error-" not in ref:
shutil.copyfile(current, old_ref)
shutil.copyfile(current, ref)
sys.exit(0)
if args.generate and "/error-" not in ref:
shutil.copyfile(current, old_ref)
shutil.copyfile(current, ref)
sys.exit(0)
result = subprocess.run(
[
"gm",
Expand Down

0 comments on commit 44a2061

Please sign in to comment.