usr/src/tools/tests/README
author Jon Tibble <meths@btinternet.com>
Wed, 21 Dec 2011 11:18:45 +0000
branchoi_151a
changeset 1437 1360cccd3c03
parent 862 e9f31f2f2f2d
child 1272 7788c9e14874
permissions -rw-r--r--
Added tag oi_151a_release for changeset 8c642698bcb5

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
#

This directory contains configuration files for Nose, the PyUnit test runner
for the slim_source gate. In order to run the tests you should:

1) Install Nose and the coverage module:
	* Installing the Python setup tools:
		pkg install library/python-2/setuptools-26
	* Running the command:
		easy_install-2.6 nose coverage
		(The warning messages during installation may be ignored)

	Note:	As of June 22, 2010, Nose is currently in the JUCR process,
		and may be available from the contrib repository at a
		later date.

2) Build the gate, per the instructions in usr/src/README.
	Note:	The slim_test program will test Python code from
		the proto area, so the associated files must be
		re-built to pick up any changes to tested code.
		The tests themselves are run from the source files,
		so changes to tests do not require a re-build.

3) Use the "bldenv" command to set-up the build and test environment:
	/opt/onbld/bin/bldenv -d ../../developer.sh

4) Run the following command to execute all the currently known tests:
	./slim_test -c tests.nose

The "slim_test" command is a thin wrapper around the "nosetests" command,
and accepts the same arguments. To see a full list of available arguments, run:
	./slim_test -h

To run an individual test:
        ./slim_test -c tests.nose TEST_NUM [TEST_NUM]...
        
Where TEST_NUM is the number of the test you'd like to run, and may be
specified multiple times to run more than one test. Test numbers are
indicated during a full run. To query the test numbers without executing the
tests, run:
        ./slim_test -c tests.nose --collect-only

Note: To reset the numbering, delete the "usr/src/.noseids" file

To run all tests within a specific file or package, omit the "-c tests.nose"
portion, and supply the path to the file or package, relative to the usr/src
directory of the workspace. For example, the following command runs only
the liberrsvc_pymod tests:
	./slim_test lib/liberrsvc_pymod/test 

To run all tests in a specific file:
	./slim_test lib/liberrsvc_pymod/test/test_liberrsvc.py

To run a specific class of tests in that file:
	./slim_test lib/liberrsvc_pymod/test/test_liberrsvc.py:error_service

To run a particular test in that class:
	./slim_test lib/liberrsvc_pymod/test/test_liberrsvc.py:error_service.test_create_error_info

To report code coverage metrics along with test results, add a "--with-cover"
flag:
	./slim_test -c tests.nose --with-cover

To add a set of tests to the suite, update the tests.nose file. See that
file for more details.