Rechercher une page de manuel
beakerlib
Langue: en
Version: 2010-05-27 (fedora - 01/12/10)
Section: 1 (Commandes utilisateur)
Sommaire
NAME
BeakerLib - a shell-level integration testing libraryDESCRIPTION
BeakerLib is a shell-level integration testing library, providing convenience functions which simplify writing, running and analysis of integration and blackbox tests.The essential features include:
- *
- Journal - uniform logging mechanism (logs & results saved in flexible XML format, easy to compare results & generate reports)
- *
- Phases - logical grouping of test actions, clear separation of setup / test / cleanup (preventing false fails)
- *
- Asserts - common checks affecting the overall results of the individual phases (checking for exit codes, file existence & content...)
- *
- Helpers - convenience functions for common operations such as managing services, backup & restore
The main script sets the "BEAKERLIB" variable and sources other scripts where the actual functions are defined. You should source it at the beginning of your test with:
. /usr/lib/beakerlib/beakerlib.sh
See the EXAMPLES section for quick start inspiration.
FUNCTIONS
Journalling
rlJournalStartInitialize the journal file.
rlJournalStart
Run on the very beginning of your script to initialize journalling functionality.
rlJournalEnd
Summarize the test run and upload the journal file.
rlJournalEnd
Run on the very end of your script to print summary of the whole test run, generate OUTPUTFILE and include journal in Beaker logs.
rlJournalPrint
Print the content of the journal in pretty xml format.
rlJournalPrint [type]
- type
- Can be either 'raw' or 'pretty', with the latter as a default. Raw: xml is in raw form, no indentation etc Pretty: xml is pretty printed, indented, with one record per line
Example:
<?xml version="1.0"?> <BEAKER_TEST> <test_id>debugging</test_id> <package>setup</package> <pkgdetails>setup-2.8.9-1.fc12.noarch</pkgdetails> <starttime>2010-02-08 15:17:47</starttime> <endtime>2010-02-08 15:17:47</endtime> <testname>/examples/beakerlib/Sanity/simple</testname> <release>Fedora release 12 (Constantine)</release> <hostname>localhost</hostname> <arch>i686</arch> <purpose>PURPOSE of /examples/beakerlib/Sanity/simple Description: Minimal BeakerLib sanity test Author: Petr Splichal <psplicha@redhat.com> This is a minimal sanity test for BeakerLib. It contains a single phase with a couple of asserts. We Just check that the "setup" package is installed and that there is a sane /etc/passwd file. </purpose> <log> <phase endtime="2010-02-08 15:17:47" name="Test" result="PASS" score="0" starttime="2010-02-08 15:17:47" type="FAIL"> <test message="Checking for the presence of setup rpm">PASS</test> <test message="File /etc/passwd should exist">PASS</test> <test message="File '/etc/passwd' should contain 'root'">PASS</test> </phase> </log> </BEAKER_TEST>
rlJournalPrintText
Print the content of the journal in pretty text format.
rlJournalPrintText
Example:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: TEST PROTOCOL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test run ID : debugging :: [ LOG ] :: Package : debugging :: [ LOG ] :: Test started : 2010-02-08 14:45:57 :: [ LOG ] :: Test finished : 2010-02-08 14:45:58 :: [ LOG ] :: Test name : :: [ LOG ] :: Distro: : Fedora release 12 (Constantine) :: [ LOG ] :: Hostname : localhost :: [ LOG ] :: Architecture : i686 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test description :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: PURPOSE of /examples/beakerlib/Sanity/simple Description: Minimal BeakerLib sanity test Author: Petr Splichal <psplicha@redhat.com> This is a minimal sanity test for BeakerLib. It contains a single phase with a couple of asserts. We Just check that the "setup" package is installed and that there is a sane /etc/passwd file. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ PASS ] :: Checking for the presence of setup rpm :: [ PASS ] :: File /etc/passwd should exist :: [ PASS ] :: File '/etc/passwd' should contain 'root' :: [ LOG ] :: Duration: 1s :: [ LOG ] :: Assertions: 3 good, 0 bad :: [ PASS ] :: RESULT: Test
Logging
rlLogrlLogDebug
rlLogInfo
rlLogWarning
rlLogError
rlLogFatal
Create a time-labelled message in the log. There is a bunch of aliases which can create messages formated as DEBUG/INFO/WARNING/ERROR or FATAL (but you would probably want to use rlDie instead of the last one).
rlLog message [logfile] [priority]
- message
- Message you want to show (use quotes when invoking).
- logfile
- Log file. If not supplied, OUTPUTFILE is assumed.
- priority
- Priority of the log.
rlDie
Create a time-labelled message in the log, report test result, upload logs, close unfinished phase and terminate the test.
rlDie message [file...]
- message
- Message you want to show (use quotes when invoking) - this option is mandatory.
- file
- Files (logs) you want to upload as well. "rlBundleLogs" will be used for it. Files which are not readable will be excluded before calling "rlBundleLogs", so it is safe to call even with possibly not existent logs and it will succeed.
rlBundleLogs
Create a tarball of files (e.g. logs) and attach them to the test result.
rlBundleLogs package file [file...]
- package
- Name of the package. Will be used as a part of the tar-ball name.
- file
- File(s) to be packed and submitted.
Returns result of submiting the tarball.
rlFileSubmit
Resolves absolute path to the file, replaces / for - and uploads this renamed file using rhts-submit-log. It also allows you to specify your custom name for the uploaded file.
rlFileSubmit [-s sep] path_to_file [required_name]
- -s sep
- Sets separator (i.e. the replacement of the /) to sep.
- path_to_file
- Either absolute or relative path to file. Relative path is converted to absolute.
- required_name
- Default behavior renames file to full_path_to_file with / replaced for -, if this does not suit your needs, you can specify the name using this option.
Examples:
rlFileSubmit logfile.txt -> logfile.txt cd /etc; rlFileSubmit ./passwd -> etc-passwd rlFileSubmit /etc/passwd -> etc-passwd rlFileSubmit /etc/passwd my-top-secret_file -> my-top-secret-file rlFileSubmit -s '_' /etc/passwd -> etc_passwd
Info
rlShowPackageVersionShows a message about version of packages.
rlShowPackageVersion package [package...]
- package
- Name of a package(s) you want to log.
rlGetArch
Return base arch for the current system (good when you need base arch on a multilib system).
rlGetArch
On an i686 system you will get i386, on a ppc64 you will get ppc.
rlGetDistroRelease
rlGetDistroVariant
Return release or variant of the distribution on the system.
rlGetDistroRelease rlGetDistroVariant
For example on the RHEL-4-AS you will get release 4 and variant AS, on the RHEL-5-Client you will get release 5 and variant Client.
rlShowRunningKernel
Log a message with version of the currently running kernel.
rlShowRunningKernel
Phases
rlPhaseStartStarts a phase of a specific type. The final phase result is based on all asserts included in the phase. Do not forget to end phase with "rlPhaseEnd" when you are done.
rlPhaseStart type [name]
- type
- Type of the phase, one of the following:
-
- ABORT
- When assert fails in this phase, test will be aborted.
- FAIL
- When assert fails here, phase will report a FAIL.
- WARN
- When assert fails here, phase will report a WARN.
-
- name
- Optional name of the phase (if not provided, one will be generated).
If all asserts included in the phase pass, phase reports PASS.
rlPhaseEnd
End current phase, summarize asserts included and report phase result.
rlPhaseEnd
Final phase result is based on included asserts and phase type.
rlPhaseStartSetup
rlPhaseStartTest
rlPhaseStartCleanup
Start a phase of the specified type: Setup -> ABORT, Test -> FAIL, Cleanup -> WARN.
rlPhaseStartSetup [name] rlPhaseStartTest [name] rlPhaseStartCleanup [name]
- name
- Optional name of the phase. If not specified, default Setup/Test/Cleanup are used.
If you do not want these shortcuts, use plain "rlPhaseStart" function.
Metric
rlLogMetricLowLog a metric, which should be as low as possible to the journal. (Example: memory consumption, run time)
rlLogMetricLow name value [tolerance]
- name
- Name of the metric. It has to be unique in a phase.
- value
- Value of the metric.
- tolerance
- It is used when comparing via rcw. It means how larger can the second value be to not trigger a FAIL. Default is 0.2
When comparing FIRST, SECOND, then:
FIRST >= SECOND means PASS FIRST+FIRST*tolerance >= SECOND means WARN FIRST+FIRST*tolerance < SECOND means FAIL
Example: Simple benchmark is compared via this metric type in rcw. It has a tolerance of 0.2. First run had 1 second. So:
For PASS, second run has to be better or equal to first. So any value of second or less is a PASS. For WARN, second run can be a little worse than first. Tolerance is 0.2, so anything lower than 1.2 means WARN. For FAIL, anything worse than 1.2 means FAIL.
rlLogMetricHigh
Log a metric, which should be as high as possible to the journal. (Example: number of executions per second)
rlLogMetricHigh name value [tolerance]
- name
- Name of the metric. It has to be unique in a phase.
- value
- Value of the metric.
- tolerance
- It is used when comparing via rcw. It means how lower can the second value be to not trigger a FAIL. Default is 0.2
When comparing FIRST, SECOND, then:
FIRST <= SECOND means PASS FIRST+FIRST*tolerance <= SECOND means WARN FIRST+FIRST*tolerance > SECOND means FAIL
Manual Asserts
rlPassManual assertion, asserts and logs PASS.
rlPass comment
- comment
- Short test summary.
Returns 0 and asserts PASS.
rlFail
Manual assertion, asserts and logs FAIL.
rlFail comment
- comment
- Short test summary.
Returns 1 and asserts FAIL.
Arithmetic Asserts
rlAssert0Assertion checking for the equality of parameter to zero.
rlAssert0 comment value
- comment
- Short test summary, e.g. ``Test if compilation ended successfully''.
- value
- Integer value (usually return code of a command).
Returns 0 and asserts PASS when "value == 0".
rlAssertEquals
Assertion checking for the equality of two parameters.
rlAssertEquals comment value1 value2
- comment
- Short test summary, e.g. ``Test if all 3 packages have been downloaded''.
- value1
- First parameter to compare, can be a number or a string
- value2
- Second parameter to compare, can be a number or a string
Returns 0 and asserts PASS when "value1 == value2".
rlAssertNotEquals
Assertion checking for the non-equality of two parameters.
rlAssertNotEquals comment value1 value2
- comment
- Short test summary, e.g. ``Test if return code is not 139''.
- value1
- First parameter to compare, can be a number or a string
- value2
- Second parameter to compare, can be a number or a string
Returns 0 and asserts PASS when "value1 != value2".
rlAssertGreater
Assertion checking whether first parameter is greater than the second one.
rlAssertGreater comment value1 value2
- comment
- Short test summary, e.g. ``Test whether there are running more instances of program.''
- value1
- Integer value.
- value2
- Integer value.
Returns 0 and asserts PASS when "value1 > value2".
rlAssertGreaterOrEqual
Assertion checking whether first parameter is greater or equal to the second one.
rlAssertGreaterOrEqual comment value1 value2
- comment
- Short test summary (e.g. ``There should present at least one...'')
- value1
- Integer value.
- value2
- Integer value.
Returns 0 and asserts PASS when "value1 >= value2".
File Asserts
rlAssertExistsAssertion checking for the existence of a file.
rlAssertExists file
- file
- Path to the file.
Returns 0 and asserts PASS when "file" exists.
rlAssertNotExists
Assertion checking for the non-existence of a file.
rlAssertNotExists file
- file
- Path to the file.
Returns 0 and asserts PASS when "file" does not exist.
rlAssertGrep
Assertion checking if the file contains a pattern.
rlAssertGrep pattern file [options]
- pattern
- Regular expression to be searched for.
- file
- Path to the file.
- options
- Optional parameters to be passed to grep, default is "-q". Can be used to perform case insensitive matches (-i), or using extended (-E) or perl (-P) regular expressions.
Returns 0 and asserts PASS when "file" exists and contains given "pattern".
rlAssertNotGrep
Assertion checking that the file does not contain a pattern.
rlAssertNotGrep pattern file [options]
- pattern
- Regular expression to be searched for.
- file
- Path to the file.
- options
- Optional parameters to be passed to grep, default is "-q". Can be used to perform case insensitive matches (-i), or using extended (-E) or perl (-P) regular expressions.
Returns 0 and asserts PASS when "file" exists and does not contain given "pattern".
rlAssertDiffer
Assertion checking that two files differ (are not identical).
rlAssertDiffer file1 file2
- file1
- Path to first file1
- file2
- Path to second file
Returns 0 and asserts PASS when "file1" and "file2" differs.
rlAssertNotDiffer
Assertion checking that two files do not differ (are identical).
rlAssertNotDiffer file1 file2
- file1
- Path to first file1
- file2
- Path to second file
Returns 0 and asserts PASS when "file1" and "file2" do not differ.
Run, Watch, Report
rlRunRun command with optional comment and make sure its exit code matches expectations.
rlRun [-t] [-l] [-s] command [status[,status...]] [comment]
- -t
- If specified, stdout and stderr of the command output will be tagged with strigs 'STDOUT: ' and 'STDERR: '.
- -l
- If specified, output of the command (tagged, if -t was specified) is logged using rlLog function.
- -s
- Store stdout and stderr to a file (mixed together, as the user would see it on a terminal) and set $rlRun_LOG variable to name of the file. Caller is responsible for removing the file. When -t option is used, the content of the file becomes tagged too.
If the -s option is not used, $rlRun_LOG is not modified and keeps its content from the last ``rlRun -s''.
- command
- Command to run.
- status
- Expected exit code(s). Optional, default 0. If you expect more exit codes, separate them with comma (e.g. ``0,1'' when both 0 and 1 are OK and expected), or use from-to notation (i.e. ``2-5'' for ``2,3,4,5''), or combine them (e.g. ``2-4,26'' for ``2,3,4,26'').
- comment
- Short summary describing the action (optional, but recommended - explain what are you doing here).
Returns the exit code of the command run. Asserts PASS when command's exit status is in the list of expected exit codes.
Note: The output of rlRun is buffered when using "-t", "-l" or "-s" option (they use unix pipes, which are buffered by nature). If you need an unbuffered output just make sure that "expect" package is installed on your system (its ``unbuffer'' tool will automatically be used to produce unbuffered output).
rlWatchdog
Run "command". If it does not finish in specified time, then kill it using "signal".
rlWatchdog command timeout [signal]
- command
- Command to run.
- timeout
- Timeout to wait, in seconds.
- signal
- Signal to use (optional, default KILL).
Returns 0 if the command ends normally, without need to be killed.
rlReport
Report test result to the test harness. The command to be used for reporting is set by the respective plugin. You can also use the $BEAKERLIB_COMMAND_REPORT_RESULT variable to use your custom command.
rlReport name result [score] [log]
- name
- Name of the test result.
- result
- Result (one of PASS, WARN, FAIL). If called with something else, will use WARN.
- score
- Test score (optional).
- log
- Optional log file to be submitted instead of default "OUTPUTFILE".
Rpm Handling
rlCheckRpmCheck whether a package is installed.
rlCheckRpm name [version] [release] [arch]
- name
- Package name like "kernel"
- version
- Package version like 2.6.25.6
- release
- Package release like "55.fc9"
- arch
- Package architucture like "i386"
Returns 0 if the specified package is installed.
rlAssertRpm
Assertion making sure that a package is installed.
rlAssertRpm name [version] [release] [arch]>
- name
- Package name like "kernel"
- version
- Package version like 2.6.25.6
- release
- Package release like "55.fc9"
- arch
- Package architucture like "i386"
Returns 0 and asserts PASS if the specified package is installed.
rlAssertNotRpm
Assertion making sure that a package is not installed. This is just inverse of "rlAssertRpm".
rlAssertNotRpm name [version] [release] [arch]>
- name
- Package name like "kernel"
- version
- Package version like 2.6.25.6
- release
- Package release like "55.fc9"
- arch
- Package architucture like "i386"
Returns 0 and asserts PASS if the specified package is not installed.
Example
Function "rlAssertRpm" is useful especially in prepare phase where it causes abort if a package is missing, while "rlCheckRpm" is handy when doing something like:
if ! rlCheckRpm package; then yum install package rlAssertRpm package fi
Mounting
rlMountCreate mount point (if neccessary) and mount a NFS share.
rlMount server share mountpoint
- server
- NFS server hostname.
- share
- Shared directory name.
- mountpoint
- Local mount point.
Returns 0 if mounting the share was successful.
rlCheckMount
Check whether a share is mounted.
rlCheckMount server share mountpoint
- server
- NFS server hostname.
- share
- Shared directory name.
- mountpoint
- Local mount point.
Returns 0 when specified mount point exists and NFS share is mounted.
rlAssertMount
Assertion making sure that given NFS share is mounted.
rlAssertMount server share mountpoint
- server
- NFS server hostname.
- share
- Shared directory name.
- mountpoint
- Local mount point.
Returns 0 and asserts PASS when specified mount point exists and NFS share is mounted.
Backup and Restore
rlFileBackupCreate a backup of files or directories (recursive). Can be used multiple times to add more files to backup. Backing up an already backed up file overwrites the original backup.
rlFileBackup [--clean] file [file...]
- --clean
- If this option is provided (have to be first option of the command), then file/dir backuped using this command (provided in next options) will be (resursively) removed before we will restore it.
- file
- Files and/or directories to be backed up.
Returns 0 if the backup was successful.
Example with --clean:
touch cleandir/aaa rlFileBackup --clean cleandir/ touch cleandir/bbb ls cleandir/ aaa bbb rlFileRestore ls cleandir/ aaa
rlFileRestore
Restore backed up files to their original location. "rlFileRestore" does not remove new files appearing after backup has been made. If you don't want to leave anything behind just remove the whole original tree before running "rlFileRestore", or see "--clean" option of "rlFileBackup".
rlFileRestore
Returns 0 if backup dir is found and files are restored successfully.
Services
Following routines implement comfortable way how to start/stop system services with the possibility to restore them to their original state after testing.rlServiceStart
Make sure the given "service" is running with fresh configuration. (Start it if it's stopped and restart if it is already running.) In addition, when called for the first time, the current state is saved so that the "service" can be restored to its original state when testing is finished, see "rlServiceRestore".
rlServiceStart service [service...]
- service
- Name of the service(s) to start.
Returns number of services which failed to start/restart; thus zero is returned when everything is OK.
rlServiceStop
Make sure the given "service" is stopped. Stop it if it is running and do nothing when it is already stopped. In addition, when called for the first time, the current state is saved so that the "service" can be restored to its original state when testing is finished, see "rlServiceRestore".
rlServiceStop service [service...]
- service
- Name of the service(s) to stop.
Returns number of services which failed to become stopped; thus zero is returned when everything is OK.
rlServiceRestore
Restore given "service" into its original state (before the first "rlServiceStart" or "rlServiceStop" was called).
rlServiceRestore service [service...]
- service
- Name of the service(s) to restore to original state.
Returns number of services which failed to get back to their original state; thus zero is returned when everything is OK.
Time Performance
rlPerfTime_RunsInTimeMeasures, how many runs of some commands can be done in specified time. This approach is suitable for short-time running tasks (up to few seconds), where averaging few runs is not precise. This is done several times, and the final result is the average of all runs. It prints the number on stdout, so it has to be captured.
rlPerfTime_RunsInTime command [time] [runs]
- command
- Command to run.
- time
- Time in seconds (optional, default=30).
- runs
- Number of averaged runs (optional, default=3).
rlPerfTime_AvgFromRuns
Measures the average time of running some task. This approach is suitable for long-time running tasks (tens of seconds and more), where it is precise enough. Measured runs can be preceded by dry run, which is not measured and it's purpose is to warm up various caches. It prints the number on stdout, so it has to be captured. Or, result is then stored in special rl_retval variable.
rlPerfTime_AvgFromRuns command [count] [warmup]
- command
- Command to run.
- count
- Times to run (optional, default=3).
- warmup
- Warm-up run, run if this option is not ``warmup'' (optional, default=``warmup'')
Analyze
rlDejaSumTODO description
rlDejaSum par1 par2
- par1
- TODO description
- par2
- TODO description
Return 0 if... TODO
Virtual X Server
Functions providing simple way how to start and stop virtual X server.rlVirtualXStart
Start a virtual X server on a first free display. Tries only first N displays, so you can run out of them.
rlVirtualXStart name
- name
- String identifying the X server.
Returns 0 when the server is started successfully.
rlVirtualXGetDisplay
Get the DISPLAY variable for specified virtual X server.
rlVirtualXGetDisplay name
- name
- String identifying the X server.
Displays the number of display where specified virtual X server is running to standard output. Returns 0 on success.
rlVirtualXStop
Kill the specified X server.
rlVirtualXStop name
- name
- String identifying the X server.
Returns 0 when the server is stopped successfully.
Example
Below is a simple example of usage. Note that a lot of usefull debugging information is reported on the DEBUG level, so you can run your test with "DEBUG=1 make run" to get them.
rlVirtualXStart $TEST rlAssert0 "Virtual X server started" $? export DISPLAY="$( rlVirtualXGetDisplay $TEST )" # ...your test which needs X... rlVirtualXStop $TEST rlAssert0 "Virtual X server killed" $?
These are ``Requires'' lines for your scripts - note different package names for different RHEL versions:
@echo "Requires: xorg-x11-server-Xvfb" >> $(METADATA) # RHEL-5 @echo "Requires: xorg-x11-Xvfb" >> $(METADATA) # RHEL-4 @echo "Requires: XFree86-Xvfb" >> $(METADATA) # RHEL-3
EXAMPLES
Simple
A minimal BeakerLib test can look like this:. /usr/lib/beakerlib/beakerlib.sh rlJournalStart rlPhaseStartTest rlAssertRpm "setup" rlAssertExists "/etc/passwd" rlAssertGrep "root" "/etc/passwd" rlPhaseEnd rlJournalEnd
Phases
Here comes a bit more interesting example of a test which sets all the recommended variables and makes use of the phases:# Include the BeakerLib environment . /usr/lib/beakerlib/beakerlib.sh # Set the full test name TEST="/examples/beakerlib/Sanity/phases" # Package being tested PACKAGE="coreutils" rlJournalStart # Setup phase: Prepare test directory rlPhaseStartSetup rlAssertRpm $PACKAGE rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory" rlRun "pushd $TmpDir" rlPhaseEnd # Test phase: Testing touch, ls and rm commands rlPhaseStartTest rlRun "touch foo" 0 "Creating the foo test file" rlAssertExists "foo" rlRun "ls -l foo" 0 "Listing the foo test file" rlRun "rm foo" 0 "Removing the foo test file" rlAssertNotExists "foo" rlRun "ls -l foo" 2 "Listing foo should now report an error" rlPhaseEnd # Cleanup phase: Remove test directory rlPhaseStartCleanup rlRun "popd" rlRun "rm -r $TmpDir" 0 "Removing tmp directory" rlPhaseEnd rlJournalEnd # Print the test report rlJournalPrintText
The ouput of the rlJournalPrintText command would produce an output similar to the following:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: TEST PROTOCOL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test run ID : debugging :: [ LOG ] :: Package : coreutils :: [ LOG ] :: Installed: : coreutils-7.6-9.fc12.i686 :: [ LOG ] :: Test started : 2010-02-08 14:55:44 :: [ LOG ] :: Test finished : 2010-02-08 14:55:50 :: [ LOG ] :: Test name : /examples/beakerlib/Sanity/phases :: [ LOG ] :: Distro: : Fedora release 12 (Constantine) :: [ LOG ] :: Hostname : localhost :: [ LOG ] :: Architecture : i686 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test description :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: PURPOSE of /examples/beakerlib/Sanity/phases Description: Testing BeakerLib phases Author: Petr Splichal <psplicha@redhat.com> This example shows how the phases work in the BeakerLib on a trivial smoke test for the "touch", "ls" and "rm" commands from the coreutils package. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Setup :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ PASS ] :: Checking for the presence of coreutils rpm :: [ PASS ] :: Creating tmp directory :: [ PASS ] :: Running 'pushd /tmp/tmp.IcluQu5GVS' :: [ LOG ] :: Duration: 0s :: [ LOG ] :: Assertions: 3 good, 0 bad :: [ PASS ] :: RESULT: Setup :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ PASS ] :: Creating the foo test file :: [ PASS ] :: File foo should exist :: [ PASS ] :: Listing the foo test file :: [ PASS ] :: Removing the foo test file :: [ PASS ] :: File foo should not exist :: [ PASS ] :: Listing foo should now report an error :: [ LOG ] :: Duration: 1s :: [ LOG ] :: Assertions: 6 good, 0 bad :: [ PASS ] :: RESULT: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Cleanup :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ PASS ] :: Running 'popd' :: [ PASS ] :: Removing tmp directory :: [ LOG ] :: Duration: 1s :: [ LOG ] :: Assertions: 2 good, 0 bad :: [ PASS ] :: RESULT: Cleanup
Note that the detailed test description is read from a separate file PURPOSE placed in the same directory as the test itself.
LINKS
- Project Page
- https://fedorahosted.org/beakerlib/
- Manual
- https://fedorahosted.org/beakerlib/wiki/Manual
- Reporting bugs
- TODO
AUTHORS
- *
- Petr Muller <pmuller@redhat.com>
- *
- Ondrej Hudlicky <ohudlick@redhat.com>
- *
- Jan Hutar <jhutar@redhat.com>
- *
- Petr Splichal <psplicha@redhat.com>
- *
- Ales Zelinka <azelinka@redhat.com>
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre