# BST-TIMEOUT: 1500 # 54 cases, 484s measured locally under ptest-runner -- the 60s default is nowhere near . "$BST_LIB" # libpng 1.6.42 (poky recipes-multimedia/libpng) -- the REFERENCE PNG library, # the implementation every other PNG reader is measured against, ported here as # a static library plus its own upstream test suite, which OpenEmbedded packages # as a ptest. # # WHAT THIS FILE ASSERTS. The port's acceptance gate is upstream's own suite, # run on target under ptest-runner exactly as the ticket requires: no # interactive session, no hand-driven check. run-ptest is `cd src && make # check-TESTS`, so what executes is automake's own test harness driving # upstream's tests/ scripts over the five test programs -- pngtest (read/write # round-trip), pngvalid (gamma, transform and progressive-read validation # computed against reference arithmetic), pngstest (the simplified png_image API # across the colour-type matrix), pngimage (transform round-trips over the # pngsuite corpus) and pngunknown (unknown-chunk policy) -- plus pnggetset, the # accessor round-trip the CVE-2026-34757 patch adds. # # WHY THAT CORPUS IS WORTH MORE THAN "THE LIBRARY LINKS": pngvalid and pngstest # are floating-point heavy and PIXEL-EXACT. They do not ask whether libpng ran, # they ask whether this arm's arithmetic produces the same samples as the # reference -- so a green here is a statement about wasm32 numerics and about # zlib's inflate/deflate underneath, not merely about syscalls. # # THE ORACLE IS A NATIVE x86_64 CONTROL of the identical 1.6.42 tarball with the # identical 19-patch oe series, autoreconf'd the way autotools.bbclass does it, # configured --disable-shared, and driven through the identical # `make check-TESTS`. It reported TOTAL 33 / PASS 33 / FAIL 0 / SKIP 0, and its # case list is byte-identical to the target's -- same 33 names, no case present # on one side and absent on the other. That is what makes the target result # classifiable rather than arguable, and it is why the per-case expectations # below are enumerated rather than reduced to a count: a suite that silently # stopped running pngvalid would still report a clean zero failures. # # (The control had to be built with autoreconf to be a control at all. Configured # straight from the shipped Makefile.in it runs 32 cases, not 33: CVE-2026-34757 # adds pnggetset through Makefile.am, and without regenerating Makefile.in that # hunk is inert. A 32-case control against a 33-case target would have read as a # target anomaly when it was an artifact of how the control was built.) ptestdir=/usr/lib/libpng/ptest srcdir=$ptestdir/src # The 33 cases the control ran, in its order. Enumerated so that a suite which # quietly stops running one is a red here rather than an unnoticed absence. PNG_CASES="pngtest-all pnggetset pngvalid-gamma-16-to-8 pngvalid-gamma-alpha-mode pngvalid-gamma-background pngvalid-gamma-expand16-alpha-mode pngvalid-gamma-expand16-background pngvalid-gamma-expand16-transform pngvalid-gamma-sbit pngvalid-gamma-threshold pngvalid-gamma-transform pngvalid-progressive-size pngvalid-progressive-interlace-standard pngvalid-transform pngvalid-progressive-standard pngvalid-standard pngstest-1.8 pngstest-1.8-alpha pngstest-linear pngstest-linear-alpha pngstest-none pngstest-none-alpha pngstest-sRGB pngstest-sRGB-alpha pngunknown-IDAT pngunknown-discard pngunknown-if-safe pngunknown-sAPI pngunknown-sTER pngunknown-save pngunknown-vpAg pngimage-quick pngimage-full" # ----------------------------------------------------------------- payload --- # check_rc with `test` is an ash builtin and forks nothing, unlike check/check_out # whose command substitution does -- so the presence half of this file is free on # an arm where every exec is a fresh wasm module instantiation. check_rc libpng/lib-static 0 test -f /usr/lib/libpng16.a check_rc libpng/header 0 test -f /usr/include/libpng16/png.h check_rc libpng/pkgconfig 0 test -f /usr/lib/pkgconfig/libpng16.pc check_rc libpng/ptest-runptest 0 test -x "$ptestdir/run-ptest" check_rc libpng/ptest-makefile 0 test -f "$srcdir/Makefile" check_rc libpng/ptest-testdir 0 test -d "$srcdir/tests" # The six programs run-ptest drives. Named rather than counted: each one is a # distinct third of the suite, and a missing one costs cases silently. for b in pngtest pnggetset pngstest pngimage pngunknown pngvalid; do check_rc "libpng/prog-$b" 0 test -x "$srcdir/$b" done # libpng-tools: the shipped binaries, as opposed to the suite's own programs. # Two, not three -- upstream's bin_PROGRAMS under ENABLE_TOOLS is exactly # `pngfix png-fix-itxt`. for b in pngfix png-fix-itxt; do check_rc "libpng/tool-$b" 0 test -x "/usr/bin/$b" done # pngcp is deliberately NOT expected in ${bindir}: upstream lists it in # check_PROGRAMS, not bin_PROGRAMS, so `make install` never installs it on any # platform. poky's FILES:${PN}-tools names it anyway -- a harmless # over-declaration (a FILES entry matching nothing is silently ignored), but one # worth pinning, because a reader comparing the recipe against the image would # otherwise read its absence as a failed install on this arm. Asserted as a # positive so that pngcp APPEARING here -- which would mean upstream moved it to # bin_PROGRAMS -- is what turns the case red. if [ -e /usr/bin/pngcp ]; then bst_notok libpng/tool-pngcp-not-installed \ "pngcp is in /usr/bin: upstream moved it out of check_PROGRAMS, so FILES:libpng-tools is now accurate and this case should become an ordinary presence check" else bst_ok libpng/tool-pngcp-not-installed fi # The pngsuite corpus is the fixture pngimage and pngunknown read. A short count # means do_install_ptest's cpio step silently dropped some, which would shrink # the suite without failing it. 51 top-level .png and a 9-file interlaced/ is # what the native control's tree holds; the control's three non-.png entries # (README, bad_interlace_conversions.txt) are absent here by design, because the # recipe copies `find contrib -name '*.png'` and nothing else. npng=$(ls "$srcdir/contrib/pngsuite"/*.png 2>/dev/null | wc -l) if [ "$npng" -eq 51 ]; then bst_ok libpng/pngsuite-corpus else bst_notok libpng/pngsuite-corpus "expected 51 pngsuite .png fixtures (the control's count), found $npng" fi nint=$(ls "$srcdir/contrib/pngsuite/interlaced"/*.png 2>/dev/null | wc -l) if [ "$nint" -eq 9 ]; then bst_ok libpng/pngsuite-interlaced else bst_notok libpng/pngsuite-interlaced "expected 9 interlaced .png fixtures, found $nint" fi # No libpng16.so on a distro that configures --disable-shared image-wide; one # appearing here would mean the static-only rule silently stopped holding, and # with it the reason the bbappend has to redirect do_install_ptest away from # ${B}/.libs at all. if [ -e /usr/lib/libpng16.so.16 ] || [ -e /usr/lib/libpng.so ]; then bst_notok libpng/static-only "a shared libpng shipped on a --disable-shared distro" else bst_ok libpng/static-only fi # ------------------------------------------------- upstream's own test suite --- # THE GATE. ptest-runner is the harness the ticket closes on. -t is set well past # ptest-runner's own 300 s DEFAULT_TIMEOUT because the suite measures 484 s here; # it does not bound anything on this arm anyway (relative timers do not fire, # brintos/linux#48), so a tight value would be an assertion about nothing. if [ ! -x /usr/bin/ptest-runner ]; then bst_notok libpng/ptest-suite "no ptest-runner on the image -- the suite cannot be run" for c in $PNG_CASES; do bst_notok "libpng/case-$c" "suite not run: no ptest-runner" done else out=$(/usr/bin/ptest-runner -t 20000 libpng 2>&1) # Per-case verdicts, against the control's list. `case` is a builtin, so all 33 # comparisons together cost no forks. for c in $PNG_CASES; do case "$out" in *"PASS: tests/$c"*) bst_ok "libpng/case-$c" ;; *"FAIL: tests/$c"*) bst_notok "libpng/case-$c" "upstream case failed on target; the native x86_64 control passes it" ;; *"SKIP: tests/$c"*) bst_notok "libpng/case-$c" "skipped on target; the native x86_64 control runs it" ;; *) bst_notok "libpng/case-$c" "case not reported at all -- the suite did not reach it" ;; esac done # automake's own tally, which is the number the ticket asks to be recorded. # Checked in addition to the per-case loop because the two fail differently: a # case renamed upstream shows up above, a case that vanished shows up here. case "$out" in *"# FAIL: 0"*) bst_ok libpng/suite-nofail ;; *) bst_notok libpng/suite-nofail "automake reported a non-zero FAIL count" ;; esac case "$out" in *"# TOTAL: 33"*) bst_ok libpng/suite-total ;; *) bst_notok libpng/suite-total "expected automake TOTAL 33, matching the native control" ;; esac # ptest-runner's own framing: one ptest, zero failures. case "$out" in *"TOTAL: 1 FAIL: 0"*) bst_ok libpng/ptest-suite ;; *) bst_notok libpng/ptest-suite "ptest-runner did not report TOTAL: 1 FAIL: 0" ;; esac fi