Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 3 | <html> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 4 | <head> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 5 | <title>LLVM Test Suite Guide</title> |
| 6 | <link rel="stylesheet" href="llvm.css" type="text/css"> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 7 | </head> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 8 | <body> |
| 9 | |
| 10 | <div class="doc_title"> |
| 11 | LLVM Test Suite Guide |
| 12 | </div> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 13 | |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 14 | <ol> |
| 15 | <li><a href="#overview">Overview</a></li> |
| 16 | <li><a href="#Requirements">Requirements</a></li> |
| 17 | <li><a href="#quick">Quick Start</a></li> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 18 | <li><a href="#org">LLVM Test Suite Organization</a> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 19 | <ul> |
| 20 | <li><a href="#codefragments">Code Fragments</a></li> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 21 | <li><a href="#wholeprograms">Whole Programs</a></li> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 22 | </ul></li> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 23 | <li><a href="#tree">LLVM Test Suite Tree</a></li> |
| 24 | <li><a href="#qmstructure">QMTest Structure</a></li> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 25 | <li><a href="#progstructure"><tt>llvm-test</tt> Structure</a></li> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 26 | <li><a href="#run">Running the LLVM Tests</a></li> |
Chris Lattner | fd9d1b3 | 2004-06-24 20:53:09 +0000 | [diff] [blame] | 27 | <li><a href="#nightly">Running the nightly tester</a></li> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 28 | </ol> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 29 | |
Chris Lattner | 7911ce2 | 2004-05-23 21:07:27 +0000 | [diff] [blame] | 30 | <div class="doc_author"> |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 31 | <p>Written by John T. Criswell and <a |
| 32 | href="http://llvm.x10sys.com/rspencer">Reid Spencer</a></p> |
Chris Lattner | 7911ce2 | 2004-05-23 21:07:27 +0000 | [diff] [blame] | 33 | </div> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 34 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 35 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 36 | <div class="doc_section"><a name="overview">Overview</a></div> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 37 | <!--=========================================================================--> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 38 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 39 | <div class="doc_text"> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 40 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 41 | <p>This document is the reference manual for the LLVM test suite. It documents |
| 42 | the structure of the LLVM test suite, the tools needed to use it, and how to add |
| 43 | and run tests.</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 44 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 45 | </div> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 46 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 47 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 48 | <div class="doc_section"><a name="Requirements">Requirements</a></div> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 49 | <!--=========================================================================--> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 50 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 51 | <div class="doc_text"> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 52 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 53 | <p>In order to use the LLVM test suite, you will need all of the software |
| 54 | required to build LLVM, plus the following:</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 55 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 56 | <dl> |
Reid Spencer | 376d7ac | 2004-11-01 08:26:25 +0000 | [diff] [blame^] | 57 | <dt><a href="http://www.qmtest.com">QMTest</a></dt> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 58 | <dd>The LLVM test suite uses QMTest to organize and run tests. <b>Note: |
| 59 | you will need <a href="http://llvm.cs.uiuc.edu/qm-2.0.3.tar.gz">QMTest |
| 60 | 2.0.3 (source tar.gz file)</a> to be successful. The tests do not run with |
| 61 | any other version.</b></dd> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 62 | |
Reid Spencer | 376d7ac | 2004-11-01 08:26:25 +0000 | [diff] [blame^] | 63 | <dt><a href="http://www.python.org">Python</a></dt> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 64 | <dd>You will need a Python interpreter that works with QMTest. Python will |
| 65 | need zlib and SAX support enabled.</dd> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 66 | </dl> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 67 | |
Reid Spencer | 376d7ac | 2004-11-01 08:26:25 +0000 | [diff] [blame^] | 68 | <dt><a href="http://www.netlib.org/f2c">F2C</a></dt> |
Misha Brukman | 0adfeed | 2004-10-08 00:55:43 +0000 | [diff] [blame] | 69 | <dd>For now, LLVM does not have a Fortran front-end, but using F2C, we can run |
| 70 | Fortran benchmarks. F2C support must be enabled via <tt>configure</tt> if not |
| 71 | installed in a standard place. F2C requires three items: the <tt>f2c</tt> |
| 72 | executable, <tt>f2c.h</tt> to compile the generated code, and <tt>libf2c.a</tt> |
| 73 | to link generated code. By default, given an F2C directory <tt>$DIR</tt>, the |
| 74 | configure script will search <tt>$DIR/bin</tt> for <tt>f2c</tt>, |
| 75 | <tt>$DIR/include</tt> for <tt>f2c.h</tt>, and <tt>$DIR/lib</tt> for |
| 76 | <tt>libf2c.a</tt>. The default <tt>$DIR</tt> values are: <tt>/usr</tt>, |
| 77 | <tt>/usr/local</tt>, <tt>/sw</tt>, and <tt>/opt</tt>. If you installed F2C in a |
| 78 | different location, you must tell <tt>configure</tt>: |
| 79 | |
| 80 | <ul> |
| 81 | <li><tt>./configure --with-f2c=$DIR</tt><br> |
| 82 | This will specify a new <tt>$DIR</tt> for the above-described search |
| 83 | process. This will only work if the binary, header, and library are in their |
| 84 | respective subdirectories of <tt>$DIR</tt>.</li> |
| 85 | |
| 86 | <li><tt>./configure --with-f2c-bin=/binary/path --with-f2c-inc=/include/path |
| 87 | --with-f2c-lib=/lib/path</tt><br> |
| 88 | This allows you to specify the F2C components separately. Note: if you choose |
| 89 | this route, you MUST specify all three components, and you need to only specify |
| 90 | <em>directories</em> where the files are located; do NOT include the |
| 91 | filenames themselves on the <tt>configure</tt> line.</li> |
| 92 | </ul></dd> |
| 93 | </dl> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 94 | </div> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 95 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 96 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 97 | <div class="doc_section"><a name="quick">Quick Start</a></div> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 98 | <!--=========================================================================--> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 99 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 100 | <div class="doc_text"> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 101 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 102 | <p>The tests are located in two separate CVS modules. The basic feature and |
| 103 | regression tests are in the main "llvm" module under the directory |
| 104 | <tt>llvm/test</tt>. A more comprehensive test suite that includes whole |
| 105 | programs in C and C++ is in the <tt>llvm-test</tt> module. This module should |
| 106 | be checked out to the <tt>llvm/projects</tt> directory. When you |
| 107 | <tt>configure</tt> the <tt>llvm</tt> module, the <tt>llvm-test</tt> module |
| 108 | will be automatically configured. Or you can do it manually.</p> |
| 109 | <p>To run all of the simple tests in LLVM, use the master Makefile in the |
| 110 | <tt>llvm/test</tt> directory:</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 111 | <pre> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 112 | % gmake -C llvm/test |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 113 | </pre> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 114 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 115 | <p>To run only the code fragment tests (i.e. those that do basic testing of |
| 116 | LLVM), run the tests organized by QMTest:</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 117 | <pre> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 118 | % gmake -C llvm/test qmtest |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 119 | </pre> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 120 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 121 | <p>To run only the basic feature tests, QMTest supports the following |
| 122 | target:</p> |
| 123 | <pre> |
| 124 | % gmake -C llvm/test Feature.t |
| 125 | </pre> |
| 126 | |
| 127 | <p>To run only the regression tests, QMTest supports the following |
| 128 | target:</p> |
| 129 | <pre> |
| 130 | % gmake -C llvm/test Regression.t |
| 131 | </pre> |
| 132 | |
| 133 | <p>To run the comprehensive test suite (tests that compile and execute whole |
| 134 | programs), run the <tt>llvm-test</tt> tests:</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 135 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 136 | <pre> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 137 | % cd llvm/projects |
| 138 | % cvs co llvm-test |
| 139 | % cd llvm-test |
| 140 | % ./configure --with-llvmsrc=$LLVM_SRC_ROOT --with-llvmobj=$LLVM_OBJ_ROOT |
| 141 | % gmake |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 142 | </pre> |
| 143 | |
| 144 | </div> |
| 145 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 146 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 147 | <div class="doc_section"><a name="org">LLVM Test Suite Organization</a></div> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 148 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 149 | |
| 150 | <div class="doc_text"> |
| 151 | |
| 152 | <p>The LLVM test suite contains two major categories of tests: code |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 153 | fragments and whole programs. Code fragments are in the <tt>llvm</tt> module |
| 154 | under the directory under the <tt>llvm/test</tt> directory. The whole programs |
| 155 | test suite are n the <tt>llvm-test</tt> module under the main directory.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 156 | |
| 157 | </div> |
| 158 | |
| 159 | <div class="doc_subsection"><a name="codefragments">Code Fragments</a> |
| 160 | </div> |
| 161 | |
| 162 | <div class="doc_text"> |
| 163 | |
| 164 | <p>Code fragments are small pieces of code that test a specific feature of LLVM |
| 165 | or trigger a specific bug in LLVM. They are usually written in LLVM assembly |
| 166 | language, but can be written in other languages if the test targets a particular |
| 167 | language front end.</p> |
| 168 | |
| 169 | <p>Code fragments are not complete programs, and they are never executed to |
| 170 | determine correct behavior.</p> |
| 171 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 172 | <p>Thes code fragment tests are located in the <tt>llvm/test/Features</tt> and |
| 173 | <tt>llvm/test/Regression</tt> directories.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 174 | |
| 175 | </div> |
| 176 | |
| 177 | <div class="doc_subsection"><a name="wholeprograms">Whole Programs</a></div> |
| 178 | |
| 179 | <div class="doc_text"> |
| 180 | |
| 181 | <p>Whole Programs are pieces of code which can be compiled and linked into a |
| 182 | stand-alone program that can be executed. These programs are generally written |
| 183 | in high level languages such as C or C++, but sometimes they are written |
| 184 | straight in LLVM assembly.</p> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 185 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 186 | <p>These programs are compiled and then executed using several different |
| 187 | methods (native compiler, LLVM C backend, LLVM JIT, LLVM native code generation, |
| 188 | etc). The output of these programs is compared to ensure that LLVM is compiling |
| 189 | the program correctly.</p> |
| 190 | |
| 191 | <p>In addition to compiling and executing programs, whole program tests serve as |
| 192 | a way of benchmarking LLVM performance, both in terms of the efficiency of the |
| 193 | programs generated as well as the speed with which LLVM compiles, optimizes, and |
| 194 | generates code.</p> |
| 195 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 196 | <p>All "whole program" tests are located in the <tt>llvm-test</tt> CVS |
| 197 | module.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 198 | |
| 199 | </div> |
| 200 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 201 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 202 | <div class="doc_section"><a name="tree">LLVM Test Suite Tree</a></div> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 203 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 204 | |
| 205 | <div class="doc_text"> |
| 206 | |
| 207 | <p>Each type of test in the LLVM test suite has its own directory. The major |
| 208 | subtrees of the test suite directory tree are as follows:</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 209 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 210 | <ul> |
| 211 | <li><tt>llvm/test/Features</tt> |
| 212 | <p>This directory contains sample codes that test various features of the |
| 213 | LLVM language. These pieces of sample code are run through various |
| 214 | assembler, disassembler, and optimizer passes.</p> |
| 215 | </li> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 216 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 217 | <li><tt>llvm/test/Regression</tt> |
| 218 | <p>This directory contains regression tests for LLVM. When a bug is found |
| 219 | in LLVM, a regression test containing just enough code to reproduce the |
| 220 | problem should be written and placed somewhere underneath this directory. |
| 221 | In most cases, this will be a small piece of LLVM assembly language code, |
| 222 | often distilled from an actual application or benchmark.</p> |
| 223 | </li> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 224 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 225 | <li><tt>llvm-test</tt> |
| 226 | <p>The <tt>llvm-test</tt> CVS module contains programs that can be compiled |
| 227 | with LLVM and executed. These programs are compiled using the native compiler |
| 228 | and various LLVM backends. The output from the program compiled with the |
| 229 | native compiler is assumed correct; the results from the other programs are |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 230 | compared to the native program output and pass if they match.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 231 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 232 | <p>In addition for testing correctness, the <tt>llvm-test</tt> directory also |
| 233 | performs timing tests of various LLVM optimizations. It also records |
| 234 | compilation times for the compilers and the JIT. This information can be |
| 235 | used to compare the effectiveness of LLVM's optimizations and code |
| 236 | generation.</p></li> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 237 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 238 | <li><tt>llvm-test/SingleSource</tt> |
| 239 | <p>The SingleSource directory contains test programs that are only a single |
| 240 | source file in size. These are usually small benchmark programs or small |
| 241 | programs that calculate a particular value. Several such programs are grouped |
| 242 | together in each directory.</p></li> |
| 243 | |
| 244 | <li><tt>llvm-test/MultiSource</tt> |
| 245 | <p>The MultiSource directory contains subdirectories which contain entire |
| 246 | programs with multiple source files. Large benchmarks and whole applications |
| 247 | go here.</p></li> |
| 248 | |
| 249 | <li><tt>llvm-test/External</tt> |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 250 | <p>The External directory contains Makefiles for building code that is external |
| 251 | to (i.e., not distributed with) LLVM. The most prominent members of this |
| 252 | directory are the SPEC 95 and SPEC 2000 benchmark suites. The presence and |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 253 | location of these external programs is configured by the llvm-test |
| 254 | <tt>configure</tt> script.</p></li> |
| 255 | |
| 256 | <li><tt>llvm/test/QMTest</tt> |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 257 | <p>This directory contains the QMTest information files. Inside this directory |
| 258 | are QMTest administration files and the Python code that implements the LLVM |
| 259 | test and database classes.</p></li> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 260 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 261 | </ul> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 262 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 263 | </div> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 264 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 265 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 266 | <div class="doc_section"><a name="qmstructure">QMTest Structure</a></div> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 267 | <!--=========================================================================--> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 268 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 269 | <div class="doc_text"> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 270 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 271 | <p>The LLVM test suite is partially driven by QMTest and partially driven by GNU |
| 272 | Make. Specifically, the Features and Regression tests are all driven by QMTest. |
| 273 | The <tt>llvm-test</tt> module is currently driven by a set of Makefiles.</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 274 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 275 | <p>The QMTest system needs to have several pieces of information available; |
| 276 | these pieces of configuration information are known collectively as the |
| 277 | "context" in QMTest parlance. Since the context for LLVM is relatively large, |
| 278 | the master Makefile in llvm/test sets it for you.</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 279 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 280 | <p>The LLVM database class makes the subdirectories of llvm/test a QMTest test |
| 281 | database. For each directory that contains tests driven by QMTest, it knows |
| 282 | what type of test the source file is and how to run it.</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 283 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 284 | <p>Hence, the QMTest namespace is essentially what you see in the Feature and |
| 285 | Regression directories, but there is some magic that the database class performs |
| 286 | (as described below).</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 287 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 288 | <p>The QMTest namespace is currently composed of the following tests and test |
| 289 | suites:</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 290 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 291 | <ul> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 292 | <li>Feature |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 293 | |
| 294 | <p>These are the feature tests found in the Feature directory. |
| 295 | They are broken up into the following categories:</p> |
| 296 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 297 | <ul> |
| 298 | <li>ad |
| 299 | <p>Assembler/Disassembler tests. These tests verify that a piece of LLVM |
| 300 | assembly language can be assembled into bytecode and then disassembled |
| 301 | into the original assembly language code. It does this several times to |
| 302 | ensure that assembled output can be disassembled and disassembler output |
| 303 | can be assembled. It also verifies that the give assembly language file |
| 304 | can be assembled correctly.</p></li> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 305 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 306 | <li>opt |
| 307 | <p>Optimizer tests. These tests verify that two of the optimizer passes |
| 308 | completely optimize a program (i.e. after a single pass, they cannot |
| 309 | optimize a program any further).</p></li> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 310 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 311 | <li>mc |
| 312 | <p> Machine code tests. These tests verify that the LLVM assembly |
| 313 | language file can be translated into native assembly code.</p></li> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 314 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 315 | <li>cc |
| 316 | <p>C code tests. These tests verify that the specified LLVM assembly |
| 317 | code can be converted into C source code using the C backend.</p></li> |
| 318 | </ul> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 319 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 320 | <p>The LLVM database class looks at every file in the Feature directory and |
| 321 | creates a fake test hierarchy containing |
| 322 | <tt>Feature.<testtype>.<testname></tt>. So, if you add an LLVM |
| 323 | assembly language file to the Feature directory, it actually creates 5 new |
| 324 | tests: assembler/disassembler, assembler, optimizer, machine code, and C code. |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 325 | </p></li> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 326 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 327 | <li>Regression |
| 328 | <p>These are the regression tests. There is one suite for each |
| 329 | subdirectory of the Regression directory. If you add a new subdirectory |
| 330 | there, you will need to modify, at least, the <tt>RegressionMap</tt> |
| 331 | variable in <tt>QMTest/llvmdb.py</tt> so that QMTest knows how to run the |
| 332 | tests in the new subdirectory.</p> |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 333 | </li> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 334 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 335 | </ul> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 336 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 337 | </div> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 338 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 339 | <!--=========================================================================--> |
| 340 | <div class="doc_section"><a name="progstructure"><tt>llvm-test</tt> |
| 341 | Structure</a></div> |
| 342 | <!--=========================================================================--> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 343 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 344 | <div class="doc_text"> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 345 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 346 | <p>As mentioned previously, the <tt>llvm-test</tt> module provides three types |
| 347 | of tests: MultiSource, SingleSource, and External. Each tree is then subdivided |
| 348 | into several categories, including applications, benchmarks, regression tests, |
| 349 | code that is strange grammatically, etc. These organizations should be |
| 350 | relatively self explanatory.</p> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 351 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 352 | <p>In addition to the regular "whole program" tests, the <tt>llvm-test</tt> |
| 353 | module also provides a mechanism for compiling the programs in different ways. |
| 354 | If the variable TEST is defined on the gmake command line, the test system will |
| 355 | include a Makefile named <tt>TEST.<value of TEST variable>.Makefile</tt>. |
| 356 | This Makefile can modify build rules to yield different results.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 357 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 358 | <p>For example, the LLVM nightly tester uses <tt>TEST.nightly.Makefile</tt> to |
| 359 | create the nightly test reports. To run the nightly tests, run <tt>gmake |
| 360 | TEST=nightly</tt>.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 361 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 362 | <p>There are several TEST Makefiles available in the tree. Some of them are |
| 363 | designed for internal LLVM research and will not work outside of the LLVM |
| 364 | research group. They may still be valuable, however, as a guide to writing your |
| 365 | own TEST Makefile for any optimization or analysis passes that you develop with |
| 366 | LLVM.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 367 | |
| 368 | </div> |
| 369 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 370 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 371 | <div class="doc_section"><a name="run">Running the LLVM Tests</a></div> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 372 | <!--=========================================================================--> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 373 | |
| 374 | <div class="doc_text"> |
| 375 | |
| 376 | <p>First, all tests are executed within the LLVM object directory tree. They |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 377 | <i>are not</i> executed inside of the LLVM source tree. This is because the |
| 378 | test suite creates temporary files during execution.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 379 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 380 | <p>The master Makefile in llvm/test is capable of running only the QMTest driven |
| 381 | tests. By default, it will run all of these tests.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 382 | |
| 383 | <p>To run only the QMTest driven tests, run <tt>gmake qmtest</tt> at the |
| 384 | command line in llvm/tests. To run a specific qmtest, suffix the test name with |
| 385 | ".t" when running gmake.</p> |
| 386 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 387 | <p>For example, to run the Regression.LLC tests, type |
| 388 | <tt>gmake Regression.LLC.t</tt> in <tt>llvm/tests</tt>.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 389 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 390 | <p>Note that there are no Makefiles in <tt>llvm/test/Features</tt> and |
| 391 | <tt>llvm/test/Regression</tt>. You must use QMTest from the <tt>llvm/test</tt> |
| 392 | directory to run them.</p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 393 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 394 | <p>To run the <tt>llvm-test</tt> suite, you need to use the following steps: |
| 395 | </p> |
| 396 | <ol> |
| 397 | <li>cd into the llvm/projects directory</li> |
| 398 | <li>check out the <tt>llvm-test</tt> module with:<br/> |
| 399 | <tt>cvs -d :pserver:anon@llvm.cs.uiuc.edu:/var/cvs/llvm co -PR llvm-test</tt><br> |
| 400 | This will get the test suite into <tt>llvm/projects/llvm-test</tt></li> |
| 401 | <li>configure the test suite. You can do this one of two ways: |
| 402 | <ol> |
| 403 | <li>Use the regular llvm configure:<br/> |
| 404 | <tt>cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure</tt><br/> |
| 405 | This will ensure that the <tt>projects/llvm-test</tt> directory is also |
| 406 | properly configured.</li> |
| 407 | <li>Use the <tt>configure</tt> script found in the <tt>llvm-test</tt> source |
| 408 | directory:<br/> |
| 409 | <tt>$BUILD_SRC_DIR/configure --with-llvmsrc=$LLVM_SRC_ROOT --with-llvmobj=$LLVM_OBJ_ROOT</tt> |
| 410 | </li> |
| 411 | </ol> |
| 412 | <li>gmake</li> |
| 413 | </ol> |
| 414 | <p>Note that the second and third steps only need to be done once. After you |
| 415 | have the suite checked out and configured, you don't need to do it again (unless |
| 416 | the test code or configure script changes).</p> |
| 417 | |
| 418 | <p>To make a specialized test (use one of the |
| 419 | <tt>llvm-test/TEST.<type>.Makefile</tt>s), just run:<br/> |
| 420 | <tt>gmake TEST=<type> test</tt><br/>For example, you could run the |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 421 | nightly tester tests using the following commands:</p> |
| 422 | |
| 423 | <pre> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 424 | % cd llvm/projects/llvm-test |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 425 | % gmake TEST=nightly test |
| 426 | </pre> |
| 427 | |
| 428 | <p>Regardless of which test you're running, the results are printed on standard |
| 429 | output and standard error. You can redirect these results to a file if you |
| 430 | choose.</p> |
| 431 | |
| 432 | <p>Some tests are known to fail. Some are bugs that we have not fixed yet; |
| 433 | others are features that we haven't added yet (or may never add). In QMTest, |
| 434 | the result for such tests will be XFAIL (eXpected FAILure). In this way, you |
| 435 | can tell the difference between an expected and unexpected failure.</p> |
| 436 | |
Misha Brukman | 0904f09 | 2004-10-08 00:41:27 +0000 | [diff] [blame] | 437 | <p>The tests in <tt>llvm-test</tt> have no such feature as of this time. If the |
| 438 | test passes, only warnings and other miscellaneous output will be generated. If |
| 439 | a test fails, a large <program> FAILED message will be displayed. This |
| 440 | will help you separate benign warnings from actual test failures.</p> |
Chris Lattner | fd9d1b3 | 2004-06-24 20:53:09 +0000 | [diff] [blame] | 441 | |
| 442 | </div> |
| 443 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 444 | <!--=========================================================================--> |
Chris Lattner | fd9d1b3 | 2004-06-24 20:53:09 +0000 | [diff] [blame] | 445 | <div class="doc_section"><a name="nightly">Running the nightly tester</a></div> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 446 | <!--=========================================================================--> |
Chris Lattner | fd9d1b3 | 2004-06-24 20:53:09 +0000 | [diff] [blame] | 447 | |
| 448 | <div class="doc_text"> |
| 449 | |
| 450 | <p> |
| 451 | The <a href="http://llvm.cs.uiuc.edu/testresults/">LLVM Nightly Testers</a> |
| 452 | automatically check out an LLVM tree, build it, run the "nightly" |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 453 | program test (described above), run all of the feature and regression tests, |
| 454 | and then delete the checked out tree. This tester is designed to ensure that |
Chris Lattner | fd9d1b3 | 2004-06-24 20:53:09 +0000 | [diff] [blame] | 455 | programs don't break as well as keep track of LLVM's progress over time.</p> |
| 456 | |
| 457 | <p> |
| 458 | If you'd like to set up an instance of the nightly tester to run on your |
| 459 | machine, take a look at the comments at the top of the utils/NightlyTester.pl |
| 460 | file. We usually run it from a crontab entry that looks ilke this: |
| 461 | </p> |
| 462 | |
| 463 | <pre> |
| 464 | 5 3 * * * LLVM_LIB_SEARCH_PATH=.../llvm-gcc/bytecode-libs $HOME/llvm/utils/NightlyTest.pl -parallel -enable-linscan ...CVSREPOSTRING... $HOME/buildtest-X86 $HOME/cvs/testresults-X86 |
| 465 | </pre> |
| 466 | |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 467 | <p>Or, you can create a shell script to encapsulate the running of the script. |
| 468 | The optimized x86 Linux nightly test is run from just such a script: |
| 469 | <pre> |
| 470 | #!/bin/bash |
| 471 | BASE=/proj/work/llvm/nightlytest |
| 472 | export CVSROOT=:pserver:anon@llvm.cs.uiuc.edu:/var/cvs/llvm |
| 473 | export BUILDDIR=$BASE/build |
| 474 | export WEBDIR=$BASE/testresults |
| 475 | export LLVMGCCDIR=/proj/work/llvm/cfrontend/install |
| 476 | export PATH=/proj/install/bin:$LLVMGCCDIR/bin:$PATH |
| 477 | export LD_LIBRARY_PATH=/proj/install/lib |
| 478 | export LLVM_LIB_SEARCH_PATH=/proj/work/llvm/cfrontend/install/bytecode-libs |
| 479 | cd $BASE |
| 480 | cp /proj/work/llvm/llvm/utils/NightlyTest.pl . |
| 481 | nice ./NightlyTest.pl -nice -release -verbose -parallel -enable-linscan -noexternals |
| 482 | </pre> |
| 483 | |
Chris Lattner | fd9d1b3 | 2004-06-24 20:53:09 +0000 | [diff] [blame] | 484 | <p> |
| 485 | Take a look at the NightlyTest.pl file to see what all of the flags and |
| 486 | strings do. If you start running the nightly tests, please let us know and |
| 487 | we'll link your page to the global tester page. Thanks! |
| 488 | </p> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 489 | |
| 490 | </div> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 491 | |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 492 | <!-- *********************************************************************** --> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 493 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 494 | <hr> |
| 495 | <address> |
| 496 | <a href="http://jigsaw.w3.org/css-validator/check/referer"><img |
| 497 | src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> |
| 498 | <a href="http://validator.w3.org/check/referer"><img |
| 499 | src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 500 | |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 501 | John T. Criswell<br> |
Reid Spencer | 8284f1f | 2004-09-05 20:07:26 +0000 | [diff] [blame] | 502 | <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br/> |
Misha Brukman | 1d83e11 | 2004-03-01 18:21:04 +0000 | [diff] [blame] | 503 | Last modified: $Date$ |
| 504 | </address> |
Brian Gaeke | af19f2e | 2003-10-23 18:10:28 +0000 | [diff] [blame] | 505 | </body> |
John Criswell | 020cbd8 | 2003-10-10 18:42:49 +0000 | [diff] [blame] | 506 | </html> |