# BST-TIMEOUT: 180 # 245 kB across ten files in one gawk -- 27x the payload its # # libjs-jquery-cookie sibling scans, so the default 60 s is # # not safe on a loaded host. Still only three execs. # # libjs-jquery-globalize 1.7.0 (Globalize) -- the jQuery-family internationalisation # library, shipped as a system JavaScript asset under # /usr/share/javascript/jquery-globalize. # # DATA AND NOTHING BUT DATA. The recipe has no do_compile, no DEPENDS and no # configure: it clones globalizejs/globalize at SRCREV 771061fb (which is the # 1.7.0 release tag exactly) and copies dist/*.js and dist/globalize/*.js out of # the checkout. So byte-identity with x86-64 is expected BY CONSTRUCTION and # asserting it says nothing about the compiler. What it IS a statement about is # the install and packaging path, which is the part that can break on this arm: # that the payload landed in the package the image installs rather than in the # -doc package it does not, that ${datadir} resolved to /usr/share, that nothing # truncated it on the way to a virtiofs root, and that no other recipe claims # the same paths. # # THERE IS NO LOCALE DATA HERE, AND THAT IS THE ONE THING WORTH READING TWICE. # Globalize does not bundle CLDR: it CONSUMES CLDR JSON that the application # supplies at runtime, through a cldrjs dependency this image does not ship. All # ten installed files are library code, and the byte total below is that code. # A future recipe that started shipping locale data would move payload-entries, # payload-bytes and the inventory together, which is the correct way for this # suite to notice. # # THE RECIPE FLATTENS TWO DIRECTORIES INTO ONE, AND THAT BREAKS THE PACKAGE'S # INTERNAL MODULE RESOLUTION. Upstream ships dist/globalize.js beside a # dist/globalize/ subdirectory, and every module in that subdirectory names # "../globalize" in both its UMD arms; dist/node-main.js names # "./globalize/" seven times. do_install copies both globs into the SAME # directory, so after the install "../globalize" points outside the package and # the "./globalize/" specifiers have no directory to resolve against. Seven # of the twenty-one relative specifiers resolve; fourteen do not. That is # upstream meta-oe's file selection, not a defect this port introduced, and it # is left as upstream ships it -- but it is PINNED, so a later recipe that # preserves the subdirectory moves specifiers-resolve rather than passing # unnoticed. The browser/global UMD arm is unaffected either way: it reads # root.Globalize and resolves no paths at all. # # THE EIGHT dist/globalize-runtime/*.js MODULES ARE NOT INSTALLED. Only # dist/globalize-runtime.js is, because the recipe globs dist/*.js and # dist/globalize/*.js and nothing else. Note that the runtime modules share # their BASENAMES with the ones that are installed (currency.js, date.js, ...), # so a recipe that added the third glob would OVERWRITE seven of these files # rather than add to them -- which is why the ten sha256 cases below are the # check that matters and not merely a formality. # # THE DELIVERABLE IS THE PAYLOAD, AND THERE IS NO CONSUMER ON THIS IMAGE. There # is no browser, no CLDR data and no cldrjs here, so this suite can assert that # the library arrived complete and intact; it CANNOT assert that Globalize # formats a number, and it does not claim to. There is no interactive arm. # # WRITTEN TO EXEC AS LITTLE AS POSSIBLE -- one find, one sha256sum, one gawk. . "$BST_LIB" S=libjs-jquery-globalize # THE CANARY, which asserts nothing about libjs-jquery-globalize. # # A suite's FIRST BST result line is lost between the guest's printf and the # host's read -- per-suite, deterministic, and NOT a defect in the host tool # (BRINTOS-1149 established that and filed it as linux-in-the-browser#177). # The harness reports the deficit but computes its pass count as # total-minus-failures, so THE DROPPED LINE IS COUNTED AS A PASS. A nothing-case # therefore stands in that position and the eaten line costs nothing; every real # case below is still counted. It sits ahead of the `require` guards # deliberately, because a `require` that skips would emit its skip as the first # line and that line would be eaten too. Same idiom and reason as 99-mailcap. # # Remove this case when linux-in-the-browser#177 is fixed. bst_ok $S/suite-canary P=/usr/share/javascript/jquery-globalize D=$BST_DATA tmp=${TMPDIR:-/tmp} W=$tmp/bst-libjs-jquery-globalize.$$ require gawk $S/gawk-present require sha256sum $S/sha256sum-present require find $S/find-present if [ -d "$P" ]; then bst_ok $S/root; else bst_notok $S/root "$P is not a directory"; return 2>/dev/null || exit 0; fi # ------------------------------------------------------------- payload shape # One find for the whole subtree -- the inventory, the counts, the byte total # and the flatness question all come off it. -mindepth 1 with %P means a nested # directory would show up as a path with a slash in it, so the recipe flattening # dist/globalize/ is CHECKED rather than assumed. That check is what makes the # module-resolution section below a statement about the real layout. find "$P" -mindepth 1 -printf '%P %y %s %l\n' 2>/dev/null | LC_ALL=C sort > "$W.inv" sha256sum "$P/currency.js" "$P/date.js" "$P/globalize-runtime.js" "$P/globalize.js" \ "$P/message.js" "$P/node-main.js" "$P/number.js" "$P/plural.js" \ "$P/relative-time.js" "$P/unit.js" > "$W.sums" 2>&1 LC_ALL=C gawk \ -v API='currencyFormatter currencyParser currencyToPartsFormatter dateFormatter dateParser dateToPartsFormatter formatCurrency formatCurrencyToParts formatDate formatDateToParts formatMessage formatNumber formatNumberToParts formatRelativeTime formatUnit messageFormatter numberFormatter numberParser numberToPartsFormatter parseCurrency parseDate parseNumber plural pluralGenerator relativeTimeFormatter unitFormatter' \ -v INV="$W.inv" -v SUMS="$W.sums" \ -f "$D/libjs-jquery-globalize-scan.awk" \ "$W.inv" "$W.sums" \ "$P/currency.js" "$P/date.js" "$P/globalize-runtime.js" "$P/globalize.js" \ "$P/message.js" "$P/node-main.js" "$P/number.js" "$P/plural.js" \ "$P/relative-time.js" "$P/unit.js" > "$W.f1" . "$W.f1" # THE SCAN RAN AT ALL. gawk is fatal on a payload file that is not there, so a # missing file kills the scanner before END and every GL_* below comes back # empty. This suite is written so that no case can be satisfied by that -- every # assertion is a count or an n/total, and the one empty-valued case # (api-names-first-missing) sits behind this marker. Asserted first regardless: # the failure was found by mutation on the libjs-jquery-cookie suite # (BRINTOS-1330), where three cases went green off a scanner that never printed # a line, and a liveness marker is what turns that into a red with a cause. check_eq $S/scan-ran 'ok' "$GL_SCAN" # The ten entries the recipe's do_install produces, by name, type and size. A # directory that exists and holds nine of them is the partial install `test -d` # cannot see. All ten are regular files: this package has no symlinks, unlike # its libjs-jquery sibling, so a link appearing here is a recipe change. check_eq $S/payload-entries 10 "$GL_INV_N" check_eq $S/payload-files 10 "$GL_FILES" check_eq $S/payload-links 0 "$GL_LINKS" check_eq $S/payload-dirs 0 "$GL_DIRS" # The flattening, stated as the fact the resolution section depends on: no entry # has a slash in its path, so there is no globalize/ subdirectory on the target. check_eq $S/payload-flat 0 "$GL_NESTED_N" check_eq $S/payload-bytes 250701 "$GL_BYTES" check_eq $S/payload-inventory \ 'currency.js:f 22357 date.js:f 75791 globalize-runtime.js:f 7010 globalize.js:f 10917 message.js:f 61902 node-main.js:f 643 number.js:f 46097 plural.js:f 12774 relative-time.js:f 5111 unit.js:f 8099' \ "$GL_INV" # ------------------------------------------- content, against x86-64 reference # These ten sums are of the upstream globalize tree at the recipe's own SRCREV # (771061fb35f7fd8d7c2c37f5d5bb26115be382bc, the 1.7.0 tag), extracted on x86-64 # and put through the recipe's install rules -- the upstream artifact by its own # route, not a copy of the package this image built, which would have made the # comparison tautological. # # Seven of the ten share a basename with a dist/globalize-runtime/ module the # recipe does not install. These sums are therefore also the check that the # right one of each pair arrived. check_eq $S/sha256-currency-js \ df018f5bf5b6ca9c020817185eeb95a541c3e85092f9cad8811b513494a5520e "$GL_SHA_CURRENCY" check_eq $S/sha256-date-js \ 63753187bffe5cc240f0013e5d509a8a6baa961542237058ad6bebf36464cd7e "$GL_SHA_DATE" check_eq $S/sha256-globalize-js \ 29a8dca3ea51098ba52084203bfb18686a477ba994fd79d6e3299e0887bb7bb3 "$GL_SHA_GLOBALIZE" check_eq $S/sha256-globalize-runtime-js \ fa5782701d3462d146b497a10553153ac91c44e2df6cf116f6901b63f1870c86 "$GL_SHA_RUNTIME" check_eq $S/sha256-message-js \ 495701d63fa7c3e9ca697330398270f70193509ae72ed1fb832f7f9230b6afc2 "$GL_SHA_MESSAGE" check_eq $S/sha256-node-main-js \ 743f20dff487944b572d77d08b25bea28526221f9866fb9893c62251029be8e2 "$GL_SHA_NODEMAIN" check_eq $S/sha256-number-js \ 2bbf9df5fafc5afbccf8abd3fd5b2dba1cb8efb23a165d849d1c0b895024b334 "$GL_SHA_NUMBER" check_eq $S/sha256-plural-js \ eedd216c6a2c2c07f835eed8b1a242528fe70430d488287e9d61b22f8774ac37 "$GL_SHA_PLURAL" check_eq $S/sha256-relative-time-js \ 120c7656b3a7d36995c0fe953f0c5189d2acf2253322981f20842e1d242344e0 "$GL_SHA_RELATIVETIME" check_eq $S/sha256-unit-js \ d3b147c3a076226cad49f1beb479da98a6ea052cba7cacee8988d019f924a08b "$GL_SHA_UNIT" # ------------------------------------------------ read back through the target # An INDEPENDENT way of saying the files are complete: these counts come from # gawk's own reader rather than from sha256sum's, and they localise a short read # instead of merely detecting one -- a truncation shows up as a short line and # byte count against the named file. check_eq $S/readback \ 'currency.js:590:22357 date.js:3139:75791 globalize-runtime.js:326:7010 globalize.js:507:10917 message.js:2076:61902 node-main.js:27:643 number.js:1727:46097 plural.js:376:12774 relative-time.js:203:5111 unit.js:301:8099' \ "$GL_RB" check_eq $S/readback-lines 9272 "$GL_RB_LINES" check_eq $S/readback-bytes 250701 "$GL_RB_BYTES" # 75 bytes of this payload are above 0x7f -- CLDR-derived symbols in currency.js # (4), date.js (39), message.js (17) and number.js (15). Unlike its # libjs-jquery-cookie sibling this payload is NOT pure ASCII, so the exact count # is asserted rather than zero: it is what makes the LC_ALL=C byte read-back # above exact, and it moves if a transfer ever re-encodes the tree on the way to # the virtiofs root. check_eq $S/payload-high-bytes 75 "$GL_HI" # ------------------------------------------------------- module resolution # THE REAL STATEMENT ABOUT THE INSTALL LAYOUT, and the one thing here that is # not a byte count. Every quoted relative specifier in the payload is resolved # against the flat directory the recipe produced, in both UMD arms -- the AMD # define() list and the CommonJS require(). Seven resolve; fourteen cannot, # because the flattening put "../globalize" outside the package and left # node-main.js's "./globalize/" with no directory to name. # # Reported as counts and as resolved/total rather than as a list of failures: a # POSITIVE value cannot be satisfied by an unset variable, which is what a # scanner that died hands back. check_eq $S/specifiers 21 "$GL_SPEC_N" check_eq $S/specifiers-resolve '7/21' "$GL_SPEC_RESOLVED" # The two shapes, separately, so a recipe change that fixes one and not the # other is visible as such. check_eq $S/specifiers-parent-ref 7 "$GL_SPEC_PARENT" check_eq $S/specifiers-subdir-ref 7 "$GL_SPEC_SUBDIR" check_eq $S/specifiers-affected 8 "$GL_SPEC_BADFILES_N" check_eq $S/specifiers-affected-files \ 'currency.js,date.js,message.js,node-main.js,number.js,plural.js,relative-time.js,unit.js' \ "$GL_SPEC_BADFILES" # --------------------------------------------------------------- the library # The public instance API of Globalize 1.7, each name required to appear as a # Globalize.prototype. assignment somewhere in the payload. This is a # completeness statement: a file truncated anywhere loses the names past the # cut, and a module dropped by the install loses its whole block at once. check_eq $S/api-names-total 26 "$GL_API_TOTAL" check_eq $S/api-names-present 26 "$GL_API_PRESENT" check_eq $S/api-names-first-missing '' "$GL_API_FIRST_MISSING" # WHICH module defines WHICH part of it. The counts alone would survive two # modules arriving as one file; the map is what says the six currency names came # from currency.js and the six date names from date.js, which is exactly what # the basename collision described at the top of this file would break. check_eq $S/api-owners \ 'currency.js:6 date.js:6 message.js:2 number.js:6 plural.js:2 relative-time.js:2 unit.js:2' \ "$GL_API_OWNERS" # ------------------------------------------------------------------ version # READ OUT OF THE PAYLOAD'S OWN BANNERS, not off a path or a package name. Every # file carries "v1.7.0" (nine as "Globalize v1.7.0", globalize-runtime.js as # "Globalize Runtime v1.7.0") and the 1.7.0 release stamp. check_eq $S/version-banner-files 10 "$GL_V_FILES" check_eq $S/runtime-banner-files 1 "$GL_RT_FILES" check_eq $S/release-stamp-files 10 "$GL_DATE_FILES" check_eq $S/copyright-openjs-files 10 "$GL_OJS_FILES" # THE NEGATIVES, which are what make the census a VERSION assertion rather than # a line count -- and they are historical fact, checked against the upstream # tags rather than recalled: 1.6.0 and every release before it banner # "Copyright jQuery Foundation" and "http://github.com/jquery/globalize", and # 1.7.0 is the release that changed both to OpenJS. So a 1.6.0 payload dropped # in under the same name fails here while passing every count above. (1.7.1, # the other near neighbour, carries a 2025-09-29 release stamp and fails # release-stamp-files instead.) check_eq $S/copyright-pre-1-7-0 0 "$GL_JQF_FILES" check_eq $S/homepage-pre-1-7-0 0 "$GL_OLDHOME_FILES" # ----------------------------------------------------------------- packaging # THE EXPECTATION IS DERIVED, NOT WRITTEN DOWN. The recipe installs LICENSE to # ${docdir}/libjs-jquery-globalize, which FILES:${PN}-doc claims -- and -doc is # not in this image's IMAGE_INSTALL, so that directory must be absent while the # payload above is present. Saying it that way round is the point: it is the # case that fails if the javascript ever lands in -doc instead, which is exactly # the packaging mistake this port had to check for. if [ -d /usr/share/doc/libjs-jquery-globalize ]; then bst_notok $S/doc-not-installed \ "/usr/share/doc/libjs-jquery-globalize exists; the -doc package is not in IMAGE_INSTALL" else bst_ok $S/doc-not-installed fi rm -f "$W.inv" "$W.sums" "$W.f1"