# BST-TIMEOUT: 900 # 14 upstream cases under ptest-runner; the runner's 60s default is nowhere near . "$BST_LIB" # libexif 0.6.24 (poky recipes-support/libexif) -- the EXIF metadata parser that # almost every camera-image tool reads through, 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 `make -o Makefile runtest-TESTS`, # and runtest-TESTS is not stock automake -- poky patches automake-native # (buildtest.patch) to split check-TESTS into buildtest-TESTS + runtest-TESTS, and # ONLY in the serial-tests branch, which is why the recipe carries # 0001-Add-serial-tests-config-needed-by-ptest.patch. What executes is therefore # automake's obsolescent SERIAL harness driving the 14 names in TESTS. # # WHY THIS SUITE IS WORTH MORE THAN "THE LIBRARY LINKS". Three of the cases are # byte-comparisons against expectations checked into the tarball, not API smoke: # - parse-regression.sh parses nine real camera JPEGs (Canon, Fuji, four # Olympus, three Pentax makernote variants) and diffs each against its # .parsed file; # - swap-byte-order.sh reparses the same nine with the TIFF byte order flipped # and demands the same text out, which is a direct check of this arm's # endian handling rather than of its syscalls; # - extract-parse.sh round-trips each image through test-extract and reparses, # and separately cross-checks test-parse against test-parse-from-data. # Those .parsed files are fixed inputs, identical on every platform, so a single # disagreement here is a defect on wasm32 rather than a difference to reason # about. # # THE ORACLE IS A NATIVE x86_64 CONTROL of the identical 0.6.24 tarball with the # identical 4-patch oe series taken from the recipe's own SRC_URI, autoreconf'd # with OE'S OWN native autotools (the patched automake -- a control built with the # host's could not run runtest-TESTS at all), configured --disable-shared # --disable-docs, built out-of-tree like oe's ${B}, and driven through the # identical `make -o Makefile runtest-TESTS`. It reported 13 PASS + 1 SKIP of 14. # The per-case expectations below are enumerated rather than reduced to a count, # because a suite that silently stopped running parse-regression.sh would still # report a clean zero failures. ptestdir=/usr/lib/libexif/ptest # The 13 cases the control ran green, in TESTS order. EXIF_CASES="test-mem test-value test-integers test-parse test-parse-from-data test-tagtable test-sorted test-fuzzer test-null parse-regression.sh swap-byte-order.sh extract-parse.sh test-gps" # ----------------------------------------------------------------- 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 libexif/lib-static 0 test -f /usr/lib/libexif.a check_rc libexif/header 0 test -f /usr/include/libexif/exif-data.h check_rc libexif/pkgconfig 0 test -f /usr/lib/pkgconfig/libexif.pc check_rc libexif/ptest-runptest 0 test -x "$ptestdir/run-ptest" check_rc libexif/ptest-makefile 0 test -f "$ptestdir/Makefile" # The twelve check_PROGRAMS. Named rather than counted: nine of them are cases in # their own right, and test-extract/test-parse/test-parse-from-data are what the # three shell cases drive, so a missing one costs cases silently. test-mnote and # test-extract are built and shipped but are not themselves in TESTS -- upstream's # shape, kept here so their absence is still visible. for b in test-extract test-fuzzer test-gps test-integers test-mem test-mnote \ test-null test-parse test-parse-from-data test-sorted test-tagtable \ test-value; do check_rc "libexif/prog-$b" 0 test -x "$ptestdir/$b" done # The five shell drivers do_install_ptest copies out of ${S}/test. for s in check-failmalloc.sh extract-parse.sh inc-comparetool.sh \ parse-regression.sh swap-byte-order.sh; do check_rc "libexif/script-$s" 0 test -f "$ptestdir/$s" done # The fixture corpus the three comparison cases read: nine camera JPEGs and the # nine .parsed expectations they are diffed against. Counted exactly, against the # control's tree, because a short copy would shrink the suite without failing it # -- parse-regression.sh globs testdata/*.jpg and passes vacuously over an empty # glob. njpg=$(ls "$ptestdir/testdata"/*.jpg 2>/dev/null | wc -l) if [ "$njpg" -eq 9 ]; then bst_ok libexif/testdata-jpg else bst_notok libexif/testdata-jpg "expected 9 testdata .jpg fixtures (the control's count), found $njpg" fi nparsed=$(ls "$ptestdir/testdata"/*.jpg.parsed 2>/dev/null | wc -l) if [ "$nparsed" -eq 9 ]; then bst_ok libexif/testdata-parsed else bst_notok libexif/testdata-parsed "expected 9 .parsed expectation files, found $nparsed" fi # No .libs/ in the ptest payload, and that is the fix rather than an absence. # oe-core's do_install_ptest copies ${B}/test/.libs/* wholesale; libtool creates # that directory and leaves it EMPTY under --disable-shared, so the unexpanded # glob kills do_install_ptest outright. Measured on both sides: the native control # and this arm each produced a .libs holding zero entries, which is what makes it # an oe-core defect rather than an arm accommodation. Asserted as a positive so # that a .libs APPEARING here -- meaning the static-only rule stopped holding -- # is what turns the case red. if [ -e "$ptestdir/.libs" ]; then bst_notok libexif/no-dot-libs \ "$ptestdir/.libs exists: libtool emitted wrappers, so this distro is no longer static-only and the bbappend's guard needs revisiting" else bst_ok libexif/no-dot-libs fi # No shared libexif on a distro that configures --disable-shared image-wide. if [ -e /usr/lib/libexif.so ] || [ -e /usr/lib/libexif.so.12 ]; then bst_notok libexif/static-only "a shared libexif shipped on a --disable-shared distro" else bst_ok libexif/static-only fi # ------------------------------------------------- upstream's own test suite --- # THE GATE. -t is set well past ptest-runner's own 300s DEFAULT_TIMEOUT; 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 libexif/ptest-suite "no ptest-runner on the image -- the suite cannot be run" for c in $EXIF_CASES; do bst_notok "libexif/case-$c" "suite not run: no ptest-runner" done bst_notok libexif/case-check-failmalloc.sh "suite not run: no ptest-runner" else out=$(/usr/bin/ptest-runner -t 20000 libexif 2>&1) # Per-case verdicts against the control's list. `case` is a builtin, so all # fourteen comparisons together cost no forks. for c in $EXIF_CASES; do case "$out" in *"PASS: $c"*) bst_ok "libexif/case-$c" ;; *"FAIL: $c"*) bst_notok "libexif/case-$c" "upstream case failed on target; the native x86_64 control passes it" ;; *"SKIP: $c"*) bst_notok "libexif/case-$c" "skipped on target; the native x86_64 control runs it" ;; *) bst_notok "libexif/case-$c" "case not reported at all -- the suite did not reach it" ;; esac done # check-failmalloc.sh is expected to SKIP, and asserting the skip is the point. # It probes for libfailmalloc (https://www.nongnu.org/failmalloc/), which this # distro does not carry and which is not a brintOS gap -- the native control # skips it for the same reason. Asserted as its own case so that the day # failmalloc arrives, this goes red and someone decides what the case should # then assert, rather than the suite quietly gaining an unreviewed test. case "$out" in *"SKIP: check-failmalloc.sh"*) bst_ok libexif/case-check-failmalloc.sh ;; *"PASS: check-failmalloc.sh"*) bst_notok libexif/case-check-failmalloc.sh \ "check-failmalloc.sh ran instead of skipping: libfailmalloc is now on the image, so this expectation needs re-deciding" ;; *"FAIL: check-failmalloc.sh"*) bst_notok libexif/case-check-failmalloc.sh \ "check-failmalloc.sh failed; the native x86_64 control skips it" ;; *) bst_notok libexif/case-check-failmalloc.sh "case not reported at all -- the suite did not reach it" ;; esac # automake's own banner, 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. # The serial harness counts only tests it RAN, so 13 with one skipped is the # all-green form, and it prints the skip on its own line. case "$out" in *"All 13 tests passed"*) bst_ok libexif/suite-banner ;; *) bst_notok libexif/suite-banner "expected automake's serial banner 'All 13 tests passed', matching the native control" ;; esac case "$out" in *"(1 test was not run)"*) bst_ok libexif/suite-skip ;; *) bst_notok libexif/suite-skip "expected exactly one skipped case (check-failmalloc.sh), as in the native control" ;; esac # ptest-runner's own framing: one ptest, zero failures. runtest-TESTS exits # non-zero iff a case failed, so this is the harness's verdict rather than a # restatement of the banner. case "$out" in *"TOTAL: 1 FAIL: 0"*) bst_ok libexif/ptest-suite ;; *) bst_notok libexif/ptest-suite "ptest-runner did not report TOTAL: 1 FAIL: 0" ;; esac fi