Add support for multiprocessing for the tests.

This commit is contained in:
Tom Alexander 2023-04-19 16:35:26 -04:00
parent 2a04455955
commit 7c64be3f51
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -4,6 +4,12 @@ SHELL := bash
.DELETE_ON_ERROR: .DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-builtin-rules
TESTJOBS := 4
OS:=$(shell uname -s)
ifeq ($(OS),Linux)
TESTJOBS:=$(shell nproc)
endif
ifeq ($(origin .RECIPEPREFIX), undefined) ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later) $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
@ -24,15 +30,15 @@ clean:
.PHONY: test .PHONY: test
test: test:
> cargo test --lib --test test_loader > cargo test --lib --test test_loader -- --test-threads $(TESTJOBS)
.PHONY: integrationtest .PHONY: integrationtest
integrationtest: integrationtest:
> cargo test --no-fail-fast --test test_loader > cargo test --no-fail-fast --test test_loader -- --test-threads $(TESTJOBS)
.PHONY: unittest .PHONY: unittest
unittest: unittest:
> cargo test --lib > cargo test --lib -- --test-threads $(TESTJOBS)
.PHONY: run .PHONY: run
run: run: