Tims_0day_notes 

Fuego wiki

Login or create account

Tims 0day notes

0day is a performance and regression test system developed by Fengguan Wu of Intel's open source development center.

Puts each test (named a 'job') into a yaml file

command line [edit section]

lkp is a command line tool for executing a test

some command line options are:

  • lkp install <test_package>
    • ls $LKP_SRC/jobs to see available jobs
  • lkp split-job <test_package>
  • lkp run
  • lkp result <testname>

test yaml file [edit section]

Here's what a test looks like:

From the file tbench.yaml

    suite: tbench
    testcase: tbench
    category: benchmark
    
    # upto 40% CPU cycles may be used by latency stats
    disable_latency_stats: 1
    
    nr_threads: 100%
    
    cluster: cs-localhost
    
    if role server:
      tbench-server:
    
    if role client:
      tbench:

In the 'pkg' directory are some PKGBUILD files. This appears to be the package file format for Arch Linux. see https://wiki.archlinux.org/index.php/PKGBUILD

Each test has a 'maker script' that tells how to build and install the test program. See pack/ebizzy for an example.

directory structure [edit section]

Here is the directory structure for lkp-tests:
  • allot
  • bin
  • cluster
  • daemon
  • distro
  • doc
  • etc
  • filters
  • hosts
  • include
  • jobs - has parameters for a particular execution of the test program (similar to fuegos specs and plans)
  • lib
  • lkp-exec
  • monitors
  • pack - has the maker script which does the fetch, build, install for a test program
  • params
  • pkg
  • plot
  • repo
  • rootfs
  • sbin
  • setup
  • spec
  • stats - has the results parser for each test - output is JSON
  • tests - has the main test script for each test
  • tmp
  • tools

dependency processing [edit section]

  • in lkp-tests/tests/pack-dep - check_shared_package

  • in jobs/ftrace_onoff.yaml:need_memory: 2G
  • in jobs/phoronix-test-suite-needx.yaml:need_x true
  • in include/ndctl:need_kernel_headers: true
  • in include/ltp:need_kconfig: CONFIG_BLK_DEV_LOOP
  • in filters/need_cpu: if (( need_cpu > nr_cpu )); then
  • in jobs/README.md: need_*

The file include/kernel_selftests has the following content:

    need_kernel_headers: true
    need_kconfig:
    - CONFIG_TEST_FIRMWARE
    - CONFIG_TEST_BPF
    - CONFIG_TEST_USER_COPY
    - CONFIG_MEMORY_NOTIFIER_ERROR_INJECT
    - CONFIG_MEMORY_HOTPLUG_SPARSE=y
    - CONFIG_NOTIFIER_ERROR_INJECTION
    - CONFIG_FTRACE=y

test execution [edit section]

job.yaml files are converted into job.sh files for execution by sbin/job2sh.

Items in the yaml file are converted either to environment variables, or to references to setup scripts or test scripts.

See jobs/README.md for details.

monitors [edit section]

Monitors are located in <top_dir>/monitors.

Each one is a shell script. Many are wrappers around existing tools, the output of which is used for the monitor output.

They often use a library <topdir>/lib/wait.sh.

When executed with no interval, they take a snapshot before and after the test.

When executed with an interval, they take a snapshot at the specified interval.

Here's an example, from cpuidle:

    #!/bin/sh
    # - interval
    
    [ -f /sys/devices/system/cpu/cpu0/cpuidle/state0/name ] || exit 0
    
    take_snapshot()
    {
            echo time: $(date +%s.%N)
    
            for dir in /sys/devices/system/cpu/cpu*/cpuidle/state*/
            do
                    cpu=${dir#/sys/devices/system/cpu/}
                    cpu=${cpu%/*}
                    read state_name  < $dir/name
                    read state_time  < $dir/time
                    read state_usage < $dir/usage
                    echo $cpu.${state_name}.time: ${state_time}
                    echo $cpu.${state_name}.usage: ${state_usage}
            done
    }
    
    file=$(basename $0)
    
    . $LKP_SRC/lib/wait.sh
    setup_wait
    
    if [ -z "$interval" ]; then
            take_snapshot
            wait_post_test
            take_snapshot
            exit
    fi
    
    while :
    do
            take_snapshot
            wait_timeout $interval
    done

TBWiki engine 1.8.3 by Tim Bird