Skip to content

ripple-mq/benchmark

Repository files navigation

benchmark

Initial Setup

This section is intended to help developers and contributors get a working copy of benchmark on their end

1. Clone this repository
git clone https://github.com/ripple.mq/benchmark
cd benchmark
2. Install `golangci-lint`

Install golangci-lint from the official website for your OS


Local Development

This section will guide you to setup a fully-functional local copy of benchmark on your end and teach you how to use it! Make sure you have installed golangci-lint before following this section!

Note: This section relies on the usage of Makefile. If you can't (or don't) use Makefile, you can follow along by running the internal commands from benchmark's Makefile (most of which are OS-independent)!

Installing dependencies

To install all dependencies associated with benchmark, run the command

make install

Using Code Formatters

Code formatters format your code to match pre-decided conventions. To run automated code formatters, use the Makefile command

make codestyle

Using Code Linters

Linters are tools that analyze source code for possible errors. This includes typos, code formatting, syntax errors, calls to deprecated functions, potential security vulnerabilities, and more!

To run pre-configured linters, use the command

make lint

Running Tests

Tests in benchmark are classified as fast and slow - depending on how quick they are to execute.

To selectively run tests from either test group, use the Makefile command

make fast-test

OR

make slow-test

Alternatively, to run the complete test-suite -- i.e. fast and slow tests at one go, use the command

make test

Running the Test-Suite

The test-suite is simply a wrapper to run linters, stylecheckers and all tests at once!

To run the test-suite, use the command

make test-suite

In simpler terms, running the test-suite is a combination of running linters and all tests one after the other!

Additional Resources

Makefile help

Tap for a list of Makefile commands
Command Description Prerequisites
help Generate help dialog listing all Makefile commands with description NA
install Fetch project dependencies NA
codestyle Run code-formatters golangci-lint
lint Check codestyle and run linters golangci-lint
test Run all tests NA
fast-tests Selectively run fast tests NA
slow-tests Selectively run slow tests NA
test-suite Check codestyle, run linters and all tests golangci-lint
run Run benchmark NA
docker-gen Create production docker image for benchmark docker
docker-debug Create debug-friendly docker image for benchmark docker
clean-docker Remove docker image generated by docker-gen docker

Optionally, to see a list of all Makefile commands, and a short description of what they do, you can simply run

make

Which is equivalent to;

make help

Both of which will list out all Makefile commands available, and a short description of what they do!

Generating Binaries

To generate binaries for multiple OS/architectures, simply run

bash build-script.sh

The command will generate binaries for Linux, Windows and Mac targetting multiple architectures at once! The binaries, once generated will be stored in the bin directory inside the project directory.

The binaries generated will be named in the format

benchmark_<version>_<target-os>_<architecture>.<extension>

The <extension> is optional. By default, version is an empty string. A custom version can be passed as an argument while running the script. As an example;

bash build-script.sh v1.2.1

An example of the files generated by the previous command will be;

benchmark_v1.2.1_windows_x86_64.exe

Using Docker

To run benchmark in a docker container, read the instructions in docker section.

Running benchmark

To run benchmark, use the command

make run

Additionally, you can pass any additional command-line arguments (if needed) as the argument "q". For example;

make run q="--help"

OR

make run q="--version"


About

benchmark tool for ripple-server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published