Rachel Sibley bb681e
#!/bin/sh
Rachel Sibley bb681e
Rachel Sibley bb681e
# Checks that touch ls rm and foo work
Rachel Sibley bb681e
# https://www.mankier.com/1/beakerlib#Examples
Rachel Sibley bb681e
. /usr/share/beakerlib/beakerlib.sh
Rachel Sibley bb681e
Rachel Sibley bb681e
# Set the full test name
Rachel Sibley bb681e
TEST="/examples/beakerlib/Sanity/phases"
Rachel Sibley bb681e
Rachel Sibley bb681e
# Package being tested
Rachel Sibley bb681e
PACKAGE="coreutils"
Rachel Sibley bb681e
Rachel Sibley bb681e
rlJournalStart
Rachel Sibley bb681e
    # Setup phase: Prepare test directory
Rachel Sibley bb681e
    rlPhaseStartSetup
Rachel Sibley bb681e
        rlAssertRpm $PACKAGE
Rachel Sibley bb681e
        rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot
Rachel Sibley bb681e
        rlRun "pushd $TmpDir"
Rachel Sibley bb681e
    rlPhaseEnd
Rachel Sibley bb681e
Rachel Sibley bb681e
    # Test phase: Testing touch, ls and rm commands
Rachel Sibley bb681e
    rlPhaseStartTest
Rachel Sibley bb681e
        rlRun "touch foo" 0 "Creating the foo test file"
Rachel Sibley bb681e
        rlAssertExists "foo"
Rachel Sibley bb681e
        rlRun "ls -l foo" 0 "Listing the foo test file"
Rachel Sibley bb681e
        rlRun "rm foo" 0 "Removing the foo test file"
Rachel Sibley bb681e
        rlAssertNotExists "foo"
Rachel Sibley bb681e
        rlRun "ls -l foo" 2 "Listing foo should now report an error"
Rachel Sibley bb681e
    rlPhaseEnd
Rachel Sibley bb681e
Rachel Sibley bb681e
    # Cleanup phase: Remove test directory
Rachel Sibley bb681e
    rlPhaseStartCleanup
Rachel Sibley bb681e
        rlRun "popd"
Rachel Sibley bb681e
        rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
Rachel Sibley bb681e
    rlPhaseEnd
Rachel Sibley bb681e
rlJournalEnd
Rachel Sibley bb681e
Rachel Sibley bb681e
# Print the test report
Rachel Sibley bb681e
rlJournalPrintText