Giter VIP home page Giter VIP logo

ktest's Introduction

KERNEL VIRTUAL MACHINE TESTING TOOLS:

This repository contains some infrastructure for running Linux kernel tests inside a virtual machine, primarily for bcachefs.

The tools will launch a virtual machine (using qemu), complete with networking and scratch block devices, run the test(s) inside the vm with test output on standard output, and then kill and cleanup the VM when the test(s) complete (in noninteractive mode) or when killed via ctrl-C.

Tests themselves are bash scripts that declare their dependencies (kernel config options, scratch devices, timeouts, etc).

DEPENDENCIES:

  • standand build tools (gcc, make)
  • qemu
  • minicom
  • socat
  • vde2 (for vde_swich and slirpvde, used for user mode networking)
  • liblwipv6 (optional dependency for user mode networking)

You'll need an ssh key in $HOME/.ssh for build-test-kernel ssh to work; it adds your public key to the vm's authorized_keys.

ktest should work on any Linux distribution.

GETTING STARTED:

You'll need to build a root filesystem image for the virtual machines. As root, run:

root_image create

This creates a root image and sticks it in /var/lib/ktest.

Then, to build a kernel and run some tests, from your linux kernel source tree run

build-test-kernel run -I ~/ktest/tests/bcachefs/single_device.ktest

While virtual machine is running, you can interact with it by running various other build-test-kernel subcommands from same directory, e.g.:

build-test-kernel ssh
build-test-kernel kgdb

TOOLS:

Symlink the ones you're using somewhere into your path - there's no install procedure, they just expect to be run out of the git repository.

  • build-test-kernel

    This is what you'll use most of the time for interactive kernel development. It expects to be run from a Linux kernel source tree - it builds it, and runs the specified test.

Normal usage:

$ build-test-kernel run -I ~/ktest/tests/bcache/xfstests.ktest

run builds a kernel and runs the specified test; there are other subcommands for interacting with a running test VM (sshing in, using kgdb, etc.).

-I enables interactive mode (disables timeouts, enables kgdb instead of crash dumps)

  • ktest

    This is what build-test-kernel calls into after building a kernel. ktest takes a kernel image and a test, and parses the test and figures out the correct parameters for running the virtual machine

  • testy

    Simple tool for parsing "test lists" - files that specify which tests apply to which source files/directories, and optionally running the appropriate tests.

TESTS:

Tests are bash scripts; they specify dependencies/requirements (test libraries, binaries, kernel config options, etc.) by calling various predefined bash functions.

By default, tests are shell functions that start with test. You can define tests differently by defining the shell functions list_tests and run_test.

AUTOMATION:

Output logs go in ktest-out/out/; full output from a run of a .ktest test file goes in ktest-out/out/$basename

Individual tests go in ktest-out/out/$basename.$testname

Success or failure will be the very last line of the per-test logfiles.

ktest's People

Contributors

arachsys avatar blamkiwi avatar erg avatar flyingwombat avatar holmanb avatar howlett avatar jpsollie avatar koverstreet avatar ojab avatar ouonline avatar raitobezarius avatar raof avatar rmillner avatar stintel avatar unquietwiki avatar yellowonion avatar zenglg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.