Changes between Initial Version and Version 1 of Testsuite


Ignore:
Timestamp:
Apr 23, 2011, 9:26:15 PM (13 years ago)
Author:
becoulet
Comment:

exp testsuite usage doc added

Legend:

Unmodified
Added
Removed
Modified
  • Testsuite

    v1 v1  
     1
     2= Required tools =
     3
     4Running the MutekH testsuite have the following requirements:
     5
     6 - A compiler toolchain,
     7 - A python 2 interpreter, available in most GNU/Linux and BSD operating systems,
     8 - Some target platform simulators,
     9 - The `testwrap` tool, a modified version of GNU coreutils timeout command,
     10 - Mercurial to clone the testsuite repository.
     11
     12Depending on the target you wish to run the testsuite on, you may not need to install all of these tools.
     13
     14The [[Install]] page explains how to install these requirements.
     15
     16= Usage =
     17
     18== Getting the test suite ==
     19
     20Once the required tools are installed and the MutekH source code is fetched, you need to get the testsuite:
     21
     22{{{
     23cd .../mutekh
     24hg clone https://www.mutekh.org/hg/tests
     25}}}
     26
     27The python module path must point to the [source:tests/lib/python] directory:
     28
     29{{{
     30export PYTHONPATH=tests/lib/python/
     31}}}
     32
     33== Test makefile generation ==
     34
     35Some tests applications are located in [source:tests/pool].
     36The [source:tests/bin/mtest] tool is designed generate a
     37makefile which runs a set of tests:
     38
     39 - It first reads tests descriptions from all directories passed on the command line,
     40 - then detects which backend tools are available on your system,
     41 - and finally generates a makefile ready to run the tests.
     42
     43Each test application will be used to generate many test targets in the makefile by
     44exploration of associated configurations space.
     45
     46{{{
     47$ tests/bin/mtest tests/pool/hello
     48Test: hello
     49  Total tests count:     42
     50  Available tests count: 42
     51Writing 'tests.mk' makefile.
     52}}}
     53
     54The generated makefile can then be used to start the previously selected tests:
     55
     56{{{
     57make -f tests.mk
     58}}}
     59
     60This will generate kernel binaries, log files and other files, all with the '`TEST`' prefix.
     61Each passed test target generates a stamp file which must be deleted to start the test again.
     62
     63= Test infrastructure =
     64
     65The testsuite repository contains the following directories:
     66
     67 - `pool/` : Tests source code and description,
     68 - `bin/` : Test generation and execution tools,
     69 - `lib/` : python testsuite modules,
     70 - `doc/` : python code documentation,
     71 - `tools/` : additional tools source code.
     72
     73The [source:tests/pool] directory contains a sub-directory for each test application.
     74Other user test applications may reside elsewhere but a test application must always
     75be packaged in its own directory.
     76
     77== Test application details ==
     78
     79This part requires good knowledge of the BuildSystem usage.
     80
     81A test is always packaged in a directory. It's a regular MutekH application module
     82with an additional test description file. It is composed of:
     83
     84 - Some '.c' source files of the test application,
     85 - An associated '`Makefile`' file,
     86 - A '`config`' file. This file contain configuration sections as described in BuildSystem#Advancedsyntax,
     87 - A '`test`' description file. This python file contains the test description.
     88
     89The '`test`' description file contains details about how to build and run the test application:
     90
     91 - It specifies configuration sections which may be passed to the build system when building the test application.
     92 - It associates backend names to some of the configuration sections to allow selection of the right execution platform.
     93 - It specifies configuration space to explore for the test.
     94 - It specifies ordered test actions (configuration, build, execute, ...).
     95 - It specifies expected results.
     96
     97The test will be built and executed for each possible configuration in the configuration test space.
     98
     99=== Example test files ===
     100
     101Parts of the test files are detailed here as an example.
     102Refer to [source:tests/pool/hello/] for full content.
     103
     104==== Configuration sections ====
     105
     106The test description file is a python script which relies on python modules found
     107in the [source:tests/lib/python] directory.
     108
     109An instance of the `Config` class is used to identify a valid configuration
     110section which can be passed in the BUILD variable of the build command line.
     111Such an instance must exist for each configuration section available in the '`config`' file
     112which is triggered during exploration of the configuration space.
     113
     114For instance, if the '`config`' file contains the following lines:
     115{{{
     116%section test_ipi
     117  CONFIG_HEXO_IPI defined
     118%else
     119  CONFIG_HEXO_IPI undefined
     120}}}
     121the following line in the '`test`' file allows triggering of the inter-processor
     122interrupts (IPI) feature in the test configuration space:
     123{{{
     124# test configuration           BUILD sections
     125
     126ipi                  = Config("test_ipi")
     127}}}
     128
     129Target architecture configuration sections need to be associated with one or more backends
     130to enable the test generation tool to chose the right execution platform (eg simulator).
     131Test will be run on available backends and unavailable backends will be skipped.
     132
     133{{{
     134# test configuration           BUILD sections                           test backends
     135
     136soclib_mips32el      = Config("soclib-mips32el:pf-tutorial",           "soclib_mips32el")
     137soclib_mips32el_smp4 = Config("soclib-mips32el:pf-tutorial:test_smp4", "soclib_mips32el_smp4")
     138ibmpc_x86            = Config("ibmpc-x86",                             "qemu_x86", "bochs_x86")
     139}}}
     140
     141==== Test description ====
     142
     143Once all `Config` instances have been created, an instance of the `Environment` class must
     144be created which describes the test. This instance have several properties:
     145
     146 - `name`: The test unique name,
     147 - `test_space` : A list of configuration dimensions describing the test configuration space.
     148 - `actions` : A list of actions to perform for this test.
     149 - `success_grep`: A grep expression to search for in the execution output for the test to pass,
     150 - `timeout`: simulation timeout delay,
     151
     152The `test_space` property is a list of `Dimension` and `Exclude` instances used to finely describe
     153the configuration space based on previously declared `Config` objects.
     154
     155The following example shows how to defines a two dimensional space with the first dimension being the target
     156architecture and the second dimension triggering the IPI feature. An additional `Exclude` rule
     157excludes configurations where inter-processors interrupts would be used in single processor platforms.
     158
     159{{{
     160    test_space = [
     161        Dimension(soclib_mips32eb, soclib_mips32eb_smp4, ibmpc_x86),
     162        Dimension(ipi, None),
     163        Exclude(ipi & ~soclib_mips32eb_smp4)
     164        ],
     165}}}