# BST-TIMEOUT: 300 # two gnome-autogen.sh runs, each forking grep over a fixture tree . "$BST_LIB" # gnome-common 3.18.0 (meta-oe recipes-gnome) -- the GNOME autotools macro set. # Four files and no compiled code: # # /usr/bin/gnome-autogen.sh the /bin/sh autogen driver # /usr/share/aclocal/gnome-common.m4 GNOME_DEBUG_CHECK, GNOME_MAINTAINER_MODE_DEFINES # /usr/share/aclocal/gnome-compiler-flags.m4 GNOME_COMPILE_WARNINGS, GNOME_CXX_WARNINGS # /usr/share/aclocal/gnome-code-coverage.m4 GNOME_CODE_COVERAGE # # WHAT THIS SUITE CAN AND CANNOT SAY. The macros' real criterion -- does autoconf # expand them into working shell -- cannot be evaluated here: no autoconf program # can start on this image, because splice(2) is ENOSYS in arch/wasm32's syscall # table, GNU grep drains a pipe with splice when stdout is /dev/null, and # autom4te's GNU-m4 version check is exactly that idiom # (linux-in-the-browser#167). aclocal is perl and is separately blocked # (linux-in-the-browser#154). So the expansion arms, their negative controls and # the native comparison all run on the BUILD HOST, in the recipe's do_install, # and section 2 below pins the image's bytes to the ones that were validated # there by sha256. The chain is: these bytes work, and this image carries these # bytes. # # What IS fully runnable on target is section 5 -- gnome-autogen.sh is /bin/sh, # and its macro-resolution logic is pure shell and grep. That section drives it # end to end with its own negative control, which is the strongest statement this # suite makes on its own. # ---------------------------------------------------------------- 0. the decoy # The first result line of every suite is eaten in transport # (brintos/linux#96 / BRINTOS-1149) and the harness counts a dropped line as a # PASS, so the eaten position must never carry an assertion anyone depends on. bst_ok gnome-common/suite-canary ACDIR=${BST_ACLOCAL_DIR:-/usr/share/aclocal} GCBIN=${BST_GC_BINDIR:-/usr/bin} AUTOGEN=$GCBIN/gnome-autogen.sh REF=${BST_GC_REFDIR:-/usr/libexec/gnome-common-tests} GCSHARE=${BST_GC_DATADIR:-/usr/share} # ------------------------------------------------- 1. the four installed files check gnome-common/acdir test -d "$ACDIR" check gnome-common/m4-common test -s "$ACDIR/gnome-common.m4" check gnome-common/m4-flags test -s "$ACDIR/gnome-compiler-flags.m4" check gnome-common/m4-coverage test -s "$ACDIR/gnome-code-coverage.m4" check gnome-common/autogen-mode test -x "$AUTOGEN" # Exact sizes, not floors. The recipe is allarch and do_install proved the four # files byte-identical to a native x86-64 build of the same version, so an image # whose copy is a different size is carrying something that is not this package's # payload -- there is no legitimate arch-dependent variation to leave room for. check_eq gnome-common/m4-common-size 1008 "$(wc -c < "$ACDIR/gnome-common.m4" 2>/dev/null)" check_eq gnome-common/m4-flags-size 5979 "$(wc -c < "$ACDIR/gnome-compiler-flags.m4" 2>/dev/null)" check_eq gnome-common/m4-coverage-size 1792 "$(wc -c < "$ACDIR/gnome-code-coverage.m4" 2>/dev/null)" check_eq gnome-common/autogen-size 12093 "$(wc -c < "$AUTOGEN" 2>/dev/null)" # ------------------------------------ 2. the chain to the bytes the oracle ran # These are the sha256s do_install's oracle computed on the very files it drove # autoconf against. Without this the expansion evidence is a statement about # another machine's copy. check_eq gnome-common/m4-common-sha256 \ e2c434c889ca91cdac9202dee506ea8cea630ec72b16ebabe7f1190aaa34dcbb \ "$(sha256sum "$ACDIR/gnome-common.m4" 2>/dev/null | cut -d' ' -f1)" check_eq gnome-common/m4-flags-sha256 \ 838a78ab7a3212466f13bcd5300d0b66171f556f7619a6b1de89ba6113664448 \ "$(sha256sum "$ACDIR/gnome-compiler-flags.m4" 2>/dev/null | cut -d' ' -f1)" check_eq gnome-common/m4-coverage-sha256 \ 39552869bb0f1bc9d016aa277b4d4833f4f9cc775dda887713643b2504b5f919 \ "$(sha256sum "$ACDIR/gnome-code-coverage.m4" 2>/dev/null | cut -d' ' -f1)" check_eq gnome-common/autogen-sha256 \ c3406a48b0defd63d35f7f61850409ea75bee6d245526bcee901e35a69f5c22f \ "$(sha256sum "$AUTOGEN" 2>/dev/null | cut -d' ' -f1)" # ------------------------------------------------ 3. the declared macro surface # EVERY MACRO HERE IS AU_DEFUN, NOT AC_DEFUN -- defined and simultaneously marked # obsolete, because 3.18.0 is a compatibility shim forwarding to autoconf-archive # and automake. Grepping for AC_DEFUN would report a clean zero against a package # that had stopped shipping anything, which is why the pattern accepts both and # the count below is an equality. for m in GNOME_DEBUG_CHECK GNOME_MAINTAINER_MODE_DEFINES; do check_out gnome-common/defines-$m "DEFUN([$m]" cat "$ACDIR/gnome-common.m4" done for m in GNOME_COMPILE_WARNINGS GNOME_CXX_WARNINGS; do check_out gnome-common/defines-$m "DEFUN([$m]" cat "$ACDIR/gnome-compiler-flags.m4" done check_out gnome-common/defines-GNOME_CODE_COVERAGE "DEFUN([GNOME_CODE_COVERAGE]" \ cat "$ACDIR/gnome-code-coverage.m4" n=$(cat "$ACDIR/gnome-common.m4" "$ACDIR/gnome-compiler-flags.m4" "$ACDIR/gnome-code-coverage.m4" 2>/dev/null \ | grep -cE '^(AU|AC)_DEFUN\(\[GNOME_') check_eq gnome-common/macro-count 5 "$n" # The obsolescence is asserted rather than merely tolerated: it is the whole # character of this package, and an upstream that un-deprecated a macro would be # changing what the port is for. check_out gnome-common/macros-are-obsolete "AU_DEFUN([GNOME_DEBUG_CHECK]" \ cat "$ACDIR/gnome-common.m4" # ------------------------- 4. the PACKAGECONFIG decision, observable on target # The port keeps upstream's default PACKAGECONFIG = "autoconf-archive", which # passes --with-autoconf-archive and therefore SUPPRESSES gnome-common's own # bundled copies of two macros, deferring to the autoconf-archive package that # this image already ships. That is a real decision and it is checkable from # here, because the two copies are DIFFERENT SIZES: autoconf-archive's are # 4812 B and 12174 B, gnome-common's bundled ones 4502 B and 7126 B. # # So these two cases do not merely say "the file exists" -- they say WHOSE file # it is. A build that flipped the PACKAGECONFIG would still leave both paths # populated and would still pass a presence check; it would fail these. check gnome-common/delegate-debug-present test -s "$ACDIR/ax_check_enable_debug.m4" check gnome-common/delegate-coverage-present test -s "$ACDIR/ax_code_coverage.m4" check_eq gnome-common/delegate-debug-is-archive 4812 \ "$(wc -c < "$ACDIR/ax_check_enable_debug.m4" 2>/dev/null)" check_eq gnome-common/delegate-coverage-is-archive 12174 \ "$(wc -c < "$ACDIR/ax_code_coverage.m4" 2>/dev/null)" # ...and that the delegation is real, which is what makes the RDEPENDS a # functional need rather than bookkeeping. do_install's arm B' measures the # consequence (remove the archive from the acdir and both calls survive into # ./configure with autoconf still exiting 0); these two assert the calls exist. check_out gnome-common/delegates-debug "AX_CHECK_ENABLE_DEBUG" cat "$ACDIR/gnome-common.m4" check_out gnome-common/delegates-coverage "AX_CODE_COVERAGE" cat "$ACDIR/gnome-code-coverage.m4" # ----------------------------------- 5. gnome-autogen.sh, driven for real here # The one program this package ships, and the one thing about this port that is # fully testable on target: gnome-autogen.sh is /bin/sh, and its macro-resolution # path is pure shell and grep. # # TWO ENVIRONMENT VARIABLES MAKE IT REACHABLE, and neither is a fudge: # AUTOMAKE / AUTORECONF -- version_check returns 0 immediately when the tool is # named explicitly ("using $vc_checkprog for $vc_package"), which is upstream's # own documented override. Without it the script exits at the automake version # probe, since automake is perl (linux-in-the-browser#154). # ACLOCAL_PATH -- check_m4macros seeds its search from `aclocal --print-ac-dir`, # which answers empty for the same reason, and then adds $ACLOCAL_PATH. Naming # the directory the package actually installs into is what the variable is for. # # What is then under test is the script's real logic: scan configure.ac, decide # which macro files the package needs, and find them. tmp=${TMPDIR:-/tmp}/bst-gc.$$ mkdir -p "$tmp/pkg" "$tmp/empty" 2>/dev/null || bst_notok gnome-common/tmpdir "cannot create $tmp" if [ -d "$tmp/pkg" ]; then # A fixture that names one macro from each of the three shipped files, so all # three are required and all three have to be found. cat > "$tmp/pkg/configure.ac" <<'ACEOF' AC_INIT([bst-gnome-common], [1.0], [bst@example.invalid]) AC_CONFIG_SRCDIR([fixture.txt]) GNOME_DEBUG_CHECK GNOME_COMPILE_WARNINGS([maximum]) GNOME_CODE_COVERAGE AC_OUTPUT ACEOF : > "$tmp/pkg/fixture.txt" # NOTE the subshell: a failed top-level `cd` intermittently returns 513 on this # target and ash treats that as fatal, which would end the suite while every # case it did emit still read as a pass (brintos/linux#73). out=$( cd "$tmp/pkg" && srcdir=. AUTOMAKE=automake AUTORECONF=autoreconf \ ACLOCAL_PATH="$ACDIR" NOCONFIGURE=1 sh "$AUTOGEN" 2>&1 ) # It reached the macro check at all -- i.e. it got through ~250 lines of real # shell: the echo-capability probe, the tty probe, eight deprecation checks, # two version checks and the configure.ac scan. case "$out" in *"Checking for required M4 macros"*) bst_ok gnome-common/autogen-reaches-macro-check ;; *) bst_notok gnome-common/autogen-reaches-macro-check "$(_bst_1line "$out")" ;; esac # ...and the check PASSED: it resolved every macro file the fixture needs. # Asserted as the ABSENCE of the failure message, because that is the only # thing the script prints about success and it prints it by staying silent. case "$out" in *"some autoconf macros required to build"*) bst_notok gnome-common/autogen-finds-macros \ "gnome-autogen.sh could not resolve the macro files from $ACDIR -- $(_bst_1line "$out")" ;; *"Checking for required M4 macros"*) bst_ok gnome-common/autogen-finds-macros ;; *) bst_notok gnome-common/autogen-finds-macros "never got to the macro check: $(_bst_1line "$out")" ;; esac # ---------------------------------------------- the negative control, on target # The control asks for a macro file that is NOT installed, and requires the # same run to fail naming it. gnome-autogen.sh honours an inherited # REQUIRED_M4MACROS ("test \"$REQUIRED_M4MACROS\" || REQUIRED_M4MACROS="), so # this drives the very code path the positive arm exercises, with one input # changed. # # THE OBVIOUS CONTROL -- point ACLOCAL_PATH at an empty directory -- IS # STRUCTURALLY IMPOSSIBLE HERE, and it is worth saying why, because it passed # on the build host and failed on target for a reason that is about neither. # check_m4macros seeds its search with `aclocal --print-ac-dir` in BACKTICKS, # which ignore exit status. On this image aclocal prints /usr/share/aclocal and # THEN dies (rc=255, linux-in-the-browser#154) -- so the real macro directory is # in the search path on every run whatever ACLOCAL_PATH says, and the search can # never be starved from outside. On the build host, which has no aclocal at all, # the same backticks yield empty and ACLOCAL_PATH becomes the only source, so # the empty-directory control "worked" there. A control that is only valid at # the fixture's operating point and not at the shipped one is not a control. out0=$( cd "$tmp/pkg" && srcdir=. AUTOMAKE=automake AUTORECONF=autoreconf \ REQUIRED_M4MACROS=bst-gnome-common-absent.m4 \ ACLOCAL_PATH="$ACDIR" NOCONFIGURE=1 sh "$AUTOGEN" 2>&1 ) case "$out0" in *"some autoconf macros required to build"*) bst_ok gnome-common/autogen-control-fails ;; *) bst_notok gnome-common/autogen-control-fails \ "the NEGATIVE CONTROL passed while requiring a macro file that is not installed, so the case above proves nothing about $ACDIR -- $(_bst_1line "$out0")" ;; esac # The control has to fail for the RIGHT REASON: it must name the file it could # not find. A control that died earlier -- on the version check, say -- would # also match the message above by accident. case "$out0" in *"bst-gnome-common-absent.m4 not found"*) bst_ok gnome-common/autogen-control-names-file ;; *) bst_notok gnome-common/autogen-control-names-file \ "control failed without naming the absent macro file: $(_bst_1line "$out0")" ;; esac # ...and the real files are still found in the SAME run, which is what says the # control failed on the absent file rather than on the whole search. case "$out0" in *"gnome-compiler-flags.m4 not found"*) bst_notok gnome-common/autogen-control-scoped \ "the control could not find gnome-compiler-flags.m4 either, so it failed on the search rather than on the absent file -- $(_bst_1line "$out0")" ;; *) bst_ok gnome-common/autogen-control-scoped ;; esac else bst_notok gnome-common/autogen-reaches-macro-check "cannot stage $tmp/pkg" fi # ------------------------------------------------- 6. the shipped evidence # gnome-common-tests carries the build-host oracle transcript and the native # comparison. They are read back rather than re-derived: their value is that a # machine can be asked what its own build measured. check gnome-common/ref-oracle test -s "$REF/gnome-common-oracle.txt" check gnome-common/ref-native test -s "$REF/gnome-common-native.cmp" check_out gnome-common/ref-end "GC-ORACLE-END" cat "$REF/gnome-common-oracle.txt" check_out gnome-common/ref-sweep "GC-SWEEP defined=5 missing=0" cat "$REF/gnome-common-oracle.txt" check_out gnome-common/ref-control "GC-SWEEP-CONTROL defined=0 missing=5" cat "$REF/gnome-common-oracle.txt" check_out gnome-common/ref-native-autogen "IDENTICAL bin/gnome-autogen.sh" cat "$REF/gnome-common-native.cmp" check_out gnome-common/ref-surface "files=4 macros=5 pv=3.18.0" \ cat "$GCSHARE/gnome-common/INSTALL-SURFACE" # ------------------------------------------- 7. the platform gap, probed directly # The macros' real criterion is expansion, and it cannot run here. The probe is # the SYSCALL rather than autoconf's complaint, which names the wrong component # entirely ("need GNU m4 1.4 or later" against an m4 1.4.19 that works): # `cmd | grep P >/dev/null` is the idiom autom4te uses for its GNU-m4 version # check, GNU grep drains that pipe with splice(2) when stdout is /dev/null, and # splice is ENOSYS in arch/wasm32's syscall table. # # ABSENT AND BROKEN ARE REPORTED DIFFERENTLY, and getting that wrong is how a # native control lies: the build host this suite was developed against has no # autoconf at all, so an `absent -> not ok #167` reading would have attributed a # missing package to a kernel defect and scored the control red for a reason that # has nothing to do with this target. Per the packager guide, legitimately absent # is `skip`; present-but-broken is `not ok`. # THE PROBE IS A GENERATION, NOT `autoconf --version`, and that distinction cost # a false green on the first run of this suite: `autoconf --version` exits 0 on # this image while autoconf cannot produce a single byte of output. It parses its # own argument and prints before it ever reaches autom4te, so it says nothing # about whether the tool works. Measured on target 2026-08-23: `autoconf # --version` rc=0, `autom4te --version` rc=1, `autoconf -o out in.ac` rc=1 with a # 0-byte result, `m4 --version` rc=0 with real output -- an m4 that works and an # autoconf that rejects it, which is #167 exactly. splice_rc=$(printf 'GNU M4 1.4.19\n' | grep '^GNU M4' >/dev/null 2>&1; echo $?) acfix=$tmp/acprobe mkdir -p "$acfix" 2>/dev/null printf 'AC_INIT([bst-gc-probe],[1.0])\nAC_CONFIG_SRCDIR([f.txt])\nAC_OUTPUT\n' > "$acfix/configure.ac" 2>/dev/null : > "$acfix/f.txt" 2>/dev/null acout=$( cd "$acfix" && autoconf -o probe.cfg configure.ac 2>&1 ); acrc=$? acsz=$( [ -s "$acfix/probe.cfg" ] && wc -c < "$acfix/probe.cfg" || echo 0 ) if ! command -v autoconf >/dev/null 2>&1; then # Legitimately absent is a skip, not a red. Getting this wrong is how a native # control lies: the build host this suite was developed against has no autoconf # at all, and an `absent -> not ok #167` reading would attribute a missing # package to a kernel defect. bst_skip gnome-common/autom4te-usable \ "autoconf is not installed on this image, so the expansion criterion has nothing to run (splice-idiom probe rc=$splice_rc)" bst_skip gnome-common/macro-expansion \ "autoconf is not installed on this image -- the macros are pinned by sha256 above and their expansion is measured in do_install on the build host" elif [ "$acrc" -eq 0 ] && [ "$acsz" -gt 0 ]; then bst_ok gnome-common/autom4te-usable # If autoconf ever starts here, the expansion arms belong on target too. Named # rather than silently green, so the day #167 lands this suite says what it now # owes instead of quietly continuing to measure less than it could. bst_skip gnome-common/macro-expansion \ "autoconf now GENERATES on this image ($acsz bytes) -- linux-in-the-browser#167 has landed and this suite should grow the expansion arms that do_install currently carries" else # Left failing rather than skipped: it flips green on its own the day #167 # lands, with no edit to this file. bst_notok gnome-common/autom4te-usable \ "linux-in-the-browser#167: autoconf is installed but generates nothing (rc=$acrc, ${acsz}B) -- splice(2) is ENOSYS, so autom4te's grep-to-/dev/null version check fails and it rejects a working m4 (splice-idiom probe rc=$splice_rc)" bst_skip gnome-common/macro-expansion \ "blocked by linux-in-the-browser#167 -- the macros are installed and pinned by sha256 above, and their expansion is measured in do_install on the build host" fi cd / rm -rf "$tmp"