summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/conf/include/ptest-packagelists-meta-oe.inc1
-rwxr-xr-xmeta-oe/recipes-support/imagemagick/imagemagick/imagemagick-ptest.sh132
-rw-r--r--meta-oe/recipes-support/imagemagick/imagemagick/run-ptest43
-rw-r--r--meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-8.bb15
4 files changed, 189 insertions, 2 deletions
diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
index 0a5bbf5fe5..a685510359 100644
--- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
+++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
@@ -16,6 +16,7 @@ PTESTS_FAST_META_OE = "\
16 function2 \ 16 function2 \
17 fwupd \ 17 fwupd \
18 gcab \ 18 gcab \
19 imagemagick \
19 jemalloc \ 20 jemalloc \
20 jq \ 21 jq \
21 leveldb \ 22 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..08595837d6
--- /dev/null
+++ b/meta-oe/recipes-support/imagemagick/imagemagick/imagemagick-ptest.sh
@@ -0,0 +1,132 @@
1#!/bin/sh
2#
3# ImageMagick ptest:
4# We ceate an BASERGB file for our usage using "magick"
5# We convert this RGB file to BASEPNG
6# Using BASEPNG we recreate RGB named REGENERATEDRGB
7#
8# BASERGB to BASEPNG to REGENERATEDRGB
9# - Then compare BASERGB with REGENERATEDRGB
10#
11# 0) The convert command is deprecated in IMv7
12# used "magick" instead of "convert"
13# 1) We are checking if the binaries are present in RFS or not
14# 2) We Created an RBG of size : WIDTH x HEIGHT pixels
15# 3) Return value is captured after every major actio to capture the status
16# 4) cmp -s is used to compare binary byte by byte data and
17# capture only exit status
18# 5) Important parametsrs used are :
19# -depth : How many bits for each colour pixel
20# -alpha off : Don't consider transparency
21# -define png:color-type=2 : Make PNG work with truecolour RGB
22# -strip : Remove all non-pixel metadata og PNG
23# so file is reproducible
24# -set gamma 1.0 : No PNG brightness correction
25# gradient:red-blue : Data moves liberly from RED to Blue vertically
26
27
28WIDTH=16
29HEIGHT=16
30BASERGB=base.rgb
31BASEPNG=base.png
32REGENERATEDRGB=roundtrip.rgb
33
34echo "[DEBUG] Starting ImageMagick Ptest with ${WIDTH}x${HEIGHT} pixels "
35
36# Verify required binaries
37for bin in magick cmp wc rm; do
38 if [ -z "$(command -v "$bin" 2>/dev/null)" ]; then
39 echo "[ERROR] Required binary '$bin' not found $PATH"
40 exit 127
41 fi
42done
43
44
45# Generate raw RGB
46magick -size ${WIDTH}x${HEIGHT} gradient:red-blue \
47 -depth 8 -type TrueColor \
48 -alpha off -define png:color-type=2 \
49 -strip -set gamma 1.0 \
50 rgb:${BASERGB}
51
52returnvalue=$?
53if [ "$returnvalue" -ne 0 ]; then
54 echo "[FAIL] Failed to generate RGB pattern "
55 exit 1
56else
57 echo "[DEBUG] ${BASERGB} generated from gradient"
58fi
59
60
61# Convert raw RGB to PNG
62magick -depth 8 -size ${WIDTH}x${HEIGHT} rgb:${BASERGB} \
63 -type TrueColor -alpha off \
64 -define png:color-type=2 -strip -set gamma 1.0 \
65 ${BASEPNG}
66
67returnvalue=$?
68if [ $returnvalue -ne 0 ]; then
69 echo "[FAIL] Failed to convert RGB to PNG"
70 rm -f ${BASERGB}
71 exit 1
72else
73 echo "[DEBUG] ${BASEPNG} generated from ${BASERGB}"
74fi
75
76
77
78# Regenerate raw RGB from PNG
79magick ${BASEPNG} \
80 -size ${WIDTH}x${HEIGHT} -depth 8 -type TrueColor \
81 -alpha off -define png:color-type=2 \
82 -strip -set gamma 1.0 \
83 rgb:${REGENERATEDRGB}
84
85returnvalue=$?
86if [ $returnvalue -ne 0 ]; then
87 echo "[FAIL] Failed to regenerate RGB from PNG"
88 rm -f ${BASERGB} ${BASEPNG}
89 exit 1
90else
91 echo "[DEBUG] ${REGENERATEDRGB} generated from ${BASEPNG}"
92fi
93
94
95
96# Compare original and recreated RGB
97if cmp -s ${BASERGB} ${REGENERATEDRGB}; then
98 echo "[PASS] RGB data identical after PNG round-trip"
99 RESULT=0
100else
101 echo "[FAIL] RGB mismatch detected, printing their size "
102 echo "[INFO] Base RGB size: $(wc -c < ${BASERGB}) bytes"
103 echo "[INFO] Round-trip RGB size: $(wc -c < ${REGENERATEDRGB}) bytes"
104 RESULT=1
105fi
106
107
108
109# Checking the identify tool from imagemagick to get the PNG metadata
110# True is added in end to ensure that test script doesnt fail even if
111# identify fails for any reason
112echo "[DEBUG] PNG file info:"
113identify -verbose ${BASEPNG} | grep -E "Depth|Type|Colorspace" || true
114
115
116
117# Cleanup of files create by test code
118echo "[DEBUG] Cleaning up temporary files"
119rm -f ${BASERGB} ${BASEPNG} ${REGENERATEDRGB}
120returnvalue=$?
121echo "[DEBUG] Cleanup exit=$returnvalue"
122
123
124# Logging the final result
125if [ ${RESULT} -eq 0 ]; then
126 echo "[DEBUG]: imagemagick-ptest.sh sucessfull "
127else
128 echo "[DEBUG]: imagemagick-ptest.sh failed "
129fi
130
131
132exit ${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 @@
1#!/bin/sh
2#
3# run-ptest — ImageMagick ptest harness
4# POSIX-safe and BusyBox compatible
5
6PTDIR=$(dirname "$0")
7TESTDIR="$PTDIR"
8PASSCOUNT=0
9FAILCOUNT=0
10TOTAL=0
11
12echo "======================================="
13echo "ImageMagick ptest: Runtime Validation"
14echo "======================================="
15
16for t in "$TESTDIR"/*.sh; do
17 [ -x "$t" ] || chmod +x "$t"
18 TOTAL=$((TOTAL + 1))
19 echo
20 echo "[DEBUG] Launching test script $t"
21
22 if sh "$t" 2>&1; then
23 echo "PASS: $(basename "$t")"
24 PASSCOUNT=$((PASSCOUNT + 1))
25 else
26 rc=$?
27 if [ "$rc" -eq 77 ]; then
28 echo "SKIP: $(basename "$t")"
29 else
30 echo "FAIL: $(basename "$t")"
31 FAILCOUNT=$((FAILCOUNT + 1))
32 fi
33 fi
34
35done
36
37echo
38echo "======================================="
39echo "[SUMMARY] Total: $TOTAL | PASS: $PASSCOUNT | FAIL: $FAILCOUNT"
40echo "======================================="
41echo
42[ "$FAILCOUNT" -eq 0 ]
43
diff --git a/meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-8.bb b/meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-8.bb
index f83adb15f2..b445ae8f62 100644
--- a/meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-8.bb
+++ b/meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-8.bb
@@ -12,11 +12,15 @@ DEPENDS = "lcms bzip2 jpeg libpng tiff zlib fftw freetype libtool"
12BASE_PV = "${@d.getVar('PV').split('-')[0]}" 12BASE_PV = "${@d.getVar('PV').split('-')[0]}"
13UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>([0-9][\.|_|-]?)+)" 13UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>([0-9][\.|_|-]?)+)"
14 14
15SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=https;tag=${PV}" 15SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=https;tag=${PV} \
16 file://run-ptest \
17 file://imagemagick-ptest.sh \
18"
19
16SRCREV = "a3b13d143fd7dea44cd71d31aa02f411b597688f" 20SRCREV = "a3b13d143fd7dea44cd71d31aa02f411b597688f"
17 21
18 22
19inherit autotools pkgconfig update-alternatives 23inherit autotools pkgconfig update-alternatives ptest
20export ac_cv_sys_file_offset_bits = "64" 24export ac_cv_sys_file_offset_bits = "64"
21 25
22EXTRA_OECONF = "--program-prefix= --program-suffix=.im7 --without-perl --enable-largefile" 26EXTRA_OECONF = "--program-prefix= --program-suffix=.im7 --without-perl --enable-largefile"
@@ -55,6 +59,13 @@ do_install:append:class-target() {
55 fi 59 fi
56} 60}
57 61
62do_install_ptest() {
63 install -d ${D}${PTEST_PATH}
64 install -m 0755 ${UNPACKDIR}/run-ptest ${D}${PTEST_PATH}/
65 install -m 0755 ${UNPACKDIR}/imagemagick-ptest.sh ${D}${PTEST_PATH}/
66}
67
68
58FILES:${PN} += "${libdir}/ImageMagick-${BASE_PV}/config-Q16* \ 69FILES:${PN} += "${libdir}/ImageMagick-${BASE_PV}/config-Q16* \
59 ${datadir}/ImageMagick-7" 70 ${datadir}/ImageMagick-7"
60 71