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           - /libs/*/foo/Library/bar
37           - /libs/*/foo/bar
38
39       the directory path is then constructed as prefix/path/lib.sh If the
40       library is still not found an upwards directory traversal is used, and
41       a check for presence of the library in the above mentioned possible
42       paths is to be performed. This means this function needs to be called
43       from the test hierarchy, not e.g. the /tmp directory.
44
45       Once library is found, it is sourced and a verifier function is called.
46       The verifier function is cunstructed by composing the library prefix
47       and LibraryLoaded. Library prefix must be defined in the library
48       itself.  It should be part of lib.sh header in format: '#   library-
49       prefix = <PREFIX>'.  If the verifier passes the library is ready to
50       use. Also variable <PREFIX>LibraryDir is created and it points to the
51       library folder.
52
53       Usage:
54
55           rlImport --all
56           rlImport LIBRARY [LIBRARY2...]
57
58       --all
59           Read $BEAKERLIB_DIR/metadata.yaml or ./Makefile, pickup the library
60           requirements and import them all.
61
62       LIBRARY
63           Must have 'component[/path]' format. Identifies the library to
64           import.
65
66       Returns 0 if the import of all libraries was successful. Returns non-
67       zero if one or more library failed to import.
68

AUTHORS

70       •   Petr Muller <muller@redhat.com>
71
72       •   Dalibor Pospisil <dapospis@redhat.com>
73
74
75
76perl v5.34.0                      2021-11-09                   LIBRARIES.SH(1)
Impressum