Building Guide (test)

From liblfds.org
Jump to navigation Jump to search

Introduction

The test programme is a user-mode command line programme which tests liblfds.

The test programme has a matching build type for every build type of liblfds (i.e. you can build a coverage test to go along with a coverage liblfds). Both static and shared object builds of liblfds are supported.

The test programme knows where liblfds is, and so liblfds does not need to be installed to build test.

Once built, the test programme is run from the command line. Please see Usage Guide (test).

Porting

The abstraction layer for test provides support for threads and obtaining some very basic information about processors in the system (the number of logical cores, and their IDs such that threads can be started on a given logical core).

Directory Structure

└───test                                     : the test programme
    ├───bin                                  : output directory - the test binary ends up here
    ├───build
    │   ├───gcc_and_gnumake                  : GCC and gnumake
    │   ├───sdk_for_windows_7_and_gnumake    : SDK 7 and gnumake
    │   └───visual_studio_professional_2012  : Visual Studio Professional 2012
    ├───obj                                  : temporary directory for object files
    └───src                                  : the C source files

Building

The test programme contains a top-level directory called build.

This directory contains one directory per supported platform, where each such directory contains the files necessary to build for that platform.

Detailed descriptions of how to build for each platform are given below, with one heading per platform.

The resultant executable file will be placed in the top-level directory bin, with the root filename test, where the suffix varies by operating system (absent on Linux, .exe on Windows, etc).

Per-Platform Build Instructions

GCC and gnumake

└───test
    └───build
        └───gcc_and_gnumake
                Makefile

To build, install GCC and gnumake, enter the build directory and type;

make

The following targets are available;

cov    : coverage
dbg    : debug
prof   : profiling
rel    : release
tsan   : thread sanitizer

clean  : what you'd expect

When switching from one target to another, clean must be made. Don't forget to clean and make a new matching liblfds of the same build variant.

Visual Studio Professional 2012

└───test
    └───build
        └───visual_studio_professional_2012
                test.sln
                test.vcxproj
                test.vcxproj.filters
                test.vcxproj.user

To build, install Visual Studio Professional Edition 2012 and then load the test.sln file into MSVC.

The test solution file depends upon the liblfds solution file and builds it as necessary.

As such, where the liblfds solution file is present, we see DLL/LIB configuration variants, rather than just release or debug.

The solution is configured with the following configurations;

  • Debug DLL
  • Release DLL
  • Debug LIB
  • Release LIB

And with the following platforms;

  • Win32 (which is to say, x86)
  • x64

All combinations of these configurations and platforms are supported. It is not necessary to clean between switching builds, and building test will automatically build and link to the correct matching variant of liblfds.

SDK for Windows 7 and gnumake

└───test
    └───build
        └───sdk_for_windows_7_and_gnumake
                makefile

To build, install Windows SDK 7 and gnumake, enter the build directory and type;

make

The following targets are available;

libdbg  : links to static debug libc, debug
librel  : links to static release libc, release

dlldbg  : links to shared debug libc, debug
dllrel  : links to shared release libc, release

clean   : what you'd expect

When switching from one target to another, clean must be made.

See Also