From 9166037aac674365f21c866ad8cd6ca0879849f7 Mon Sep 17 00:00:00 2001 From: Carlo Lemos Date: Wed, 25 Jun 2025 20:56:43 +0000 Subject: [PATCH 1/7] initial version of test running with some aditional setup we might want to drop --- projects/imagemagick/run_tests.sh | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/imagemagick/run_tests.sh diff --git a/projects/imagemagick/run_tests.sh b/projects/imagemagick/run_tests.sh new file mode 100644 index 000000000000..98a08c2d54ea --- /dev/null +++ b/projects/imagemagick/run_tests.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +# Usage: bash run_test.sh +# Runs all tests (same as 'make fate') and compiles if not compiled. + +set -e # Exit immediately if any command fails + +PROJECT_SRC_DIR="/src/imagemagick" + +echo "==> Changing to ImageMagick source directory: $PROJECT_SRC_DIR" +cd "$PROJECT_SRC_DIR" + +echo "==> Setup needed right now..." # DO NOT SUBMIT +./configure --with-quantum-depth=16 --disable-shared --enable-hdri=yes --with-frozenpaths=no +make -j$(nproc) +echo "==> Setup finished successfully." # DO NOT SUBMIT + +echo "==> Running all tests..." +make check +echo "==> Test run finished successfully." From 90f9dabfe7ebaceec6cb7b4b97254f99950f4c8b Mon Sep 17 00:00:00 2001 From: Carlo Lemos Date: Tue, 1 Jul 2025 20:10:29 +0000 Subject: [PATCH 2/7] update configure --- projects/imagemagick/run_tests.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/projects/imagemagick/run_tests.sh b/projects/imagemagick/run_tests.sh index 98a08c2d54ea..9979d76db176 100644 --- a/projects/imagemagick/run_tests.sh +++ b/projects/imagemagick/run_tests.sh @@ -20,14 +20,13 @@ set -e # Exit immediately if any command fails -PROJECT_SRC_DIR="/src/imagemagick" +PROJECT_SRC_DIR="$SRC/imagemagick" echo "==> Changing to ImageMagick source directory: $PROJECT_SRC_DIR" cd "$PROJECT_SRC_DIR" echo "==> Setup needed right now..." # DO NOT SUBMIT -./configure --with-quantum-depth=16 --disable-shared --enable-hdri=yes --with-frozenpaths=no -make -j$(nproc) +./configure echo "==> Setup finished successfully." # DO NOT SUBMIT echo "==> Running all tests..." From a102ef4263de2b20df147e60f4320c41fe74be8e Mon Sep 17 00:00:00 2001 From: Carlo Lemos Date: Tue, 1 Jul 2025 20:12:43 +0000 Subject: [PATCH 3/7] update docstring --- projects/imagemagick/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/imagemagick/run_tests.sh b/projects/imagemagick/run_tests.sh index 9979d76db176..780db17cac9e 100644 --- a/projects/imagemagick/run_tests.sh +++ b/projects/imagemagick/run_tests.sh @@ -16,7 +16,7 @@ ################################################################################ # Usage: bash run_test.sh -# Runs all tests (same as 'make fate') and compiles if not compiled. +# Runs all tests. set -e # Exit immediately if any command fails From 69041de9c84effa209600c18e28a53b79f69910f Mon Sep 17 00:00:00 2001 From: Carlo Lemos Date: Tue, 1 Jul 2025 20:18:20 +0000 Subject: [PATCH 4/7] add runtestsh to dockerfile --- projects/imagemagick/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/imagemagick/Dockerfile b/projects/imagemagick/Dockerfile index 2985ae6e13d5..8dd39fc8096f 100644 --- a/projects/imagemagick/Dockerfile +++ b/projects/imagemagick/Dockerfile @@ -36,4 +36,4 @@ RUN git clone --depth 1 --recursive https://github.com/libjxl/libjxl RUN git clone https://www.cl.cam.ac.uk/~mgk25/git/jbigkit # does not support shallow ADD https://lcamtuf.coredump.cx/afl/demo/afl_testcases.tgz afl_testcases.tgz WORKDIR imagemagick -COPY build.sh $SRC/ +COPY build.sh run_tests.sh $SRC/ From 2e11e93e1dbed21f33b0f04db74e7c6d149c2a3d Mon Sep 17 00:00:00 2001 From: Carlo Lemos <55899543+vitaliset@users.noreply.github.com> Date: Sun, 13 Jul 2025 20:24:26 -0300 Subject: [PATCH 5/7] olivers suggestion to fix errors --- projects/imagemagick/run_tests.sh | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/projects/imagemagick/run_tests.sh b/projects/imagemagick/run_tests.sh index 780db17cac9e..f9392568106e 100644 --- a/projects/imagemagick/run_tests.sh +++ b/projects/imagemagick/run_tests.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# Copyright 2025 Google LLC +#!/bin/sh -e +# Copyright 2025 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,20 +15,7 @@ # ################################################################################ -# Usage: bash run_test.sh -# Runs all tests. +rgrep --files-with-matches '\-lheif' . \ + | xargs -r sed -i 's/-lheif/-lheif -lc++/' -set -e # Exit immediately if any command fails - -PROJECT_SRC_DIR="$SRC/imagemagick" - -echo "==> Changing to ImageMagick source directory: $PROJECT_SRC_DIR" -cd "$PROJECT_SRC_DIR" - -echo "==> Setup needed right now..." # DO NOT SUBMIT -./configure -echo "==> Setup finished successfully." # DO NOT SUBMIT - -echo "==> Running all tests..." -make check -echo "==> Test run finished successfully." +make -j"$(nproc)" check From 621f62fea4a2acc6d9978b7814573cb9ca92d3b7 Mon Sep 17 00:00:00 2001 From: Carlo Lemos <55899543+vitaliset@users.noreply.github.com> Date: Thu, 17 Jul 2025 00:21:43 -0300 Subject: [PATCH 6/7] undo patches command --- projects/imagemagick/run_tests.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/imagemagick/run_tests.sh b/projects/imagemagick/run_tests.sh index f9392568106e..58a0c21fe9a6 100644 --- a/projects/imagemagick/run_tests.sh +++ b/projects/imagemagick/run_tests.sh @@ -18,4 +18,8 @@ rgrep --files-with-matches '\-lheif' . \ | xargs -r sed -i 's/-lheif/-lheif -lc++/' -make -j"$(nproc)" check +make -j"$(nproc)" check-TESTS + +# Undo patches. +rgrep --files-with-matches -- '-lheif -lc++' . \ + | xargs -r sed -i 's/-lheif -lc++/-lheif/' From 4d37c372c29d9bb6e89f697b4595280406ff426a Mon Sep 17 00:00:00 2001 From: Carlo Lemos <55899543+vitaliset@users.noreply.github.com> Date: Thu, 17 Jul 2025 00:35:56 -0300 Subject: [PATCH 7/7] adding todo --- projects/imagemagick/run_tests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/imagemagick/run_tests.sh b/projects/imagemagick/run_tests.sh index 58a0c21fe9a6..a3f05eff4339 100644 --- a/projects/imagemagick/run_tests.sh +++ b/projects/imagemagick/run_tests.sh @@ -18,6 +18,8 @@ rgrep --files-with-matches '\-lheif' . \ | xargs -r sed -i 's/-lheif/-lheif -lc++/' +# TODO: `make check` is preferred over `make check-TESTS`, as it is the public +# interface for comprehensive testing of ImageMagick. make -j"$(nproc)" check-TESTS # Undo patches.