Buildtest Command Line Tutorial¶
For this session, we assume you have installed buildtest on your system.
You can check if buildtest
command is available by running:
$ buildtest --help
If you receive an error please go back and re-install buildtest.
If you are new to buildtest you can review the quick start guide to learn the basics of buildtest.
Building Test¶
The buildtest build
command is used for running a test on your system given a buildspec
file (YAML). The most common way to build a test is specifying a file path via buildtest build -b <path>
. To get started,
let’s build our first test by running the following.
buildtest build -b $BUILDTEST_ROOT/tutorials/hello_world.yml
$ buildtest build -b $BUILDTEST_ROOT/tutorials/hello_world.yml
╭───────────────────────────── buildtest summary ──────────────────────────────╮
│ │
│ User: docs │
│ Hostname: build-20410989-project-280831-buildtest │
│ Platform: Linux │
│ Current Time: 2023/05/05 02:13:11 │
│ buildtest path: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ buildtest version: 1.4 │
│ python path: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ python version: 3.7.15 │
│ Configuration File: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Test Directory: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Report File: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Command: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
─────────────────────────── Discovering Buildspecs ────────────────────────────
Discovered buildspecs
╔══════════════════════════════════════════════════════════════════════════════╗
║ buildspec ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
╚══════════════════════════════════════════════════════════════════════════════╝
Total Discovered Buildspecs: 1
Total Excluded Buildspecs: 0
Detected Buildspecs after exclusion: 1
────────────────────────────── Parsing Buildspecs ──────────────────────────────
Valid Buildspecs: 1
Invalid Buildspecs: 0
/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/tutorials/hello_world.yml: VALID
Total builder objects created: 1
Builders by type=script
┏━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┓
┃ builder ┃ type ┃ executor ┃ compiler ┃ nodes ┃ procs ┃ descrip… ┃ builds… ┃
┡━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━┩
│ hello_w… │ script │ generic… │ None │ None │ None │ hello │ /home/… │
│ │ │ │ │ │ │ world │ │
│ │ │ │ │ │ │ example │ │
└──────────┴────────┴──────────┴──────────┴───────┴───────┴──────────┴─────────┘
──────────────────────────────── Building Test ─────────────────────────────────
hello_world/5b70f57c: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/5b70f57c
hello_world/5b70f57c: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/5b70f57c/stage
hello_world/5b70f57c: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/5b70f57c/hello_world_build.sh
──────────────────────────────── Running Tests ─────────────────────────────────
Spawning 1 processes for processing builders
───────────────────────────────── Iteration 1 ──────────────────────────────────
hello_world/5b70f57c does not have any dependencies adding test to queue
hello_world/5b70f57c: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/5b70f57c/stage
hello_world/5b70f57c: Running Test via command: bash --norc --noprofile -eo pipefail hello_world_build.sh
hello_world/5b70f57c: Test completed in 0.005591 seconds
hello_world/5b70f57c: Test completed with returncode: 0
hello_world/5b70f57c: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/5b70f57c/hello_world.out
hello_world/5b70f57c: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/5b70f57c/hello_world.err
In this iteration we are going to run the following tests: [hello_world/5b70f57c]
Test Summary
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ ┃ ┃ ┃ checks ┃ ┃ ┃
┃ ┃ ┃ ┃ (ReturnCode, ┃ ┃ ┃
┃ ┃ ┃ ┃ Regex, ┃ ┃ ┃
┃ builder ┃ executor ┃ status ┃ Runtime) ┃ returncode ┃ runtime ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━┩
│ hello_world/ │ generic.loc… │ PASS │ None None │ 0 │ 0.005591 │
│ 5b70f57c │ │ │ None │ │ │
└──────────────┴──────────────┴────────┴───────────────┴────────────┴──────────┘
Passed Tests: 1/1 Percentage: 100.000%
Failed Tests: 0/1 Percentage: 0.000%
Adding 1 test results to /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/report.json
Writing Logfile to: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/logs/buildtest_4a6zpfcg.log
The -b
option can be specified multiple times and it can be used with directory path. buildtest
will recursively search for all .yml extensions and attempt to build all tests.
Let’s try running the following command, where we will build by file and directory.
buildtest build -b $BUILDTEST_ROOT/tutorials/hello_world.yml -b $BUILDTEST_ROOT/general_tests/configuration
$ buildtest build -b $BUILDTEST_ROOT/tutorials/hello_world.yml -b $BUILDTEST_ROOT/general_tests/configuration
╭───────────────────────────── buildtest summary ──────────────────────────────╮
│ │
│ User: docs │
│ Hostname: build-20410989-project-280831-buildtest │
│ Platform: Linux │
│ Current Time: 2023/05/05 02:13:11 │
│ buildtest path: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ buildtest version: 1.4 │
│ python path: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ python version: 3.7.15 │
│ Configuration File: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Test Directory: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Report File: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Command: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
─────────────────────────── Discovering Buildspecs ────────────────────────────
Discovered buildspecs
╔══════════════════════════════════════════════════════════════════════════════╗
║ buildspec ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
╚══════════════════════════════════════════════════════════════════════════════╝
Total Discovered Buildspecs: 5
Total Excluded Buildspecs: 0
Detected Buildspecs after exclusion: 5
────────────────────────────── Parsing Buildspecs ──────────────────────────────
Valid Buildspecs: 5
Invalid Buildspecs: 0
/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/general_tests/configuration/kernel_state.yml: VALID
/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/general_tests/configuration/systemd-default-target.yml: VALID
/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/general_tests/configuration/ulimits.yml: VALID
/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/general_tests/configuration/disk_usage.yml: VALID
/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/tutorials/hello_world.yml: VALID
Total builder objects created: 10
Builders by type=script
┏━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┓
┃ builder ┃ type ┃ executor ┃ compiler ┃ nodes ┃ procs ┃ descrip… ┃ builds… ┃
┡━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━┩
│ kernel_… │ script │ generic… │ None │ None │ None │ Retrieve │ /home/… │
│ │ │ │ │ │ │ Kernel │ │
│ │ │ │ │ │ │ Swap │ │
│ │ │ │ │ │ │ Usage │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ systemd… │ script │ generic… │ None │ None │ None │ check if │ /home/… │
│ │ │ │ │ │ │ default │ │
│ │ │ │ │ │ │ target │ │
│ │ │ │ │ │ │ is │ │
│ │ │ │ │ │ │ multi-u… │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ ulimit_… │ script │ generic… │ None │ None │ None │ Check if │ /home/… │
│ │ │ │ │ │ │ file │ │
│ │ │ │ │ │ │ lock is │ │
│ │ │ │ │ │ │ set to │ │
│ │ │ │ │ │ │ unlimit… │ │
│ │ │ │ │ │ │ in │ │
│ │ │ │ │ │ │ ulimits │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ ulimit_… │ script │ generic… │ None │ None │ None │ Check if │ /home/… │
│ │ │ │ │ │ │ cputime │ │
│ │ │ │ │ │ │ is set │ │
│ │ │ │ │ │ │ to │ │
│ │ │ │ │ │ │ unlimit… │ │
│ │ │ │ │ │ │ in │ │
│ │ │ │ │ │ │ ulimits │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ ulimit_… │ script │ generic… │ None │ None │ None │ Check if │ /home/… │
│ │ │ │ │ │ │ stack │ │
│ │ │ │ │ │ │ size is │ │
│ │ │ │ │ │ │ set to │ │
│ │ │ │ │ │ │ unlimit… │ │
│ │ │ │ │ │ │ in │ │
│ │ │ │ │ │ │ ulimits │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ ulimit_… │ script │ generic… │ None │ None │ None │ Check │ /home/… │
│ │ │ │ │ │ │ virtual │ │
│ │ │ │ │ │ │ memory │ │
│ │ │ │ │ │ │ size and │ │
│ │ │ │ │ │ │ check if │ │
│ │ │ │ │ │ │ its set │ │
│ │ │ │ │ │ │ to │ │
│ │ │ │ │ │ │ unlimit… │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ ulimit_… │ script │ generic… │ None │ None │ None │ Check if │ /home/… │
│ │ │ │ │ │ │ open │ │
│ │ │ │ │ │ │ file │ │
│ │ │ │ │ │ │ descrip… │ │
│ │ │ │ │ │ │ limit is │ │
│ │ │ │ │ │ │ set to │ │
│ │ │ │ │ │ │ 4096 │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ ulimit_… │ script │ generic… │ None │ None │ None │ Check │ /home/… │
│ │ │ │ │ │ │ max │ │
│ │ │ │ │ │ │ number │ │
│ │ │ │ │ │ │ of user │ │
│ │ │ │ │ │ │ process │ │
│ │ │ │ │ │ │ limit is │ │
│ │ │ │ │ │ │ set to │ │
│ │ │ │ │ │ │ 2048 │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ root_di… │ script │ generic… │ None │ None │ None │ Check │ /home/… │
│ │ │ │ │ │ │ root │ │
│ │ │ │ │ │ │ disk │ │
│ │ │ │ │ │ │ usage │ │
│ │ │ │ │ │ │ and │ │
│ │ │ │ │ │ │ report │ │
│ │ │ │ │ │ │ if it │ │
│ │ │ │ │ │ │ exceeds │ │
│ │ │ │ │ │ │ thresho… │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ hello_w… │ script │ generic… │ None │ None │ None │ hello │ /home/… │
│ │ │ │ │ │ │ world │ │
│ │ │ │ │ │ │ example │ │
└──────────┴────────┴──────────┴──────────┴───────┴───────┴──────────┴─────────┘
──────────────────────────────── Building Test ─────────────────────────────────
kernel_swapusage/9f65c34f: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/kernel_state/kernel_swapusage/9f65c34f
kernel_swapusage/9f65c34f: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/kernel_state/kernel_swapusage/9f65c34f/stage
kernel_swapusage/9f65c34f: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/kernel_state/kernel_swapusage/9f65c34f/kernel_swapusage_build.sh
systemd_default_target/affc9602: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/systemd-default-target/systemd_default_target/affc9602
systemd_default_target/affc9602: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/systemd-default-target/systemd_default_target/affc9602/stage
systemd_default_target/affc9602: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/systemd-default-target/systemd_default_target/affc9602/systemd_default_target_build.sh
ulimit_filelock_unlimited/43e487c1: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filelock_unlimited/43e487c1
ulimit_filelock_unlimited/43e487c1: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filelock_unlimited/43e487c1/stage
ulimit_filelock_unlimited/43e487c1: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filelock_unlimited/43e487c1/ulimit_filelock_unlimited_build.sh
ulimit_cputime_unlimited/56935dd4: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_cputime_unlimited/56935dd4
ulimit_cputime_unlimited/56935dd4: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_cputime_unlimited/56935dd4/stage
ulimit_cputime_unlimited/56935dd4: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_cputime_unlimited/56935dd4/ulimit_cputime_unlimited_build.sh
ulimit_stacksize_unlimited/37a02870: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_stacksize_unlimited/37a02870
ulimit_stacksize_unlimited/37a02870: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_stacksize_unlimited/37a02870/stage
ulimit_stacksize_unlimited/37a02870: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_stacksize_unlimited/37a02870/ulimit_stacksize_unlimited_build.sh
ulimit_vmsize_unlimited/08ac6570: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_vmsize_unlimited/08ac6570
ulimit_vmsize_unlimited/08ac6570: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_vmsize_unlimited/08ac6570/stage
ulimit_vmsize_unlimited/08ac6570: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_vmsize_unlimited/08ac6570/ulimit_vmsize_unlimited_build.sh
ulimit_filedescriptor_4096/87627b79: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filedescriptor_4096/87627b79
ulimit_filedescriptor_4096/87627b79: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filedescriptor_4096/87627b79/stage
ulimit_filedescriptor_4096/87627b79: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filedescriptor_4096/87627b79/ulimit_filedescriptor_4096_build.sh
ulimit_max_user_process_2048/9316d82e: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_max_user_process_2048/9316d82e
ulimit_max_user_process_2048/9316d82e: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_max_user_process_2048/9316d82e/stage
ulimit_max_user_process_2048/9316d82e: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_max_user_process_2048/9316d82e/ulimit_max_user_process_2048_build.sh
root_disk_usage/c8f9baba: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/disk_usage/root_disk_usage/c8f9baba
root_disk_usage/c8f9baba: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/disk_usage/root_disk_usage/c8f9baba/stage
root_disk_usage/c8f9baba: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/disk_usage/root_disk_usage/c8f9baba/root_disk_usage_build.sh
hello_world/a55c38fa: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa
hello_world/a55c38fa: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/stage
hello_world/a55c38fa: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/hello_world_build.sh
──────────────────────────────── Running Tests ─────────────────────────────────
Spawning 1 processes for processing builders
───────────────────────────────── Iteration 1 ──────────────────────────────────
hello_world/a55c38fa does not have any dependencies adding test to queue
ulimit_filelock_unlimited/43e487c1 does not have any dependencies adding test to queue
kernel_swapusage/9f65c34f does not have any dependencies adding test to queue
ulimit_filedescriptor_4096/87627b79 does not have any dependencies adding test to queue
ulimit_vmsize_unlimited/08ac6570 does not have any dependencies adding test to queue
ulimit_max_user_process_2048/9316d82e does not have any dependencies adding test to queue
root_disk_usage/c8f9baba does not have any dependencies adding test to queue
systemd_default_target/affc9602 does not have any dependencies adding test to queue
ulimit_stacksize_unlimited/37a02870 does not have any dependencies adding test to queue
ulimit_cputime_unlimited/56935dd4 does not have any dependencies adding test to queue
hello_world/a55c38fa: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/stage
hello_world/a55c38fa: Running Test via command: bash --norc --noprofile -eo pipefail hello_world_build.sh
hello_world/a55c38fa: Test completed in 0.005592 seconds
hello_world/a55c38fa: Test completed with returncode: 0
hello_world/a55c38fa: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/hello_world.out
hello_world/a55c38fa: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/hello_world.err
kernel_swapusage/9f65c34f: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/kernel_state/kernel_swapusage/9f65c34f/stage
kernel_swapusage/9f65c34f: Running Test via command: bash --norc --noprofile -eo pipefail kernel_swapusage_build.sh
kernel_swapusage/9f65c34f: Test completed in 0.121223 seconds
kernel_swapusage/9f65c34f: Test completed with returncode: 255
kernel_swapusage/9f65c34f: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/kernel_state/kernel_swapusage/9f65c34f/kernel_swapusage.out
kernel_swapusage/9f65c34f: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/kernel_state/kernel_swapusage/9f65c34f/kernel_swapusage.err
ulimit_filelock_unlimited/43e487c1: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filelock_unlimited/43e487c1/stage
ulimit_filelock_unlimited/43e487c1: Running Test via command: bash --norc --noprofile -eo pipefail ulimit_filelock_unlimited_build.sh
ulimit_filelock_unlimited/43e487c1: Test completed in 0.005648 seconds
ulimit_filelock_unlimited/43e487c1: Test completed with returncode: 0
ulimit_filelock_unlimited/43e487c1: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filelock_unlimited/43e487c1/ulimit_filelock_unlimited.out
ulimit_filelock_unlimited/43e487c1: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filelock_unlimited/43e487c1/ulimit_filelock_unlimited.err
ulimit_filelock_unlimited/43e487c1: performing regular expression - '^unlimited$' on file: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filelock_unlimited/43e487c1/ulimit_filelock_unlimited.out
ulimit_filelock_unlimited/43e487c1: Regular Expression Match - Success!
ulimit_filedescriptor_4096/87627b79: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filedescriptor_4096/87627b79/stage
ulimit_filedescriptor_4096/87627b79: Running Test via command: bash --norc --noprofile -eo pipefail ulimit_filedescriptor_4096_build.sh
ulimit_filedescriptor_4096/87627b79: Test completed in 0.005395 seconds
ulimit_filedescriptor_4096/87627b79: Test completed with returncode: 0
ulimit_filedescriptor_4096/87627b79: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filedescriptor_4096/87627b79/ulimit_filedescriptor_4096.out
ulimit_filedescriptor_4096/87627b79: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filedescriptor_4096/87627b79/ulimit_filedescriptor_4096.err
ulimit_filedescriptor_4096/87627b79: performing regular expression - '^4096$' on file: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_filedescriptor_4096/87627b79/ulimit_filedescriptor_4096.out
ulimit_filedescriptor_4096/87627b79: Regular Expression Match - Failed!
ulimit_vmsize_unlimited/08ac6570: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_vmsize_unlimited/08ac6570/stage
ulimit_vmsize_unlimited/08ac6570: Running Test via command: bash --norc --noprofile -eo pipefail ulimit_vmsize_unlimited_build.sh
ulimit_vmsize_unlimited/08ac6570: Test completed in 0.005309 seconds
ulimit_vmsize_unlimited/08ac6570: Test completed with returncode: 0
ulimit_vmsize_unlimited/08ac6570: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_vmsize_unlimited/08ac6570/ulimit_vmsize_unlimited.out
ulimit_vmsize_unlimited/08ac6570: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_vmsize_unlimited/08ac6570/ulimit_vmsize_unlimited.err
ulimit_vmsize_unlimited/08ac6570: performing regular expression - '^unlimited$' on file: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_vmsize_unlimited/08ac6570/ulimit_vmsize_unlimited.out
ulimit_vmsize_unlimited/08ac6570: Regular Expression Match - Success!
ulimit_max_user_process_2048/9316d82e: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_max_user_process_2048/9316d82e/stage
ulimit_max_user_process_2048/9316d82e: Running Test via command: bash --norc --noprofile -eo pipefail ulimit_max_user_process_2048_build.sh
ulimit_max_user_process_2048/9316d82e: Test completed in 0.005303 seconds
ulimit_max_user_process_2048/9316d82e: Test completed with returncode: 0
ulimit_max_user_process_2048/9316d82e: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_max_user_process_2048/9316d82e/ulimit_max_user_process_2048.out
ulimit_max_user_process_2048/9316d82e: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_max_user_process_2048/9316d82e/ulimit_max_user_process_2048.err
ulimit_max_user_process_2048/9316d82e: performing regular expression - '^2048$' on file: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_max_user_process_2048/9316d82e/ulimit_max_user_process_2048.out
ulimit_max_user_process_2048/9316d82e: Regular Expression Match - Failed!
systemd_default_target/affc9602: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/systemd-default-target/systemd_default_target/affc9602/stage
systemd_default_target/affc9602: Running Test via command: bash --norc --noprofile -eo pipefail systemd_default_target_build.sh
systemd_default_target/affc9602: Test completed in 0.141256 seconds
systemd_default_target/affc9602: Test completed with returncode: 1
systemd_default_target/affc9602: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/systemd-default-target/systemd_default_target/affc9602/systemd_default_target.out
systemd_default_target/affc9602: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/systemd-default-target/systemd_default_target/affc9602/systemd_default_target.err
ulimit_cputime_unlimited/56935dd4: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_cputime_unlimited/56935dd4/stage
ulimit_cputime_unlimited/56935dd4: Running Test via command: bash --norc --noprofile -eo pipefail ulimit_cputime_unlimited_build.sh
ulimit_cputime_unlimited/56935dd4: Test completed in 0.005751 seconds
ulimit_cputime_unlimited/56935dd4: Test completed with returncode: 0
ulimit_cputime_unlimited/56935dd4: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_cputime_unlimited/56935dd4/ulimit_cputime_unlimited.out
ulimit_cputime_unlimited/56935dd4: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_cputime_unlimited/56935dd4/ulimit_cputime_unlimited.err
ulimit_cputime_unlimited/56935dd4: performing regular expression - '^unlimited$' on file: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_cputime_unlimited/56935dd4/ulimit_cputime_unlimited.out
ulimit_cputime_unlimited/56935dd4: Regular Expression Match - Success!
ulimit_stacksize_unlimited/37a02870: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_stacksize_unlimited/37a02870/stage
ulimit_stacksize_unlimited/37a02870: Running Test via command: bash --norc --noprofile -eo pipefail ulimit_stacksize_unlimited_build.sh
ulimit_stacksize_unlimited/37a02870: Test completed in 0.005762 seconds
ulimit_stacksize_unlimited/37a02870: Test completed with returncode: 0
ulimit_stacksize_unlimited/37a02870: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_stacksize_unlimited/37a02870/ulimit_stacksize_unlimited.out
ulimit_stacksize_unlimited/37a02870: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_stacksize_unlimited/37a02870/ulimit_stacksize_unlimited.err
ulimit_stacksize_unlimited/37a02870: performing regular expression - '^unlimited$' on file: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/ulimits/ulimit_stacksize_unlimited/37a02870/ulimit_stacksize_unlimited.out
ulimit_stacksize_unlimited/37a02870: Regular Expression Match - Failed!
root_disk_usage/c8f9baba: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/disk_usage/root_disk_usage/c8f9baba/stage
root_disk_usage/c8f9baba: Running Test via command: bash --norc --noprofile -eo pipefail root_disk_usage_build.sh
root_disk_usage/c8f9baba: Test completed in 0.201403 seconds
root_disk_usage/c8f9baba: Test completed with returncode: 0
root_disk_usage/c8f9baba: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/disk_usage/root_disk_usage/c8f9baba/root_disk_usage.out
root_disk_usage/c8f9baba: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/disk_usage/root_disk_usage/c8f9baba/root_disk_usage.err
In this iteration we are going to run the following tests: [hello_world/a55c38fa, kernel_swapusage/9f65c34f, ulimit_filelock_unlimited/43e487c1, ulimit_filedescriptor_4096/87627b79, ulimit_vmsize_unlimited/08ac6570, ulimit_max_user_process_2048/9316d82e, systemd_default_target/affc9602, ulimit_cputime_unlimited/56935dd4, ulimit_stacksize_unlimited/37a02870, root_disk_usage/c8f9baba]
Test Summary
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ ┃ ┃ ┃ checks ┃ ┃ ┃
┃ ┃ ┃ ┃ (ReturnCode, ┃ ┃ ┃
┃ ┃ ┃ ┃ Regex, ┃ ┃ ┃
┃ builder ┃ executor ┃ status ┃ Runtime) ┃ returncode ┃ runtime ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━┩
│ root_disk_us │ generic.loc… │ PASS │ None None │ 0 │ 0.201403 │
│ age/c8f9baba │ │ │ None │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ ulimit_cputi │ generic.loc… │ PASS │ None True │ 0 │ 0.005751 │
│ me_unlimited │ │ │ None │ │ │
│ /56935dd4 │ │ │ │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ hello_world/ │ generic.loc… │ PASS │ None None │ 0 │ 0.005592 │
│ a55c38fa │ │ │ None │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ ulimit_filel │ generic.loc… │ PASS │ None True │ 0 │ 0.005648 │
│ ock_unlimite │ │ │ None │ │ │
│ d/43e487c1 │ │ │ │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ ulimit_vmsiz │ generic.loc… │ PASS │ None True │ 0 │ 0.005309 │
│ e_unlimited/ │ │ │ None │ │ │
│ 08ac6570 │ │ │ │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ ulimit_filed │ generic.loc… │ FAIL │ None False │ 0 │ 0.005395 │
│ escriptor_40 │ │ │ None │ │ │
│ 96/87627b79 │ │ │ │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ systemd_defa │ generic.loc… │ FAIL │ None None │ 1 │ 0.141256 │
│ ult_target/a │ │ │ None │ │ │
│ ffc9602 │ │ │ │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ ulimit_max_u │ generic.loc… │ FAIL │ None False │ 0 │ 0.005303 │
│ ser_process_ │ │ │ None │ │ │
│ 2048/9316d82 │ │ │ │ │ │
│ e │ │ │ │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ ulimit_stack │ generic.loc… │ FAIL │ None False │ 0 │ 0.005762 │
│ size_unlimit │ │ │ None │ │ │
│ ed/37a02870 │ │ │ │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ kernel_swapu │ generic.loc… │ FAIL │ None None │ 255 │ 0.121223 │
│ sage/9f65c34 │ │ │ None │ │ │
│ f │ │ │ │ │ │
└──────────────┴──────────────┴────────┴───────────────┴────────────┴──────────┘
Passed Tests: 5/10 Percentage: 50.000%
Failed Tests: 5/10 Percentage: 50.000%
Adding 10 test results to /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/report.json
Writing Logfile to: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/logs/buildtest_cpv55wao.log
The -x
option can be used to exclude buildspecs which works similar to -b
where it can be a file or directory path.
In the next example try running the following commands:
buildtest build -b general_tests/configuration -x general_tests/configuration/ulimits.yml
buildtest build -b general_tests/configuration -x general_tests/configuration
You will notice in the second command when buildtest has no buildspecs to build it will terminate immediately.
Buildtest supports test timeout which can be used if you don’t want to wait indefinitely for test to complete. You
can use --timeout
option which will terminate test if it exceeds the timelimit. The timeout is in number of
seconds. Let’s try running the following example and take note of how timeout affects the test status:
buildtest build -b tutorials/sleep.yml
buildtest build -b tutorials/sleep.yml --timeout=1
buildtest build -b tutorials/sleep.yml --timeout=5
Buildtest supports test discovery based on tags via
buildtest build --tags
or short option -t
. Let’s try running the following test, take note
of the output as buildtest will show discovered buildspecs based on tag names
buildtest build -t python
$ buildtest build -t python
╭───────────────────────────── buildtest summary ──────────────────────────────╮
│ │
│ User: docs │
│ Hostname: build-20410989-project-280831-buildtest │
│ Platform: Linux │
│ Current Time: 2023/05/05 02:13:13 │
│ buildtest path: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ buildtest version: 1.4 │
│ python path: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ python version: 3.7.15 │
│ Configuration File: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Test Directory: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Report File: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ Command: /home/docs/checkouts/readthedocs.org/user_builds/buildte │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
─────────────────────────── Discovering Buildspecs ────────────────────────────
Discovered buildspecs
╔══════════════════════════════════════════════════════════════════════════════╗
║ buildspec ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
╚══════════════════════════════════════════════════════════════════════════════╝
Buildspecs By Tag=python
╔══════════════════════════════════════════════════════════════════════════════╗
║ buildspec ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
║ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ║
╚══════════════════════════════════════════════════════════════════════════════╝
Total Discovered Buildspecs: 2
Total Excluded Buildspecs: 0
Detected Buildspecs after exclusion: 2
────────────────────────────── Parsing Buildspecs ──────────────────────────────
Valid Buildspecs: 2
Invalid Buildspecs: 0
/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/tutorials/python-shell.yml: VALID
/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/tutorials/python-hello.yml: VALID
Total builder objects created: 2
Builders by type=script
┏━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┓
┃ builder ┃ type ┃ executor ┃ compiler ┃ nodes ┃ procs ┃ descrip… ┃ builds… ┃
┡━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━┩
│ circle_… │ script │ generic… │ None │ None │ None │ Calcula… │ /home/… │
│ │ │ │ │ │ │ circle │ │
│ │ │ │ │ │ │ of area │ │
│ │ │ │ │ │ │ given a │ │
│ │ │ │ │ │ │ radius │ │
├──────────┼────────┼──────────┼──────────┼───────┼───────┼──────────┼─────────┤
│ python_… │ script │ generic… │ None │ None │ None │ Hello │ /home/… │
│ │ │ │ │ │ │ World │ │
│ │ │ │ │ │ │ python │ │
└──────────┴────────┴──────────┴──────────┴───────┴───────┴──────────┴─────────┘
──────────────────────────────── Building Test ─────────────────────────────────
circle_area/198973b0: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-shell/circle_area/198973b0
circle_area/198973b0: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-shell/circle_area/198973b0/stage
circle_area/198973b0: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-shell/circle_area/198973b0/circle_area_build.sh
python_hello/3942e08a: Creating test directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-hello/python_hello/3942e08a
python_hello/3942e08a: Creating the stage directory: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-hello/python_hello/3942e08a/stage
python_hello/3942e08a: Writing build script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-hello/python_hello/3942e08a/python_hello_build.sh
──────────────────────────────── Running Tests ─────────────────────────────────
Spawning 1 processes for processing builders
───────────────────────────────── Iteration 1 ──────────────────────────────────
python_hello/3942e08a does not have any dependencies adding test to queue
circle_area/198973b0 does not have any dependencies adding test to queue
circle_area/198973b0: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-shell/circle_area/198973b0/stage
circle_area/198973b0: Running Test via command: bash --norc --noprofile -eo pipefail circle_area_build.sh
circle_area/198973b0: Test completed in 0.031263 seconds
circle_area/198973b0: Test completed with returncode: 0
circle_area/198973b0: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-shell/circle_area/198973b0/circle_area.out
circle_area/198973b0: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-shell/circle_area/198973b0/circle_area.err
python_hello/3942e08a: Current Working Directory : /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-hello/python_hello/3942e08a/stage
python_hello/3942e08a: Running Test via command: bash --norc --noprofile -eo pipefail python_hello_build.sh
python_hello/3942e08a: Test completed in 0.030801 seconds
python_hello/3942e08a: Test completed with returncode: 0
python_hello/3942e08a: Writing output file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-hello/python_hello/3942e08a/python_hello.out
python_hello/3942e08a: Writing error file - /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/python-hello/python_hello/3942e08a/python_hello.err
In this iteration we are going to run the following tests: [circle_area/198973b0, python_hello/3942e08a]
Test Summary
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ ┃ ┃ ┃ checks ┃ ┃ ┃
┃ ┃ ┃ ┃ (ReturnCode, ┃ ┃ ┃
┃ ┃ ┃ ┃ Regex, ┃ ┃ ┃
┃ builder ┃ executor ┃ status ┃ Runtime) ┃ returncode ┃ runtime ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━┩
│ python_hello │ generic.loc… │ PASS │ None None │ 0 │ 0.030801 │
│ /3942e08a │ │ │ None │ │ │
├──────────────┼──────────────┼────────┼───────────────┼────────────┼──────────┤
│ circle_area/ │ generic.loc… │ PASS │ None None │ 0 │ 0.031263 │
│ 198973b0 │ │ │ None │ │ │
└──────────────┴──────────────┴────────┴───────────────┴────────────┴──────────┘
Passed Tests: 2/2 Percentage: 100.000%
Failed Tests: 0/2 Percentage: 0.000%
Adding 2 test results to /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/report.json
Writing Logfile to: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/logs/buildtest_rop4fei9.log
To learn more about how to run tests, please refer to Building Test (buildtest build) guide.
Querying Test Report¶
Buildtest will keep track of all tests in a report file (JSON) that can be used to display content of all test runs
and query metadata specific to test. To fetch all test runs you can use buildtest report
command which will displays
output in a table format.
You can fetch the path to report file by running:
buildtest report path
Buildtest can write test results to alternate report file if buildtest --report
is used, you can list all report files by
running:
buildtest report list
buildtest rt is an alias for buildtest report command for those that hate typing :-)
We can fetch all pass and failed tests via --fail
and --pass
. Let’s try running the following:
buildtest rt --fail
buildtest rt --pass
Now let’s assume you want to know total failed tests in report file, you can use --row-count
option which
displays total row count. Let’s run the following and see total fail count:
buildtest rt --fail --row-count
The buildtest rt summary
can be useful if you want to summary of report file.
Buildtest supports paging support with buildtest rt
which can be useful when you
have lots of tests. To enable pagination you can run:
buildtest rt --pager
Finally we can filter test records and format table columns via --filter
and --format
option. Let’s try
running the following command
buildtest rt --filter tags=python --format name,id,tags
$ buildtest rt --filter tags=python --format name,id,tags
Report File: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/report.json
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ name ┃ id ┃ tags ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ python_hello │ 3942e08a │ python │
├──────────────────────────┼──────────────────┼────────────────────────────────┤
│ circle_area │ 198973b0 │ tutorials python │
└──────────────────────────┴──────────────────┴────────────────────────────────┘
The --format
option are comma separated list of format fields while --filter
option are key=value pair. To see
list of available format and filter fields you can run:
buildtest rt --helpfilter
buildtest rt --helpformat
Inspecting Test¶
The buildtest inspect
command can be used to query test details and display metadata for one or more test. First you will
want to see all available test and their corresponding unique identifiers. Let’s run the following
buildtest it list
$ buildtest it list
Test Summary by id, name, buildspec
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ id ┃ name ┃ buildspec ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ bb865304-3382-4474-953… │ variables_bash │ /home/docs/checkouts/r… │
│ 408b9d78-d9fc-4cda-a6a… │ exit1_fail │ /home/docs/checkouts/r… │
│ a59d43b6-3691-4e5e-9da… │ exit1_pass │ /home/docs/checkouts/r… │
│ 9b4f8e4f-d839-40b3-a5f… │ returncode_list_mismatch │ /home/docs/checkouts/r… │
│ f2150971-793c-4f3a-987… │ returncode_int_match │ /home/docs/checkouts/r… │
│ 8f0a3fc3-13d9-4b11-ab4… │ status_regex_pass │ /home/docs/checkouts/r… │
│ e1dfda3d-a24a-43f5-a4b… │ status_regex_fail │ /home/docs/checkouts/r… │
│ 79c71877-770d-470f-b08… │ regex_on_multiple_files │ /home/docs/checkouts/r… │
│ 9320de0e-c4ca-4a03-916… │ file_expansion_supported │ /home/docs/checkouts/r… │
│ c09769d7-aa45-462e-b4c… │ regex_on_directory_not_… │ /home/docs/checkouts/r… │
│ 149e684c-7e71-45a4-b14… │ timelimit_max_fail │ /home/docs/checkouts/r… │
│ d4465414-305c-4cd3-9ca… │ timelimit_min │ /home/docs/checkouts/r… │
│ 2b866068-f0ac-4226-92f… │ timelimit_min_max │ /home/docs/checkouts/r… │
│ 73df1ff6-5f5a-440d-b43… │ timelimit_min_fail │ /home/docs/checkouts/r… │
│ 44faad68-fe82-45aa-b91… │ timelimit_max │ /home/docs/checkouts/r… │
│ 4f6365ae-11d5-4a1e-bea… │ test_fail_returncode_ma… │ /home/docs/checkouts/r… │
│ 96065b76-cda0-4644-ba9… │ always_pass │ /home/docs/checkouts/r… │
│ b43cada2-ec05-422d-870… │ test_pass_returncode_mi… │ /home/docs/checkouts/r… │
│ 39e87d77-f4b1-4f4f-b9d… │ always_fail │ /home/docs/checkouts/r… │
│ e220693d-3e88-49ce-874… │ status_exists_failure │ /home/docs/checkouts/r… │
│ 6d3ec2a4-7bb4-4731-8bb… │ status_exists │ /home/docs/checkouts/r… │
│ 0ddd9dd0-1689-49ab-9ff… │ file_exists_pass │ /home/docs/checkouts/r… │
│ 1f929cfd-4a1b-4c98-99d… │ combined_file_and_dir_c… │ /home/docs/checkouts/r… │
│ b99d1319-828d-4254-891… │ file_and_dir_checks │ /home/docs/checkouts/r… │
│ 7620954d-1eef-4c41-831… │ symlink_test │ /home/docs/checkouts/r… │
│ 354c8707-d8db-4db1-b7b… │ file_count_on_directory │ /home/docs/checkouts/r… │
│ 440eae0c-dfd9-459a-9e4… │ file_count_by_extension │ /home/docs/checkouts/r… │
│ a0dfa08c-9acf-4291-8d9… │ file_extension_and_file… │ /home/docs/checkouts/r… │
│ a5f101fd-c254-45fd-87c… │ file_count_by_expression │ /home/docs/checkouts/r… │
│ 3deddfb6-d9a7-4e01-aa9… │ file_count_by_filetype │ /home/docs/checkouts/r… │
│ bb9a5659-6e45-4498-972… │ file_traverse_limit │ /home/docs/checkouts/r… │
│ c7b90af2-f195-49bb-b6e… │ status_logical_or │ /home/docs/checkouts/r… │
│ 79459d02-0f43-4ab5-904… │ status_logical_and │ /home/docs/checkouts/r… │
│ e72c2307-ce12-47e9-9ff… │ unskipped │ /home/docs/checkouts/r… │
│ 5b70f57c-8acf-4d0c-835… │ hello_world │ /home/docs/checkouts/r… │
│ a55c38fa-7a84-4e06-ab1… │ hello_world │ /home/docs/checkouts/r… │
│ c8f9baba-257e-41bc-b0d… │ root_disk_usage │ /home/docs/checkouts/r… │
│ 56935dd4-25c6-44c1-b06… │ ulimit_cputime_unlimited │ /home/docs/checkouts/r… │
│ 43e487c1-b525-479c-940… │ ulimit_filelock_unlimit… │ /home/docs/checkouts/r… │
│ 08ac6570-356e-4668-961… │ ulimit_vmsize_unlimited │ /home/docs/checkouts/r… │
│ 87627b79-610f-4c16-a07… │ ulimit_filedescriptor_4… │ /home/docs/checkouts/r… │
│ 9316d82e-ef44-48e5-b3e… │ ulimit_max_user_process… │ /home/docs/checkouts/r… │
│ 37a02870-5fd4-46c6-9b1… │ ulimit_stacksize_unlimi… │ /home/docs/checkouts/r… │
│ affc9602-0481-4379-bb6… │ systemd_default_target │ /home/docs/checkouts/r… │
│ 9f65c34f-93a6-4bcc-abc… │ kernel_swapusage │ /home/docs/checkouts/r… │
│ 3942e08a-3f63-4749-8df… │ python_hello │ /home/docs/checkouts/r… │
│ 198973b0-5c47-4129-b51… │ circle_area │ /home/docs/checkouts/r… │
└─────────────────────────┴──────────────────────────┴─────────────────────────┘
In buildtest, test are referred as builders which is in format <name>/<ID> where each test has a unique identifier separated by backslash / character. To see all builders you can run:
buildtest it list -b
Note, we will be using the builder notation when querying test via buildtest it name
and buildtest it query
. The
command buildtest it name
will display raw JSON record from the report file for a given test. The test names can be positional
arguments so you can query multiple tests simulataneously. Let’s run the following:
buildtest it name hello_world circle_area
The buildtest it query
is used to query test records in human readable format. This command is useful once you
run test via buildtest build
and you want to inspect test result. buildtest can display test content, output and
error file and support multiple test queries including regular expression!!
Let’s try running the following
buildtest it query -o -e -t hello_world
$ buildtest it query -o -e -t hello_world
─────────────── hello_world/a55c38fa-7a84-4e06-ab18-9a986ba21b73 ───────────────
Executor: generic.local.bash
Description: hello world example
State: PASS
Returncode: 0
Runtime: 0.005592 sec
Starttime: 2023/05/05 02:13:11
Endtime: 2023/05/05 02:13:11
Command: bash --norc --noprofile -eo pipefail hello_world_build.sh
Test Script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/hello_world.sh
Build Script: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/hello_world_build.sh
Output File: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/hello_world.out
Error File: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/tests/generic.local.bash/hello_world/hello_world/a55c38fa/hello_world.err
Log File: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/var/logs/buildtest_cpv55wao.log
─ Output File: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/che… ─
hello world!
─ Error File: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/chec… ─
─ Test File: /home/docs/checkouts/readthedocs.org/user_builds/buildtest/check… ─
#!/usr/bin/bash
# Content of run section
echo "hello world!"
You can retrieve paths to given test via buildtest path
that can be useful if you want to navigate to directory or list
contents. By default buildtest path
will retrieve root directory of test. You can retrieve output and error via
buildtest path -o
and buildtest path -e
. Let’s try running:
buildtest path hello_world
buildtest path -o hello_world
buildtest path -e hello_world
We encourage you review Query Test Report for a detailed guide on how to query test in buildtest.
Interacting with Buildspecs¶
Buildtest supports several ways to interact with buildspecs, such as querying buildspec cache,
validating buildspecs, showing content of buildspecs, and editing buildspecs in editor.
The buildtest buildspec
command contains several subcommands that we will discuss in this
session. To learn more we encourage you see Buildspecs Interface for detailed guide.
The buildtest help
command can be used to provide a brief help message for each subcommand. Let’s run
the following command since there are lots of commands that can be used to query buildspec.
buildtest help buildspec
$ buildtest help buildspec
Finding Buildspecs
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Command ┃ Description ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ buildtest buildspec find │ Discover and validate all buildspecs │
│ │ and load all validated buildspecs in │
│ │ cache │
│ buildtest buildspec find --rebuild │ Rebuild cache file │
│ buildtest buildspec find --pager │ Paginate output of buildspec cache │
│ buildtest buildspec find --root /tmp │ Discover buildspecs in /tmp and │
│ --rebuild │ rebuild buildspec cache │
│ buildtest buildspec find --quiet │ Rebuild cache file but don't display │
│ --rebuild │ output of cache │
│ buildtest buildspec find --paths │ Print all root directories for │
│ │ buildspecs │
│ buildtest buildspec find --buildspec │ List all available buildspecs from │
│ │ cache │
│ buildtest buildspec find --executors │ List all unique executors from cache │
│ buildtest buildspec find --filter │ Filter buildspec cache based on │
│ type=script,tags=pass │ type=script and tags='pass' │
│ buildtest buildspec find --filter │ Filter cache by buildspec file │
│ buildspec=<path> │ │
│ buildtest buildspec find --format │ Format table columns by field: │
│ name,description │ 'name', and 'description' │
│ buildtest buildspec find │ Group tests by tag name │
│ --group-by-tags │ │
│ buildtest buildspec find │ Group tests by executor name │
│ --group-by-executor │ │
│ buildtest buildspec find --helpfilter │ Show all filter fields │
│ buildtest buildspec find --helpformat │ Show all format fields │
│ buildtest buildspec find --terse │ Display output in terse format │
│ buildtest buildspec find --row-count │ Print total count of records from │
│ │ the table │
│ buildtest buildspec find --count=5 │ Limit output of buildspec cache to 5 │
│ │ elements │
│ buildtest buildspec find invalid │ Show invalid buildspecs │
│ buildtest buildspec find invalid │ Show invalid buildspecs with error │
│ --error │ messages │
│ buildtest buildspec find invalid │ Print total count of records from │
│ --row-count │ the table │
└───────────────────────────────────────┴──────────────────────────────────────┘
Validating Buildspecs
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Command ┃ Description ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ buildtest buildspec validate -b │ Validate a buildspec with JSON │
│ <file> │ Schema │
│ buildtest buildspec validate -b /tmp/ │ Validate all buildspecs in directory │
│ -x /tmp/network │ /tmp but exclude /tmp/network │
│ buildtest buildspec validate -t │ Validate all buildspecs for tagname │
│ python -t mac │ 'python' and 'mac' │
│ buildtest buildspec validate -e │ Validate all buildspecs for executor │
│ generic.local.bash │ 'generic.local.bash' │
└───────────────────────────────────────┴──────────────────────────────────────┘
Additional Features of Buildspecs
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Command ┃ Description ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ buildtest buildspec summary │ Show summary of buildspec cache file │
│ buildtest buildspec summary --pager │ Paginate the output of summary for │
│ │ buildspec cache │
│ buildtest buildspec show python_hello │ Show content of buildspec based on │
│ │ test name 'python_hello' │
│ buildtest buildspec show python_hello │ Use color theme 'emacs' for showing │
│ --theme emacs │ content of test │
│ buildtest buildspec show-fail │ Show content of buildspec on all │
│ │ failed tests │
│ buildtest buildspec show-fail │ Show content of test 'exit1_fail' │
│ exit1_fail │ │
│ buildtest buildspec edit-test │ Open test 'python_hello' in editor │
│ python_hello │ and validate file upon closing │
│ buildtest buildspec edit-file │ Open file │
│ $BUILDTEST_ROOT/tutorials/sleep.yml │ $BUILDTEST_ROOT/tutorials/sleep.yml │
│ │ in editor and validate file upon │
│ │ closing │
│ buildtest buildspec maintainers find │ Find buildspec with maintainer name │
│ johndoe │ 'johndoe' │
│ buildtest buildspec maintainers │ List all maintainers from buildspec │
│ --list │ cache │
│ buildtest buildspec maintainers │ Print total count of records from │
│ --list --row-count │ the table │
│ buildtest buildspec maintainers │ List all maintainers in machine │
│ --list --terse --no-header │ readable format without header │
│ buildtest buildspec maintainers │ Show breakdown of maintainers by │
│ --breakdown │ buildspecs │
└───────────────────────────────────────┴──────────────────────────────────────┘
To build the buildspec cache you will need to run the following:
buildtest buildspec find --rebuild -q
The --rebuild
option will rebuild the cache and -q
will supress output. If you want to see all
valid buildspecs in cache you can run:
buildtest buildspec find
To retrieve all tags you can run:
buildtest buildspec find --tags
We can filter tests via --filter
option which expects a key=value pair. Let’s filter by tagname python
by running:
buildtest buildspec find --filter tags=python
We can format the columns using --format
option where each field is comma separated. Let’s format by fields
name
, tags
, description
buildtest buildspec find --filter tags=python --format name,tags,description
To see all filter and format fields you can use --helpfilter
and --helpformat
to list all fields and their description.
If you want to see a summary of the buildspec cache you can run:
buildtest buildspec summary
Buildtest has an alias buildtest bc
for buildtest buildspec command so let’s use this going forward.
To validate a buildspec you can use buildtest bc validate command there are several options analogous to buildtest build
for discovering buildspecs such as -b
, -x
, -t
, -e
. For instance let’s validate the following buildspecs:
buildtest bc validate -b tutorials/hello_world.yml -b general_tests/configuration
buildtest bc validate -t python
Let’s try validating an invalid buildspec so you can see what happens
buildtest bc validate -b tutorials/invalid_executor.yml
$ buildtest bc validate -b tutorials/invalid_executor.yml
─ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ─
"[/home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable/tutorials/invalid_executor.yml]: Unable to find executor: badexecutor in ['generic.local.bash', 'generic.local.sh', 'generic.local.csh', 'generic.local.zsh']"
1 buildspecs failed to validate
To see content of buildspec you can use buildtest bc show
which expects name of test. Note tab completion
is supported.
Let’s run the following:
buildtest bc show sleep hello_world
Buildtest uses rich python library for coloring which is used extensively throughout the buildtest output.
Rich supports several built-in themes that can be used for your preference. The buildtest bc show -t <THEME>
can be used
select a color theme.
Currently, buildtest supports the following themes, feel free to tab complete:
buildtest bc show -t
abap borland emacs gruvbox-dark lovelace native paraiso-light sas stata-dark vs
algol bw friendly gruvbox-light manni nord pastie solarized-dark stata-light xcode
algol_nu colorful friendly_grayscale igor material nord-darker perldoc solarized-light tango zenburn
arduino default fruity inkpot monokai one-dark rainbow_dash staroffice trac
autumn dracula github-dark lilypond murphy paraiso-dark rrt stata vim
Let’s try running the same example with emacs
theme:
buildtest bc show -t emacs sleep
If you want to see list of invalid buildspecs you can run:
buildtest bc find invalid
Note, if you fix your invalid buildspec, buildtest will have no way of knowing if buildspec is valid until you
rebuild the buildspec cache buildtest bc find --rebuild
.
Buildtest Configuration¶
In order to use buildtest, you need to configure buildtest. We will not discuss buildtest configuration in this tutorial, but show how you can interact with configuration file via command line.
Buildtest provides a default configuration file that is sufficient to get started. To view path to configuration file you can run:
buildtest config path
We have an alias buildtest cg
for buildtest config command. If you want to view content of configuration file you can run
buildtest cg view
$ buildtest cg view
─ /home/docs/checkouts/readthedocs.org/user_builds/buildtest/checkouts/stable… ─
1 system:
2 generic:
3 # specify list of hostnames where buildtest can run for given system record
4 hostnames: [".*"]
5
6 # system description
7 description: Generic System
8 # specify module system used at your site (environment-modules, lmod)
9 moduletool: N/A
10
11 # specify test timeout duration in number of seconds
12 # timeout: 60
13
14 # pool size for parallel processing using multiprocessing.Pool. Pool Size must be 1 or higher. The pool size is calculated as follows: poolsize = min(poolsize, os.cpu_count())
15 poolsize: 1
16
17 # determine whether to enable pagination
18 pager: False
19
20 buildspecs:
21 # whether to rebuild cache file automatically when running `buildtest buildspec find`
22 rebuild: False
23 # limit number of records to display when running `buildtest buildspec find`
24 count: 15
25 # format fields to display when running `buildtest buildspec find`, By default we will show name,description
26 format: "name,description"
27 # enable terse mode
28 terse: False
29 # specify list of directories to search for buildspecs when building cache
30 #root: [ $BUILDTEST_ROOT/examples, /tmp/buildspecs ]
31 report:
32 count: 25
33 #enable terse mode for report
34 terse: False
35 format: "name,id,state,runtime,returncode"
36 # show the latest for every test
37 latest: True
38 # show the oldest for every test
39 oldest: False
40
41 executors:
42 # define local executors for running jobs locally
43 local:
44 bash:
45 description: submit jobs on local machine using bash shell
46 shell: bash
47 sh:
48 description: submit jobs on local machine using sh shell
49 shell: sh
50 csh:
51 description: submit jobs on local machine using csh shell
52 shell: csh
53 zsh:
54 description: submit jobs on local machine using zsh shell
55 shell: zsh
56 # compiler block
57 compilers:
58 # a list of directories to search for modules
59 # modulepath: ['/tmp', '/var/']
60
61 # regular expression to search for compilers based on module pattern. Used with 'buildtest config compilers find' to generate compiler instance
62 # find:
63 # gcc: "^(gcc)"
64 # intel: "^(intel)"
65 # cray: "^(craype)"
66 # pgi: "^(pgi)"
67 # cuda: ^(cuda)"
68 # clang: "^(clang)"
69
70 # declare compiler instance which can be site-specific. You can let 'buildtest config compilers find' generate compiler section
71 compiler:
72 gcc:
73 builtin_gcc:
74 cc: gcc
75 fc: gfortran
76 cxx: g++
77
78 # location of log directory
79 # logdir: /tmp/
80
81 # specify location where buildtest will write tests
82 # testdir: /tmp
83
84 # specify one or more directory where buildtest should load buildspecs
85 # buildspec_roots: []
86
87 cdash:
88 url: https://my.cdash.org/
89 project: buildtest
90 site: generic
91 buildname: tutorials
92
We also support color themes (buildtest cg view --theme <theme>
) when showing content of buildtest configuration.
Buildtest configuration file defines one or more executors that are used when writing test. Every test must be run by an executor. To retrieve all executors in a flat-listing you can run:
buildtest cg executors
Buildtest can show executor details in JSON and YAML format, you can fetch the details by running:
buildtest cg executors --json
buildtest cg executors --yaml