All of lore.kernel.org
 help / color / mirror / Atom feed
* [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
@ 2025-10-28 10:28 AshishKumar Mishra
  2025-10-29 12:30 ` Ashish Mishra
  0 siblings, 1 reply; 11+ messages in thread
From: AshishKumar Mishra @ 2025-10-28 10:28 UTC (permalink / raw)
  To: openembedded-devel; +Cc: AshishKumar Mishra

The logic used is :
- We check if the required tools are present or not
- We used convert to create an raw RGB file
- The created RGB is then converted to PNG using convert
- We re-gerenate RGB from PNG and compare the original and re-generated RGB
- Enabled the ptest in ptest-packagelists-meta-oe.inc as
  suggested by Gyorgy Sarvari and incorporated logging suggestion
- This was done as standard imagemagick test like drawtest requires manual
  internetion to verify the file.

Signed-off-by: AshishKumar Mishra <ashishkumar.mishra@bmwtechworks.in>
---
 .../include/ptest-packagelists-meta-oe.inc    |   1 +
 .../imagemagick/imagemagick-ptest.sh          | 128 ++++++++++++++++++
 .../imagemagick/imagemagick/run-ptest         |  43 ++++++
 .../imagemagick/imagemagick_7.1.1.bb          |  14 +-
 4 files changed, 184 insertions(+), 2 deletions(-)
 create mode 100755 meta-oe/recipes-support/imagemagick/imagemagick/imagemagick-ptest.sh
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/run-ptest

diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
index 639daec992..36b2723e1b 100644
--- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
+++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
@@ -14,6 +14,7 @@ PTESTS_FAST_META_OE = "\
     function2 \
     fwupd \
     gcab \
+    imagemagick \
     jemalloc \
     jq \
     leveldb \
diff --git a/meta-oe/recipes-support/imagemagick/imagemagick/imagemagick-ptest.sh b/meta-oe/recipes-support/imagemagick/imagemagick/imagemagick-ptest.sh
new file mode 100755
index 0000000000..2afc2ff246
--- /dev/null
+++ b/meta-oe/recipes-support/imagemagick/imagemagick/imagemagick-ptest.sh
@@ -0,0 +1,128 @@
+#!/bin/sh
+#
+# ImageMagick ptest:
+# We ceate an BASERGB file for our usage using "convert"
+# We convert this RGB file to BASEPNG
+# Using BASEPNG we recreate RGB named REGENERATEDRGB
+#
+# BASERGB to BASEPNG to REGENERATEDRGB
+# - Then compare  BASERGB with REGENERATEDRGB
+#
+# 1) We are checking if the binaries are present in RFS or not
+# 2) We Created an RBG of size : WIDTH x HEIGHT pixels
+# 3) Return value is captured after every major actio to capture the status
+# 4) cmp -s is used to compare binary byte by byte data and
+#    capture only exit status
+# 5) Important parametsrs used are :
+#    -depth                     : How many bits for each colour pixel
+#    -alpha off  		: Don't consider transparency
+#    -define png:color-type=2   : Make PNG work with truecolour RGB
+#    -strip 			: Remove all non-pixel metadata og PNG
+#                                 so file is reproducible
+#    -set gamma 1.0             : No PNG brightness correction
+#     gradient:red-blue         : Data moves liberly from RED to Blue vertically
+
+
+WIDTH=16
+HEIGHT=16
+BASERGB=base.rgb
+BASEPNG=base.png
+REGENERATEDRGB=roundtrip.rgb
+
+echo "[DEBUG] Starting ImageMagick Ptest with ${WIDTH}x${HEIGHT} pixels "
+
+# Verify required binaries
+for bin in convert cmp wc rm; do
+    if [ -z "$(command -v "$bin" 2>/dev/null)" ]; then
+        echo "[ERROR] Required binary '$bin' not found $PATH"
+        exit 127
+    fi
+done
+
+# Generate raw RGB
+convert -size ${WIDTH}x${HEIGHT} -depth 8 -type TrueColor \
+    -alpha off -define png:color-type=2 \
+    -strip -set gamma 1.0 \
+    gradient:red-blue rgb:${BASERGB}
+
+returnvalue=$?
+if [ "$returnvalue" -ne 0 ]; then
+    echo "[FAIL] Failed to generate RGB pattern "
+    exit 1
+else
+    echo "[DEBUG] Generated raw RGB ${BASERGB} for test case"
+fi
+
+
+
+# Convert raw RGB to PNG
+convert -size ${WIDTH}x${HEIGHT} -depth 8 -type TrueColor \
+    -alpha off -define png:color-type=2 \
+    -strip -set gamma 1.0 \
+    rgb:${BASERGB} ${BASEPNG}
+
+returnvalue=$?
+if [ $returnvalue -ne 0 ]; then
+    echo "[FAIL] Failed to convert RGB to PNG"
+    rm -f ${BASERGB}
+    exit 1
+else
+    echo "[DEBUG] ${BASEPNG}  generated from ${BASERGB}"
+fi
+
+
+
+# Regenrate raw RGB from PNG
+convert -size ${WIDTH}x${HEIGHT} -depth 8 -type TrueColor \
+    -alpha off -define png:color-type=2 \
+    -strip -set gamma 1.0 \
+    ${BASEPNG} rgb:${REGENERATEDRGB}
+
+returnvalue=$?
+if [ $returnvalue -ne 0 ]; then
+    echo "[FAIL] Failed to re generate RGB from PNG "
+    rm -f ${BASERGB} ${BASEPNG}
+    exit 1
+else
+    echo "[DEBUG] ${REGENERATEDRGB} generated from ${BASEPNG}"
+fi
+
+
+
+# Compare original and recreated RGB
+if cmp -s ${BASERGB} ${REGENERATEDRGB}; then
+    echo "[PASS] RGB data identical after PNG round-trip"
+    RESULT=0
+else
+    echo "[FAIL] RGB mismatch detected, printing their size "
+    echo "[INFO] Base RGB size: $(wc -c < ${BASERGB}) bytes"
+    echo "[INFO] Round-trip RGB size: $(wc -c < ${REGENERATEDRGB}) bytes"
+    RESULT=1
+fi
+
+
+
+# Checking the identify tool from imagemagick to get the PNG metadata
+# True is added in end to ensure that test script doesnt fail even if
+# identify fails for any reason
+echo "[DEBUG] PNG file info:"
+identify -verbose ${BASEPNG} | grep -E "Depth|Type|Colorspace" || true
+
+
+
+# Cleanup of files create by test code
+echo "[DEBUG] Cleaning up temporary files"
+rm -f ${BASERGB} ${BASEPNG} ${REGENERATEDRGB}
+returnvalue=$?
+echo "[DEBUG] Cleanup exit=$returnvalue"
+
+
+# Logging the final result
+if [ ${RESULT} -eq 0 ]; then
+    echo "[DEBUG]: imagemagick-ptest.sh sucessfull "
+else
+    echo "[DEBUG]: imagemagick-ptest.sh failed "
+fi
+
+
+exit ${RESULT}
diff --git a/meta-oe/recipes-support/imagemagick/imagemagick/run-ptest b/meta-oe/recipes-support/imagemagick/imagemagick/run-ptest
new file mode 100644
index 0000000000..75251a803f
--- /dev/null
+++ b/meta-oe/recipes-support/imagemagick/imagemagick/run-ptest
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# run-ptest — ImageMagick ptest harness
+# POSIX-safe and BusyBox compatible
+
+PTDIR=$(dirname "$0")
+TESTDIR="$PTDIR"
+PASSCOUNT=0
+FAILCOUNT=0
+TOTAL=0
+
+echo "======================================="
+echo "ImageMagick ptest: Runtime Validation"
+echo "======================================="
+
+for t in "$TESTDIR"/*.sh; do
+    [ -x "$t" ] || chmod +x "$t"
+    TOTAL=$((TOTAL + 1))
+    echo
+    echo "[DEBUG] Launching test script $t"
+
+    if sh "$t" 2>&1; then
+        echo "PASS: $(basename "$t")"
+        PASSCOUNT=$((PASSCOUNT + 1))
+    else
+        rc=$?
+        if [ "$rc" -eq 77 ]; then
+            echo "SKIP: $(basename "$t")"
+        else
+            echo "FAIL: $(basename "$t")"
+            FAILCOUNT=$((FAILCOUNT + 1))
+        fi
+    fi
+
+done
+
+echo
+echo "======================================="
+echo "[SUMMARY] Total: $TOTAL | PASS: $PASSCOUNT | FAIL: $FAILCOUNT"
+echo "======================================="
+echo
+[ "$FAILCOUNT" -eq 0 ]
+
diff --git a/meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb b/meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb
index 752fef303b..dd199902bd 100644
--- a/meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb
+++ b/meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb
@@ -11,12 +11,15 @@ DEPENDS = "lcms bzip2 jpeg libpng tiff zlib fftw freetype libtool"
 
 BASE_PV := "${PV}"
 PV .= "-26"
-SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=https"
+SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=https \
+           file://run-ptest \
+           file://imagemagick-ptest.sh \
+"
 SRCREV = "570a9a048bb0e3a5c221ca87be9408ae35f711e2"
 
 S = "${WORKDIR}/git"
 
-inherit autotools pkgconfig update-alternatives
+inherit autotools pkgconfig update-alternatives ptest
 export ac_cv_sys_file_offset_bits="64"
 
 EXTRA_OECONF = "--program-prefix= --program-suffix=.im7 --without-perl --enable-largefile"
@@ -56,6 +59,13 @@ do_install:append:class-target() {
     fi
 }
 
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}
+    install -m 0755 ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/
+    install -m 0755 ${WORKDIR}/imagemagick-ptest.sh ${D}${PTEST_PATH}/
+}
+
+
 FILES:${PN} += "${libdir}/ImageMagick-${BASE_PV}/config-Q16* \
                 ${datadir}/ImageMagick-7"
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-10-28 10:28 [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe AshishKumar Mishra
@ 2025-10-29 12:30 ` Ashish Mishra
  2025-10-29 12:49   ` [oe] " Gyorgy Sarvari
  0 siblings, 1 reply; 11+ messages in thread
From: Ashish Mishra @ 2025-10-29 12:30 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

Dear Team ,
Please do let me know if any suggestion on this .
I will work on the implementation accordingly and share the patch.

Thanks ,
Ashish Kumar Mishra

[-- Attachment #2: Type: text/html, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [oe] [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-10-29 12:30 ` Ashish Mishra
@ 2025-10-29 12:49   ` Gyorgy Sarvari
  2025-10-30  5:14     ` AshishKumar Mishra
  0 siblings, 1 reply; 11+ messages in thread
From: Gyorgy Sarvari @ 2025-10-29 12:49 UTC (permalink / raw)
  To: emailaddress.ashish, openembedded-devel

On 10/29/25 13:30, Ashish Mishra via lists.openembedded.org wrote:
> Dear Team ,
> Please do let me know if any suggestion on this .
> I will work on the implementation accordingly and share the patch.

There would be 2 notes, about technicalities:
1. Don't forget to include the target layer in the subject of your patch
message (meta-oe, meta-gnome etc...) - there are some who look for
patches by these tags.
2. All patches that are applicable for master branch should go to master
branch first, and to stable branch second. That way the improvement will
be present in later versions too.

>  
> Thanks ,
> Ashish Kumar Mishra
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-10-29 12:49   ` [oe] " Gyorgy Sarvari
@ 2025-10-30  5:14     ` AshishKumar Mishra
  2025-11-03  4:48       ` AshishKumar Mishra
  0 siblings, 1 reply; 11+ messages in thread
From: AshishKumar Mishra @ 2025-10-30  5:14 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

Sure Gyorgy  Sarvari,

1) Will add layer details in patch as we go ahead
2) w.r.t patch on master ,
Imagemagick in master will use magick ( scarthgap and lower version uses convert )
I will push patch for master branch today if possible .
Also the master imagemagick had an issue for which i have share the patch
@ https://lists.openembedded.org/g/openembedded-devel/topic/patch_imagemagick_add/116011305

Thanks for taking time and sharing feedback .
- Ashish Kumar Mishra

[-- Attachment #2: Type: text/html, Size: 850 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-10-30  5:14     ` AshishKumar Mishra
@ 2025-11-03  4:48       ` AshishKumar Mishra
  2025-11-04  9:29         ` Ashish Mishra
  0 siblings, 1 reply; 11+ messages in thread
From: AshishKumar Mishra @ 2025-11-03  4:48 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

Dear Team ,

Can this patch be please considered for merge on scarthgap branch .
I can re-work and share the updated patch if team has any suggestion on this

Thanks ,
Ashish Kumar Mishra

[-- Attachment #2: Type: text/html, Size: 297 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-11-03  4:48       ` AshishKumar Mishra
@ 2025-11-04  9:29         ` Ashish Mishra
  2025-11-06  5:16           ` AshishKumar Mishra
  0 siblings, 1 reply; 11+ messages in thread
From: Ashish Mishra @ 2025-11-04  9:29 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 216 bytes --]

Dear Anuj / Gyorgy  Sarvari ,

Can we please take this patch for merge in scarthgap .
Do let me know if team wants any improvement or suggestion , will share updated accordingly

Thanks ,
Ashish Kumar Mishra

[-- Attachment #2: Type: text/html, Size: 3072 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-11-04  9:29         ` Ashish Mishra
@ 2025-11-06  5:16           ` AshishKumar Mishra
  2025-11-06  5:59             ` [oe] " Anuj Mittal
  0 siblings, 1 reply; 11+ messages in thread
From: AshishKumar Mishra @ 2025-11-06  5:16 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

Dear Anuj / Gyorgy Sarvari,

Can you please consider this patch for merge in scarthgap ?
or if you feel any re-work is required , i can work accordingly

Thanks ,
Ashish

[-- Attachment #2: Type: text/html, Size: 2456 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [oe] [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-11-06  5:16           ` AshishKumar Mishra
@ 2025-11-06  5:59             ` Anuj Mittal
  2025-11-06  9:39               ` Ashish Mishra
  0 siblings, 1 reply; 11+ messages in thread
From: Anuj Mittal @ 2025-11-06  5:59 UTC (permalink / raw)
  To: ashishkumar.mishra; +Cc: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

Hi,

On Thu, Nov 6, 2025 at 1:16 PM AshishKumar Mishra via lists.openembedded.org
<ashishkumar.mishra=bmwtechworks.in@lists.openembedded.org> wrote:

> Dear Anuj / Gyorgy Sarvari,
>
> Can you please consider this patch for merge in scarthgap ?
> or if you feel any re-work is required , i can work accordingly
>
>
This isn't merged in master yet so this needs to go there first before a
backport is requested. Adding ptests doesn't fall under what is allowed for
stable/LTS branches. Can you please justify why it is needed for scarthgap?

[-- Attachment #2: Type: text/html, Size: 2253 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-11-06  5:59             ` [oe] " Anuj Mittal
@ 2025-11-06  9:39               ` Ashish Mishra
  2025-11-10  9:38                 ` AshishKumar Mishra
  0 siblings, 1 reply; 11+ messages in thread
From: Ashish Mishra @ 2025-11-06  9:39 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

Dear Anuj ,

1) For scarthgap imagemagick version uses "convert" binary for its central operations whereas latest version of imagemagick uses "magick" [ in master ]

master       : *"magick"   is central binary and all other supporting binaries are symlink to it*
scarthgap  : *"convert" is central binary and all other supporting binaries are symlink to it*

2) Have created same ptest (with "magick" ) for master branch @ https://lists.openembedded.org/g/openembedded-devel/topic/meta_oe_master_patch_v2/116149980
This causes same patch logic but with respective central binaries to be used in their respective branches

3) I can rework on logic if any suggestion from team or if there is another suggested approach for such scenario

Thanks ,

Ashish Kumar Mishra

[-- Attachment #2: Type: text/html, Size: 11277 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-11-06  9:39               ` Ashish Mishra
@ 2025-11-10  9:38                 ` AshishKumar Mishra
  2025-11-12  2:40                   ` [oe] " Anuj Mittal
  0 siblings, 1 reply; 11+ messages in thread
From: AshishKumar Mishra @ 2025-11-10  9:38 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

Hi Anuj,
Can you please consider this patch for scarthgap .
Have shared the details why master and scarthgap are having difference @https://lists.openembedded.org/g/openembedded-devel/message/121362

Please feel free to share feedback if any, i can work accordingly and reshare the patch

Thanks,
Ashish

[-- Attachment #2: Type: text/html, Size: 435 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [oe] [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe
  2025-11-10  9:38                 ` AshishKumar Mishra
@ 2025-11-12  2:40                   ` Anuj Mittal
  0 siblings, 0 replies; 11+ messages in thread
From: Anuj Mittal @ 2025-11-12  2:40 UTC (permalink / raw)
  To: ashishkumar.mishra; +Cc: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 682 bytes --]

H Ashish

On Mon, Nov 10, 2025 at 5:38 PM AshishKumar Mishra via
lists.openembedded.org <ashishkumar.mishra=
bmwtechworks.in@lists.openembedded.org> wrote:

> Hi Anuj,
> Can you please consider this patch for scarthgap .
> Have shared the details why master and scarthgap are having difference @
> https://lists.openembedded.org/g/openembedded-devel/message/121362
>

I had replied last time:
https://lists.openembedded.org/g/openembedded-devel/message/121358

Adding ptests doesn't fall under what is generally acceptable for a
stable/LTS branch:
https://wiki.yoctoproject.org/wiki/Stable_Release_and_LTS#Stable/LTS_Patch_Acceptance_Policies

Thanks,

Anuj

[-- Attachment #2: Type: text/html, Size: 1692 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-12  2:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 10:28 [scarthgap][PATCH v2] imagemagick: adds ptest for imagemagick recipe AshishKumar Mishra
2025-10-29 12:30 ` Ashish Mishra
2025-10-29 12:49   ` [oe] " Gyorgy Sarvari
2025-10-30  5:14     ` AshishKumar Mishra
2025-11-03  4:48       ` AshishKumar Mishra
2025-11-04  9:29         ` Ashish Mishra
2025-11-06  5:16           ` AshishKumar Mishra
2025-11-06  5:59             ` [oe] " Anuj Mittal
2025-11-06  9:39               ` Ashish Mishra
2025-11-10  9:38                 ` AshishKumar Mishra
2025-11-12  2:40                   ` [oe] " Anuj Mittal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.