The rust tests
  • Shell 82.1%
  • Rust 12.5%
  • JavaScript 5.4%
Find a file
Jesus Checa Hidalgo 1b22a7bf43 rust-wasi-smoke-test: Support all wasi targets
* Updated script to test all the installed wasi targets
* Updated tmt metadata to install the new wasip1 target when relevant
* Moved nodejs dependency to tmt metadata on distro != rhel-8
2024-08-13 17:28:07 +02:00
.fmf Bring tests from rpms/rust repo 2024-06-13 18:04:39 +02:00
plans Add tmt plan to run all local tests 2024-06-14 12:43:03 +02:00
tests rust-wasi-smoke-test: Support all wasi targets 2024-08-13 17:28:07 +02:00
.pre-commit-config.yaml Add basic pre-commit config 2024-06-13 18:00:50 +02:00
README.md Add tmt tests documentation 2024-06-13 17:59:13 +02:00

Rust Tests

This repository contains tests for rust packages. These tests are meant to be run on bodhi updates or Pull Requests.

Usage

Tests are executed using TMT (Test Management Tool). The repository includes a TMT plan that runs all the tests by default. All the tests support (and expect) the following context dimensions:

  • distro
  • arch
  • collection (only applicable to RHEL 7)

To run the tests:

# Run in the default virtual environment
tmt -c distro=<distro> -c arch=<arch> run -avv

# Run on a scheduled system
tmt -c distro=<distro> -c arch=<arch> run -avv provision -h connect -g <ip_or_hostname>

# Run specific tests
tmt -c distro=<distro> -c arch=<arch> run -avv provision -h connect -g <ip_or_hostname> test -n <regex>

Adding New Tests

Please consider the following when adding new tests:

  • Test scripts must be named runtest.sh.
  • Prefer using beakerlib tests over shell tests. If using a shell test cannot be avoided, the main.fmf file must redefine/overwrite the framework key by adding framework: shell.
  • Tests must be placed in tests/<category>/<test-name>/, where <category> can be Regression, Sanity, Security, or a new one if required.
  • This repository has a common configuration under tests/main.fmf, inherited by all tests. When adding new ones, be careful not to overwrite existing keys from the inherited tests/main.fmf.

Templates

Use the following templates when creating new tests.

FMF template. Uncomment needed fields, remove the rest.

summary: Descriptive summary for the test
duration: 2m
tier: 1
# Add an additional contact(s) if applicable
# contact+:
#   - Somebody <somebody@redhat.com>
# Additional requires
# require+:
#   - rpm-build
# Adjustments based on context dimensions
# adjust+:
#   - when: collection is defined
#     enabled: false
#     because: Test not supported in collections
# link+:
#   - verifies: https://issues.redhat.com/browse/...
# tag+:
#   - sometag

Script template:

# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1

# Define package name(s) for rlAssertRpm to report installed versions
PACKAGE=$(rpm -qf $(which rustc))
PACKAGES=${PACKAGES:-$PACKAGE}

rlJournalStart
    rlPhaseStartSetup
        rlAssertRpm --all
        # Any additional setup steps.
        # ....

        rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
        rlRun "pushd $TmpDir"
    rlPhaseEnd

    rlPhaseStartTest
        # Your actual test goes here
    rlPhaseEnd

    rlPhaseStartCleanup
        rlRun "popd"
        rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
    rlPhaseEnd
rlJournalEnd