. "$BST_LIB" # glibc-port coverage: exercise the glibc-specific code paths that the # coroutinize pass had to transform for wasm32 (printf floating-point, # strftime/locale, NSS getpwnam, getaddrinfo, gconv/iconv) and that # distinguish glibc from the default musl arm. Guarded probes skip cleanly # when a glibc utility is not packaged into this minimal image; the gawk # cases always run (gawk is glibc-linked and in the image), so the glibc # printf/strftime paths are asserted on every run. # --- always-run: glibc code paths through gawk (a glibc-linked binary) --- if command -v gawk >/dev/null 2>&1 || command -v awk >/dev/null 2>&1; then AWK=$(command -v gawk 2>/dev/null || command -v awk) # __printf_fp: floating-point formatting inside glibc's printf check_out glibc/printf-fp "2.50000" "$AWK" 'BEGIN{printf "%.5f\n", 2.5}' # __strftime_internal: glibc strftime via gawk's strftime() (utc flag = 1) check_out glibc/strftime "1970-01-01" "$AWK" 'BEGIN{print strftime("%Y-%m-%d", 0, 1)}' else bst_skip glibc/gawk "no awk/gawk on this image" fi # --- guarded: glibc userland utilities (skip if not packaged) --- # getconf GNU_LIBC_VERSION -> definitive glibc identity ("glibc 2.43") if command -v getconf >/dev/null 2>&1; then check_out glibc/getconf-libc "glibc" sh -c 'getconf GNU_LIBC_VERSION 2>&1' else bst_skip glibc/getconf "getconf not installed on this image"; fi # getent passwd root -> NSS getpwnam path (dlopen of nss modules, coroutinized) if command -v getent >/dev/null 2>&1; then check_out glibc/getent-passwd "root:" sh -c 'getent passwd root 2>&1' # getaddrinfo path: resolve localhost through NSS/hosts check_out glibc/getent-ahosts "127.0.0.1" sh -c 'getent ahosts localhost 2>&1' else bst_skip glibc/getent "getent not installed on this image"; fi # iconv -> glibc gconv (__gconv_*, heavily coroutinized); ASCII->UTF-8 round-trip if command -v iconv >/dev/null 2>&1; then check_out glibc/iconv "hi" sh -c 'printf hi | iconv -f ASCII -t UTF-8 2>&1' else bst_skip glibc/iconv "iconv not installed on this image"; fi # locale -a -> glibc locale machinery (_nl_* in the TLS census); C/POSIX always present if command -v locale >/dev/null 2>&1; then check_out glibc/locale-a "POSIX" sh -c 'locale -a 2>&1' else bst_skip glibc/locale "locale not installed on this image"; fi