. "$BST_LIB" require tree tree/present # GNU tree is a standalone tool (busybox has no tree applet). Prove the shipped # binary is tree, then exercise the recursion/print surface. check_out tree/version "tree v" tree --version # Default (sorted) listing of a directory with >=2 entries traps SIGILL on # wasm32-hwjs: tree's qsort comparator is a cross-module fp dispatch that traps # at runtime (brintos/linux-in-the-browser#105). `tree -U` disables sorting (no # comparator) and is fully functional, so it is the path exercised here. tmp=${TMPDIR:-/tmp}/bst-tree.$$ mkdir -p "$tmp/sub/deep" : > "$tmp/top" : > "$tmp/sub/leaf" : > "$tmp/sub/deep/bottom" check_out tree/render "leaf" tree -U "$tmp" check_out tree/summary "directories" tree -U "$tmp" check_out tree/dirs-only "sub" tree -U -d "$tmp" # -L 1 stops at depth 1: the depth-1 dir "sub" appears, the depth-2 "leaf" must not. out=$(tree -U -L 1 "$tmp" 2>&1) case "$out" in *sub*) case "$out" in *leaf*) bst_notok tree/depth-limit "-L 1 showed depth-2 leaf" ;; *) bst_ok tree/depth-limit ;; esac ;; *) bst_notok tree/depth-limit "-L 1 did not list depth-1 sub: $(_bst_1line "$out")" ;; esac # tree walks /etc (the acceptance case), depth-bounded to keep runner output small. check_out tree/etc "directories" tree -U -L 2 /etc # The default (sorted) invocation SIGILLs on this runtime — recorded skip, not # omitted, against the tracking issue. # BRINTOS-WORKAROUND: linux-in-the-browser#105 remove — this case is SKIPPED, so it will never flip green by itself; drop the skip and let it run once the issue closes. bst_skip tree/sorted-default "sorted tree of a >=2-entry dir SIGILLs on wasm32-hwjs (brintos/linux-in-the-browser#105); shipped via tree -U" rm -rf "$tmp"