Template-based JUnit test cases


This instruction is suitable for those developers of MicroTESK for RISC-V project who want to run project's JUnit test cases on their own machines. The instruction is applicable for Linux-based OS only. All the package names that are mentioned here are correct for Ubuntu-based distros and may be different in other OS. For JUnit tests running you should have an access to Nexus Repository Manager server at ISP RAS network. Ask system administrator of ISP Nexus for login and password and store them at the _REPO_USER and _REPO_PASSWORD system variables respectively.


The MicroTESK for RISC-V project contains a collection of JUnit test cases. Most of them consist of the following steps:
  • Assembler test program and MicroTESK simulator log generation from the Ruby test template and RISC-V ISA nML specifications;
  • Test program compilation into binary image;
  • Test program binary image simulation on QEMU4V (simulation log file is produced);
  • Test program binary image simulation on Spike (simulation log file is produced);
  • MicroTESK and QEMU4V log comparison by Trace Matcher tool.

For all the steps of JUnit test cases to be accomplished, several auxiliary tools should be installed. For complete guide read all the chapters below.

Toolchain installation

For RISC-V assembler test program compilation we use GNU toolchain for RISC-V. Get the toolchain's source code and switch to "rvv-0.7.1" branch:

$ git clone --recursive
$ cd riscv-gnu-toolchain
$ git checkout -b rvv-0.7.1 origin/rvv-0.7.1
$ git submodule update --init --recursive

To complete the installation follow the instruction.

Simulator installation

For RISC-V test programs validation we use both QEMU4V and Spike simulators. QEMU4V is downloaded by project's scripts in a binary form, so there is no need to install it. However, libjpeg62 package should be installed in your system for QEMU4V binary running.
For Spike installation follow the instruction. Note, that Spike must be installed in the same directory the toolchain has been installed (for example, "/opt/riscv").


The following packages should be installed in your OS: expect.

Test cases running

To run JUnit test cases enter the project directory and execute the following command:

$ ./gradlew clean test

Updated by Sergey Smolov over 4 years ago · 7 revisions