Building test-suite and running it under Qemu

From Dmz-portal

Jump to: navigation, search

The steps are:

1) Check out the llvm test-suite into it's own directory.
For this example we assume that it has been checkout out into ~/llvm-test-suite

export RUN_TS_TEST_SUITE=~/llvm-test-suite

2) Get access to an installed llvm compiler. For this example we assume that the binaries for the installed area are in ~/llvm/install/bin

export RUN_TS_LLVM_BIN=~/llvm/install/bin

3) Create a build directory for test-suite.

export RUN_TS_BUILD=~/build-test-suite
mkdir $RUN_TS_BUILD

4) Run configure in the build directory.

cd $RUN_TS_BUILD
$RUN_TS_TEST_SUITE/configure --without-llvmsrc --without-llvmobj --with-externals=/dev/null

5) Build the tools for llvm-suite.
(This make line is overkill. It was copied mostly from an lnt invocation).

make tools TARGET_LLVMGCC=$RUN_TS_LLVM_BIN/clang TARGET_CXX=None LLI_OPTFLAGS=-O3 TARGET_CC=None TARGET_LLVMGXX=$RUN_TS_LLVM_BIN/clang++ CC_UNDER_TEST_IS_CLANG=1 TEST=simple USE_REFERENCE_OUTPUT=1 OPTFLAGS=-O3 LLC_OPTFLAGS=-O3 ENABLE_OPTIMIZED=1 ENABLE_HASHED_PROGRAM_OUTPUT=1 DISABLE_JIT=1

6) Get a gcc toolchain supported by the Mips llvm compiler (currently Mentor is the only one). We assume here that the free lite version has been downloaded from Mentor and installed at
Lets assume it is installed at ~/CodeSourcery/Sourcery_G++ (the top level directory should have mips-linux-gnu and UINSTALL - just to make sure you have the right place). ( https://sourcery.mentor.com/GNUToolchain/ )

export RUN_TS_GCC_TOOLCHAIN=~/CodeSourcery/Sourcery_CodeBench_Lite_for_MIPS_GNU_Linux

7) Get Qemu from open source or from Mentor Graphics. For these instructions I have built it from open source and installed it at ~/qemu-1.4.1. export RUN_TS_QEMU_BIN=~/qemu-1.4.1/bin

8) Create a rununder script. You need a script which is a wrapper that is used to run a given program. Make sure you use chmod to give the script execute access. Assume the following file in ~/qemuusersample.sh.
export RUN_TS_RUNUNDER=~/qemuusersample.sh

The file contains the single line:

/home/rkotler/qemu-1.4.1/bin/qemu-mipsel -L /home/rkotler/CodeSourcery/Sourcery_CodeBench_Lite_for_MIPS_GNU_Linux/mips-linux-gnu/libc/el $@

You can create this file on the fly too using the above variables.


chmod +x $RUN_TS_RUNUNDER

9) For Mips ymake clean ARCH=Mips MIPSARCH=mips16 you need to do the appropriate make clean. MIPSARCH is the flavor, i.e. mips16, mips32,....

10) Run the test suite. In this example run a subset. set RUN_TS_TEST for the particular test you want to run. For this example:

export RUN_TS_TEST=simple
If you wish to run a subset you can set RUN_TS_START. For this example:

export RUN_TS_START="-C SingleSource/UnitTests/Mips" (This runs some Mips specific tests which as of 6/8/13 have not been checked in but the patch will be submitted soon).

Remove the "-C" "SingleSource/UnitTests/Mips" to run the whole suite. Change TEST= to run a different test .

This example uses -mips16 and -fPIC. Those should be changed if you do not need them or want different options.

make -k TARGET_LLVMGCC=$RUN_TS_LLVM_BIN/clang TARGET_CXX=None LLI_OPTFLAGS=-O3 TARGET_CC=None TARGET_LLVMGXX=$RUN_TS_LLVM_BIN/clang++ RUNUNDER=$RUN_TS_RUNUNDER CC_UNDER_TEST_IS_CLANG=1 TEST=$RUN_TS_TEST "TARGET_FLAGS=-target mipsel-linux-gnu -mips16 -gcc-toolchain $RUN_TS_GCC_TOOLCHAIN -fPIC" USE_REFERENCE_OUTPUT=1 OPTFLAGS=-O3 MIPSARCH=mips16 LLC_OPTFLAGS=-O3 ENABLE_OPTIMIZED=1 ARCH=Mips ENABLE_HASHED_PROGRAM_OUTPUT=1 DISABLE_JIT=1 $RUN_TS_START -j 1 report report.simple.csv TEST=simple


To summarize this example:
Defines:

export RUN_TS_TEST_SUITE=~/llvm-test-suite
export RUN_TS_LLVM_BIN=~/llvm/install/bin
export RUN_TS_BUILD=~/build-test-suite
export RUN_TS_GCC_TOOLCHAIN=~/CodeSourcery/Sourcery_CodeBench_Lite_for_MIPS_GNU_Linux
export RUN_TS_START="-C SingleSource/UnitTests/Mips"
export RUN_TS_RUNUNDER=~/qemuusersample.sh

Configure

$RUN_TS_TEST_SUITE/configure --without-llvmsrc --without-llvmobj --with-externals=/dev/null
Build tools

make tools TARGET_LLVMGCC=$RUN_TS_LLVM_BIN/clang TARGET_CXX=None LLI_OPTFLAGS=-O3 TARGET_CC=None TARGET_LLVMGXX=$RUN_TS_LLVM_BIN/clang++ CC_UNDER_TEST_IS_CLANG=1 TEST=simple USE_REFERENCE_OUTPUT=1 OPTFLAGS=-O3 LLC_OPTFLAGS=-O3 ENABLE_OPTIMIZED=1 ENABLE_HASHED_PROGRAM_OUTPUT=1 DISABLE_JIT=1
Run tests

make -k TARGET_LLVMGCC=$RUN_TS_LLVM_BIN/clang TARGET_CXX=None LLI_OPTFLAGS=-O3 TARGET_CC=None TARGET_LLVMGXX=$RUN_TS_LLVM_BIN/clang++ RUNUNDER=$RUN_TS_RUNUNDER CC_UNDER_TEST_IS_CLANG=1 TEST=$RUN_TS_TEST "TARGET_FLAGS=-target mipsel-linux-gnu -mips16 -gcc-toolchain $RUN_TS_GCC_TOOLCHAIN -fPIC" USE_REFERENCE_OUTPUT=1 OPTFLAGS=-O3 MIPSARCH=mips16 LLC_OPTFLAGS=-O3 ENABLE_OPTIMIZED=1 ARCH=Mips ENABLE_HASHED_PROGRAM_OUTPUT=1 DISABLE_JIT=1 $RUN_TS_START -j 1 report report.simple.csv TEST=simple

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox