LIBRARIES.SH(1)
π
LIBRARIES.SH β the BeakerLib libraries page, bestie edition β¨
okay so this is a User Contributed Perl Documentation page, manual name LIBRARIES.SH(1) β and it's literally all about how BeakerLib pulls shared test code in from libraries. it's giving "the import system, explained by your friend who actually reads the source." let's go π«Ά
πΈ NAME πΈ
BeakerLib - libraries β the whole mechanism for loading shared test code from libraries. no cap, that's the name.
β¨ DESCRIPTION β¨
this file contains functions for bringing external code into the test namespace. that's it. that's the vibe. π¦
π FUNCTIONS π
β rlImport
imports code provided by one or more libraries into the test namespace. the library search mechanism is based on the Beaker test hierarchy system, i.e.:
/component/type/test-name/test-file
so when test-file calls rlImport with a 'foo/bar' parameter, the libraries get searched in these locations β these are the possible path prefixes:
- colon-separated paths from $BEAKERLIB_LIBRARY_PATH
- /mnt/tests
- /usr/share/beakerlib-libraries
and then the next component of the path is one of these:
- /foo/Library/bar
- /foo/bar
- /libs/foo/bar
- /*/foo/Library/bar
- /*/foo/bar
- /libs/*/foo/Library/bar
- /libs/*/foo/bar
the directory path is then constructed as prefix/path/lib.sh π
if the library is still not found, an upwards directory traversal is used, and a check for presence of the library in the above mentioned possible paths is to be performed. which meansβ¦ this function needs to be called from the test hierarchy, ok?? not, like, from the /tmp directory. π
β οΈ fr fr: call it from the test hierarchy. /tmp is not the moment.
once the library is found, it is sourced and a verifier function is called. the verifier function is constructed by composing the library prefix and LibraryLoaded. the library prefix must be defined in the library itself β it should be part of the lib.sh header in this format:
# library-prefix = <PREFIX>
if the verifier passes, the library is ready to use. also, the variable <PREFIX>LibraryDir is created and it points to the library folder. icon behavior honestly π
π Usage
rlImport --all
rlImport LIBRARY [LIBRARY2...]
π Options & args
--allβ read$BEAKERLIB_DIR/metadata.yamlor./Makefile, pick up the library requirements and import them all. bulk import, main character energy.- LIBRARY β must have
'[component/]path'or'.'format. identifies the library to import. the dot (.) is a special case where thelib.shfrom the current directory is used. cute, right?
π Returns
0if the import of all libraries was successful π- non-zero if one or more library failed to import π
π AUTHORS π
- Petr Muller
<muller@redhat.com> - Dalibor Pospisil
<dapospis@redhat.com>
aaaand that's the page!! sign-off time: this was perl v5.32.1, dated 2026-04-07, filed under LIBRARIES.SH(1). go import some libraries bestie, you're gonna slay π
β¨πΈ
π¦ where this page comes from
- epel 9: beakerlib 1.33.3-1.el9 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms