. "$BST_LIB" # GNU texinfo 7.0.3 -- the other documentation system. Two halves that meet only # through a file: makeinfo COMPILES a .texi source to an Info file, and info # READS a named node back out of it. # # THE TWO HALVES ARE TESTED INDEPENDENTLY, ON PURPOSE. The natural shape -- # compile the source, then read what was compiled -- makes the reader's coverage # hostage to the compiler, and on this image the compiler is blocked by a # platform defect (brintos/linux-in-the-browser#154: perl cannot compile a # non-trivial body of code without glibc aborting the process). So the reader # section works from the reference Info file shipped in data/, and the compiler # section produces its own; they never share a file and neither can mask the # other. If #154 is what fails, the info half stays green and says so. # # Both halves are checked against stored expectations produced by a native # x86_64 build of the same 7.0.3 tarball from the same source, so the strong # cases are byte compares rather than substring greps. The output is # deterministic under everything a target varies: locale, COLUMNS and TERM were # each varied natively and changed nothing. The one input that DOES reach the # bytes is the output file name, which the header line and every node header # carry -- so each half runs in its own directory under a fixed name, and the # source is copied in under its bare name rather than named by path. # # What pins the references is the VERSION: the tag table at the end of an Info # file is absolute byte offsets, so they move if the header's "produced by # makeinfo version 7.0.3" line changes width. texinfo/version is checked first # and on its own for exactly that reason -- on a poky version bump it is the red # that explains the byte compares, which would otherwise fail without a cause. # # BST-TIMEOUT: 600 # # The bound is sized for the run this suite will make once #154 closes, not for # the one it makes today. Measured now it is `elapsed=38s`, but that is 38 s of # makeinfo aborting instantly 28 times; with the compiler working the suite makes # ~10 real texi2any runs, each loading 70 perl modules before it reads a byte of # input, on an interpreter that is a single 26 MB static wasm module. Re-measure # from the `==BST-SUITE` line when the compiler half actually runs. require makeinfo texinfo/present check_out texinfo/info-version "GNU texinfo) 7.0.3" info --version check_out texinfo/install-info-version "GNU texinfo) 7.0.3" install-info --version tmp=${TMPDIR:-/tmp}/bst-texinfo.$$ rm -rf "$tmp"; mkdir -p "$tmp/cc" "$tmp/rd" || { bst_notok texinfo/tmpdir "cannot create $tmp"; exit 0; } # --------------------------------------------------------------------------- # The reader, and everything else that is not perl. Runs unconditionally, # against the reference Info file rather than a freshly compiled one. # --------------------------------------------------------------------------- cd "$tmp/rd" || { bst_notok texinfo/tmpdir "cannot cd $tmp/rd"; exit 0; } cp "$BST_DATA/selftest_texinfo.info" bstsample.info # --output=- turns the curses reader into a filter, which is the only form # usable with no terminal. LC_ALL is pinned because info converts the file's # encoding to the terminal's: under C it transliterates the UTF-8 quotes and the # copyright sign down to ASCII, and that conversion is part of what is checked. LC_ALL=C info --output=- --file bstsample.info --node Formatting > node.out 2>node.err rc=$? if [ "$rc" -eq 0 ]; then bst_ok texinfo/read-node else bst_notok texinfo/read-node "rc=$rc $(_bst_1line "$(cat node.err)")"; fi check texinfo/read-node-bytes cmp -s node.out "$BST_DATA/selftest_texinfo.node" check_out texinfo/read-transliterate "copyright (C)" cat node.out check_out texinfo/read-node-header "Node: Formatting, Next: Lists" cat node.out LC_ALL=C info --output=- --file bstsample.info --node Top > top.out 2>&1 check_out texinfo/read-top-menu "* Menu:" cat top.out # --subnodes walks the whole manual from Top; the last node's heading proves it # followed the menu rather than stopping at the first. LC_ALL=C info --subnodes --output=- --file bstsample.info --node Top > all.out 2>&1 check_out texinfo/read-subnodes "Node: Index" cat all.out # A node that is not there is an error, not an empty answer. The message is # matched by hand rather than with check_out, which wants rc 0 as well -- here # the nonzero rc is half of what is being asserted. check_rc texinfo/read-missing-rc 1 info --output=- --file bstsample.info --node NoSuchNode out=$(info --output=- --file bstsample.info --node NoSuchNode 2>&1) case "$out" in *"Cannot find node"*) bst_ok texinfo/read-missing-msg ;; *) bst_notok texinfo/read-missing-msg "$(_bst_1line "$out")" ;; esac # install-info edits the dir menu; C, and independent of the compiler. rm -f dir install-info --entry="* Sample: (bstsample). brintOS texinfo sample." bstsample.info dir 2>ii.err if [ $? -eq 0 ] && grep -q '\* Sample: (bstsample)' dir; then bst_ok texinfo/install-info-entry else bst_notok texinfo/install-info-entry "$(_bst_1line "$(cat ii.err 2>/dev/null)")"; fi install-info --remove --entry="* Sample: (bstsample). brintOS texinfo sample." bstsample.info dir 2>ii.err if [ $? -eq 0 ] && ! grep -q '\* Sample: (bstsample)' dir; then bst_ok texinfo/install-info-remove else bst_notok texinfo/install-info-remove "entry still present after --remove"; fi # texindex is a /bin/sh script driving texindex.awk over the .cp file TeX would # have written, so this case is as much a check that the awk payload installed # beside it is reachable as it is a check of the sort. It shipped broken -- # poky's do_install leaves the configured awk as the absolute path "/awk" -- # and the bbappend hands it back to the script's own PATH fallback. check_out texinfo/texindex-version "GNU texinfo) 7.0.3" texindex --version printf '\\entry{zebra}{9}{zebra}\n\\entry{apple}{3}{apple}\n\\entry{mango}{5}{mango}\n' > t.cp check texinfo/texindex texindex t.cp if [ -f t.cps ]; then order=$(grep '^\\entry' t.cps | sed 's/.*{\([a-z]*\)}{.*/\1/' | tr '\n' ' ') check_eq texinfo/texindex-sorted "apple mango zebra " "$order" else bst_notok texinfo/texindex-sorted "texindex wrote no t.cps" fi # infokey compiles a user key-binding source into the binary form info reads. It # is packaged with info but is not built by every configuration, so its absence # is a coverage note rather than a failure. if command -v infokey >/dev/null 2>&1; then check_out texinfo/infokey-version "GNU texinfo) 7.0.3" infokey --version else bst_skip texinfo/infokey-version "infokey not installed on this image" fi # --------------------------------------------------------------------------- # The compiler. makeinfo is a symlink to texi2any, which is perl, so this whole # section is gated on perl being able to compile itself into existence. # --------------------------------------------------------------------------- TEXI_PERL_ISSUE="brintos/linux-in-the-browser#154" cd "$tmp/cc" || { bst_notok texinfo/tmpdir "cannot cd $tmp/cc"; exit 0; } cp "$BST_DATA/selftest_texinfo.texi" . # One probe decides it. A glibc allocator abort here is the platform defect, not # texinfo: makeinfo --version reads no input and does nothing but load modules. mi=$(makeinfo --version 2>&1); mi_rc=$? case "$mi" in *mremap_chunk*|*"corrupted size vs. prev_size"*|*"malloc():"*|*"free():"*) mi_blocked=1 ;; *) mi_blocked=0 ;; esac # Every case below this line asserts something about makeinfo, and none of them # can run when the interpreter aborts before main. # # THEY STAY RED, AND EACH ONE NAMES THE ISSUE. Skipping them would be the # cheaper-looking choice and it is the wrong one: an attributed red flips green # on its own the day the upstream fix lands, and that regression signal is the # whole reason for having the suite -- a skip would go on reading as "not # covered" forever. What the branch buys is not fewer reds but honest ones: each # says what stopped it and who owns it, instead of a cascade of `cat: no such # file` from a compile that never happened. Delete the branch when #154 closes # and the cases below run as written. notok_mi() { bst_notok "$1" "$TEXI_PERL_ISSUE: makeinfo cannot start -- $(_bst_1line "$mi")"; } if [ "$mi_blocked" -eq 1 ]; then notok_mi texinfo/version for c in texi2any-version compile compile-bytes header tag-table separators \ tag-entries render-menu render-xref render-index render-italic \ render-bold render-dots render-var render-verbatim ascii-quotes \ ascii-copyright plaintext plaintext-title html html-title xml \ xml-doctype docbook docbook-doctype bad-input-rc bad-input-msg; do notok_mi "texinfo/$c" done cd /; rm -rf "$tmp" exit 0 fi check_out texinfo/version "GNU texinfo) 7.0.3" makeinfo --version check_out texinfo/texi2any-version "GNU texinfo) 7.0.3" texi2any --version check texinfo/compile makeinfo --no-split -o bstsample.info selftest_texinfo.texi # THE case: the compiled Info file is byte-identical to the native reference. # One green here covers the parser, the structuring pass, line filling, the # glyph substitutions, index sorting and the tag table's byte offsets at once. # It also covers Encode: the file is UTF-8 and texi2any writes it through # Encode, which is the module this port had to fix the perl recipe to install. check texinfo/compile-bytes cmp -s bstsample.info "$BST_DATA/selftest_texinfo.info" # Structure, asserted separately so a byte-compare red localises. An Info file # is nodes separated by a US (0x1f) byte with a tag table at the end; five nodes # means six separators plus the two the tag table is wrapped in. check_out texinfo/header "produced by makeinfo" head -2 bstsample.info check_out texinfo/tag-table "Tag Table:" cat bstsample.info seps=$(tr -dc '\037' < bstsample.info | wc -c | tr -d ' ') check_eq texinfo/separators 8 "$seps" nodes=$(sed -n '/^Tag Table:/,/^End Tag Table/p' bstsample.info | grep -c '^Node: ') check_eq texinfo/tag-entries 5 "$nodes" # Rendering, one case per class the source exercises. check_out texinfo/render-menu "* Formatting::" cat bstsample.info check_out texinfo/render-xref "*Note Lists::" cat bstsample.info check_out texinfo/render-index "* formatting:" cat bstsample.info check_out texinfo/render-italic "_emphasized_" cat bstsample.info check_out texinfo/render-bold "*strong*" cat bstsample.info check_out texinfo/render-dots "an ellipsis ..." cat bstsample.info # @var comes out upper-cased and @verbatim comes out untouched -- the two ends # of the markup range, and the pair a half-working parser gets wrong first. check_out texinfo/render-var "a variable is COUNT" cat bstsample.info check_out texinfo/render-verbatim "verbatim @code{is not markup}" cat bstsample.info # --disable-encoding is the same document rendered into pure ASCII: the quotes # and the copyright sign come out as their ASCII spellings instead of UTF-8. makeinfo --no-split --disable-encoding -o ascii.info selftest_texinfo.texi 2>/dev/null check_out texinfo/ascii-quotes '"definition"' cat ascii.info check_out texinfo/ascii-copyright "copyright (C)" cat ascii.info # --- the other output formats ----------------------------------------------- check texinfo/plaintext makeinfo --plaintext --no-headers --disable-encoding -o plain.txt selftest_texinfo.texi check_out texinfo/plaintext-title "brintOS Texinfo Sample" cat plain.txt check texinfo/html makeinfo --html --no-split -o sample.html selftest_texinfo.texi check_out texinfo/html-title "