1LIBRARIES.SH(1)       User Contributed Perl Documentation      LIBRARIES.SH(1)
2
3
4

NAME

6       BeakerLib - libraries - mechanism for loading shared test code from
7       libraries
8

DESCRIPTION

10       This file contains functions for bringing external code into the test
11       namespace.
12

FUNCTIONS

14       rlImport
15
16       Imports code provided by one or more libraries into the test namespace.
17       The library search mechanism is based on Beaker test hierarchy system,
18       i.e.:
19
20       /component/type/test-name/test-file
21
22       When test-file calls rlImport with 'foo/bar' parameter, the libraries
23       are searched in following locations: these are the possible path
24       prefixes
25
26           - colon-separated paths from $BEAKERLIB_LIBRARY_PATH
27           - /mnt/tests
28           - /usr/share/beakerlib-libraries
29
30       the next component of the path is one of the following:
31
32           - /foo/Library/bar
33           - /foo/bar
34           - /libs/foo/bar
35           - /*/foo/Library/bar
36           - /*/foo/bar
37           - /libs/*/foo/Library/bar
38           - /libs/*/foo/bar
39
40       the directory path is then constructed as prefix/path/lib.sh If the
41       library is still not found an upwards directory traversal is used, and
42       a check for presence of the library in the above mentioned possible
43       paths is to be performed. This means this function needs to be called
44       from the test hierarchy, not e.g. the /tmp directory.
45
46       Once library is found, it is sourced and a verifier function is called.
47       The verifier function is cunstructed by composing the library prefix
48       and LibraryLoaded. Library prefix must be defined in the library
49       itself.  It should be part of lib.sh header in format: '#   library-
50       prefix = <PREFIX>'.  If the verifier passes the library is ready to
51       use. Also variable <PREFIX>LibraryDir is created and it points to the
52       library folder.
53
54       Usage:
55
56           rlImport --all
57           rlImport LIBRARY [LIBRARY2...]
58
59       --all
60           Read $BEAKERLIB_DIR/metadata.yaml or ./Makefile, pickup the library
61           requirements and import them all.
62
63       LIBRARY
64           Must have '[component/]path' or '.' format. Identifies the library
65           to import.  The dot (.) is a special case where the lib.sh from the
66           current directory is used.
67
68       Returns 0 if the import of all libraries was successful. Returns non-
69       zero if one or more library failed to import.
70

AUTHORS

72       •   Petr Muller <muller@redhat.com>
73
74       •   Dalibor Pospisil <dapospis@redhat.com>
75
76
77
78perl v5.38.0                      2023-07-19                   LIBRARIES.SH(1)
Impressum