AutoTest Command Line Interface
Autotest provides a set of commands that can be used to manage the autotest database, as well as schedule and manage jobs.
The commands are in the ./cli directory.
By default, the commands access the server at: http://autotest. This can be overwritten by setting the AUTOTEST_WEB environment variable.
Job Management
The following commands are used to manage jobs and tests:
job-create job-ls job-stat job-abort test-ls
Creating and Aborting a Job
To create a job: job-create [--priority] [--on-server] [--kernel=file] [--control-file=file|--tests=a,b,c] job_name machines...
The options are:
--priority sets the job scheduling priority to Low (default), Medium, High or Urgent.
--on-server specifies if the job is a server job, or a client job (defautl).
--kernel=<file> specifies a kernel to install before running the tests.
The tests can be specified in 2 mutually exclusive ways:
--control-file=<file> will run the job describe in the control file <file>,
--tests=a,b,c will create a control file to run the tests a, b, and c.
The job will be assigned a job_name and will be run on the single or list of machines.
You can find the list of existing tests and their classification using test-ls.
You can use job-ls and job-stat to get information about your job, and job-abort to delete a job.
# test-ls
Client tests:
Kernel:
sleeptest kernbench dbench tbench unixbench disktest aiostress fsstress interbench linux_stress
Server tests:
Kernel:
sleeptest re-install
# job-create --priority=Medium --tests=dbench,kernbench my_test crash1
my_test/3 created
# job-create --priority=Medium --tests=dbench,kernbench my_test crash1
my_test/4 created
# job-ls --verbose
Your jobs:
ID Name Status Priority Control File
3 my_test Aborted Medium job.run_test('dbench')
job.run_test('kernbench')
4 my_test Queued Medium job.run_test('dbench')
job.run_test('kernbench')
# job-stat 3
Status for job my_test:
crash1: Queued
# job-stat -v 3
Status for job my_test:
crash1: Queued
# job-abort 3
my_test aborted
# job-ls --running
Your jobs:
ID Name
4 my_test
# job-create --priority=Medium --control-file=./server/samples/sleeptest.srv --on-server my_sleep crash2
my_sleep/5 created
# job-ls --verbose
Your jobs:
ID Name Status Priority Control File
3 my_test Aborted Medium job.run_test('dbench')
job.run_test('kernbench')
4 my_test Queued Medium job.run_test('dbench')
job.run_test('kernbench')
5 my_sleep Queued Medium def run(machine):
host = hosts.SSHHost(machine)
at = autotest.Autotest(host)
at.run_test('sleeptest')
parallel_simple(run, machines)
Host Management
The following commands are used to manage hosts:
host-create host-rm host-ls host-ls-group host-ls-label host-stat
Creating and Deleting a Host
To create a host, use host-create [--locked] [--some-might-fail] {--host-list=<file> | hosts}
To delete a host, use host-rm {--host-list=<file> | hosts}
Use the --locked flag to lock the host at creation time. The scheduler will not assign jobs to a locked host.
If the --some-might-fail flag is set, host-create will continue to add hosts even if some of them fail.
The hosts can be specified explicitely on the command line, or put in a file and using the --host-list=<file> option.
host-create will access the host to gather some information about it.
# host-create --some-might-fail crash1 crash2 Added host crash1 Added host crash2 # host-ls Name Status Locked Platf Labels crash1 Ready False x86_64 x86_64 crash2 Ready False x86_32 x86_32 # host-rm crash1 Removed host crash1 # host-create --locked crash1 Added host crash1 # host-ls Name Status Locked Platf Labels crash1 Ready True x86_64 x86_64 crash2 Ready False x86_32 x86_32
To list the hosts, 3 commands are provided:
host-ls displays all the hosts,
host-ls-label displays allt the hosts tagged with a label or platform,
host-ls-group displays allt the hosts in an ACL group.
# host-ls Name Status Locked Platf Labels crash1 Ready True x86_64 x86_64 crash2 Ready False x86_32 x86_32 # host-ls-group everyone crash1 crash2 # host-ls-label x86_64 crash1
host-stat displays the host information and can modify the host status: host-stat [--lock|--unlock] host [Ready|Dead]
# host-stat --lock crash1 Locked host crash1 # host-stat crash1 Host: crash1/x86_64 Status: Ready Locked: True ACLs for crash1: ID Name 1 Everyone Labels for crash1: ID Name 2 x86_64 # host-stat crash1 Dead Modified host crash1 status to Dead # host-stat --unlock crash1 Unlocked host crash1 # host-stat crash1 Host: crash1/x86_64 Status: Dead Locked: False ACLs for crash1: ID Name 1 Everyone Labels for crash1: ID Name 2 x86_64
User Management
The following commands are used to manage users:
user-create user-rm user-ls
Creating and Deleting a User
To create a user, use user-create [--access-level <n>] <users>. The access level is not currently used and is just for future features. It defaults to 0.
To delete a user, use user-rm <users>:
# user-create penguin Created user penguin with ID 14 # user-rm penguin Deleted user penguin
Listing users
To display the current users, use user-ls [--group <group> --access-level <n>].
# user-ls Users: debug_user penguin # user-ls --group my_group ACL my_group: Users: penguin
Access Control List Management
The following commands are used to manage the ACLs:
aclgroup-create aclgroup-ls aclgroup-rm aclgroup-add-hosts aclgroup-add-users aclgroup-rm-hosts aclgroup-rm-users
Creating and Deleting an ACL
To create an ACL, use aclgroup-create <group> <description>. To delete an ACL, use aclgroup-rm <group>.
# aclgroup-create my_group autotest my_group created # aclgroup-rm your_group your_group destroyed
Listing ACLs
To list existing ACLs use `aclgroup-ls [--user <user> | --host <host>]`. It list all ACLs, or ACLs that a user or host belongs to:
# aclgroup-ls ACLs: ID Name 1 Everyone 2 my_group 3 your_group # aclgroup-ls --user penguin ACLs for penguin: ID Name 1 Everyone 2 my_group # aclgroup-ls --host crashandburn ACLs for crashandburn: ID Name 1 Everyone 3 your_group
Adding Hosts or Users to an ACL
To add users or hosts to an ACL, use aclgroup-add-users <group> <users> and aclgroup-add-hosts <group> <hosts>:
# aclgroup-add-users my_group penguin penguin added to my_group # aclgroup-add-hosts my_group crashandburn reallybad crashandburn, reallybad added to my_group
Deleting Hosts or Users from an ACL
To delete users or hosts to an ACL, use aclgroup-rm-users <group> <users> and aclgroup-rm-hosts <group> <hosts>:
# aclgroup-rm-users my_group penguin penguin removed from my_group # aclgroup-rm-hosts my_group crashandburn reallybad crashandburn, reallybad removed from my_group
Label Management
Labels are used to group and categorize hosts.
The following commands are used to manage the labels:
label-create label-set label-rm label-ls label-add-hosts label-rm-hosts
A label has a platform flag associated with it, which can be set when creating the label, or later using the label-set command.
The --kernel-config option to the label-create and label-set command is currently unused.
Creating, Modifying and Deleting Labels
To create a label, use label-create [--kernel-config <cfg> | --platform] <label>.
To modify a label, use label-set [--not-platform | --is-platform] [--kernel=URL] label.
To delete a label, use label-rm <label>.
# label-create mylabel Label mylabel created # label-create --is-platform mylabel Label 'mylabel' updated # label-rm mylabel Label mylabel destroyed
Listing Labels
To list labels and platforms, 3 commands are available:
label-ls lists all the labels,
label-ls <host> lists all the labels associated with a host,
platforms-ls lists all the platform labels.
# label-ls Labels: ID Name 1 mylabel 2 x86_64 # label-ls crashandburn Labels for crashandburn: ID Name 2 x86_64 # platform-ls Platforms: ID Name 2 x86_64
Labelling Hosts
To add or remove a label from hosts, use label-add-hosts <label> <hosts> and label-rm-hosts <label> <hosts>
# label-add-hosts mylabel crashandburn reallybad crashandburn added to mylabel reallybad added to mylabel # label-rm-hosts mylabel crashandburn reallybad crashandburn removed from mylabel reallybad removed from mylabel
host-borrow
