Reproducing CKI test selection

How to reproduce the dynamic test selection done in the CKI pipelines

KPET is a framework which will execute targeted testing based on changes introduced in the patch, e.g. a network driver or similar would trigger network related testing.

Running KPET

  1. Install the KPET CLI

    kpet is written in Python that means you will need python3 installed on your system. You can execute it directly from the repository ./bin/kpet or you can install it via pip and use it directly from your PATH.

    pip install --user git+https://gitlab.com/cki-project/kpet.git
    
  2. Install KPET Database

    In order to use kpet you will need to download the kpet database which includes the templates and pattern files needed to analyze the patch and generate the corresponding Beaker XML.

    git clone https://gitlab.com/redhat/centos-stream/tests/kernel/kpet-db.git
    
  3. Change directory to newly cloned kpet-db. The database is assumed to reside in the current working directory, otherwise add --db DB to specify the location of the kpet database.

    cd kpet-db
    
  4. To preview patch generated test cases:

    kpet test list 001.patch
    

    or

    kpet test list https://patchwork.kernel.org/patch/10533445/mbox
    
  5. To generate complete Beaker XML:

    kpet run generate \
        --description 'kpet onboarding' \
        --arch x86_64 \
        --kernel '##KPG_URL##' \
        --tree rhel8 \
        --output job.xml \
        001.patch
    

    or

    kpet run generate \
        --description 'kpet onboarding' \
        --arch x86_64 \
        --kernel '##KPG_URL##' \
        --tree rhel8 \
        --output job.xml \
        https://patchwork.kernel.org/patch/10533445/mbox
    

    where ##KPG_URL## is a URL pointing to a gzipped kernel tarball with /boot and /lib/modules/ directories or a yum repo to install the prebuilt RPM and dependencies. If using yum repo, ##KPG_URL## should include in the end the kernel package name and the kernel source name, like #package_name=kernel-rt&source_package_name=kernel.

  6. To generate XML specific to a kernel subsystem, include --sets and the correct subsystem keyword:

    kpet run generate \
        --description 'kpet onboarding' \
        --arch x86_64 \
        --kernel '##KPG_URL##' \
        --tree rhel8 \
        --sets kt1 \
        --output kt1.xml \
        001.patch
    
  7. Submit the job to Beaker

    bkr job-submit job.xml
    
  8. Reserve the system

    Beaker CLI will display your submitted Beaker job id, you can then login to Beaker web UI to extend the reservation as needed.

Complete example

pip install --user git+https://gitlab.com/cki-project/kpet
git clone https://gitlab.com/redhat/centos-stream/tests/kernel/kpet-db.git
cd kpet-db
kpet run generate \
    --db . \
    --description 'new_feature.patch' \
    --kernel 'http://your.url.here/c1b7ab.tar.gz' \
    --tree rhel8 \
    --arch x86_64 \
    --output job.xml \
    https://patchwork.kernel.org/patch/10533445/mbox
bkr job-submit job.xml

For complete details on how to use kpet and kpet-db, please see the Readme.