Skip to content

unitTests

pwehrle edited this page Jul 8, 2014 · 1 revision

Framework

The unit tests are written using the framework JUnit for java and GTest for C/C++.

Requirements

  • On debian/ubuntu, you first need to install some packages: open-iscsi (iSCSI initiator), open-iscsi-utils, nbd-client (NBD client).

  • Some client tests for iSCSI and NBD use Linux commands like fdisk, mount, iscsiadm (iSCSI client administration for Linux) which are executed using the 'sudo' command. For these tests to run without password prompts, the following commands should be callable via sudo without a password:

    • mount/umount
    • rm
    • iscsiadm
    • nbd-client
    • fdisk
    • mkfs
    • sync
    • cmp
    • cp
    • touch
    • killall
  • For NBD tests, you need to have a kernel >=3.7 to test the command 'flush'.

Long tests

By default, test classes ending in 'L' are considered 'long' unit tests or testing some secondary functionality. These tests are ignored during a simple build:

mvn install

It is possible to launch a single 'long' test by setting the property 'test':

Example for ibs-java:

mvn -Dtest=TestIbsPutGetL test

The module java-full builds and executes all tests, including 'long' ones. To launch the build, go in the directory main/java/full and run:

mvn clean install

Skipping tests

For the first build or to obtain an assembly quicker, tests can be skipped by adding the following parameters:

mvn -DskipTests -DskipNarTests -DskipNarJniTests -PskipNarTestsCompile install
Clone this wiki locally