From c374f169fdf79428d258faf59c1cdd800974994d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 5 Jul 2023 22:23:34 +0200 Subject: test: add a 2000-iteration basic repository test --- Dockerfile | 2 +- Makefile | 29 +++++++++++++++++++++++------ test/CMakeLists.txt | 9 ++++++--- test/py/test_repo.py | 7 +++++++ test/pytest.ini | 3 +++ 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ede8ef..2b88063 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN cd -- "$src_dir" && \ "DEFAULT_PORT=$DEFAULT_PORT" \ "INSTALL_PREFIX=$install_dir" && \ ulimit -n 1024 && \ - make test CONFIGURATION="$CONFIGURATION" + make test/docker FROM base diff --git a/Makefile b/Makefile index e5fdbc9..7072726 100644 --- a/Makefile +++ b/Makefile @@ -45,21 +45,38 @@ build: install: build cmake --install '$(call escape,$(cmake_dir))' -.PHONY: test -test: +.PHONY: test/sanity +test/sanity: @echo ----------------------------------------------------------------- - @echo Running tests + @echo Running sanity tests @echo ----------------------------------------------------------------- ctest --test-dir '$(call escape,$(cmake_dir))' \ - --verbose --exclude-regex python_tests_valgrind + --verbose --tests-regex python_tests_sanity .PHONY: test/valgrind test/valgrind: @echo ----------------------------------------------------------------- - @echo Running tests w/ Valgrind + @echo Running sanity tests w/ Valgrind @echo ----------------------------------------------------------------- ctest --test-dir '$(call escape,$(cmake_dir))' \ --verbose --tests-regex python_tests_valgrind +.PHONY: test/stress +test/stress: + @echo ----------------------------------------------------------------- + @echo Running stress tests + @echo ----------------------------------------------------------------- + ctest --test-dir '$(call escape,$(cmake_dir))' \ + --verbose --tests-regex python_tests_stress + +.PHONY: test/docker +test/docker: test/sanity + +.PHONY: test/local +test/local: test/sanity test/stress + +.PHONY: test +test: test/local + .PHONY: test/all -test/all: test test/valgrind +test/all: test/sanity test/stress test/valgrind diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b8a115c..e68ff45 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,9 +16,12 @@ function(add_python_tests name) set_tests_properties("${name}" PROPERTIES TIMEOUT 300) endfunction() -add_python_tests(python_tests - Python3::Interpreter -m pytest ${python_test_args}) +add_python_tests(python_tests_sanity + Python3::Interpreter -m pytest ${python_test_args} -m "not stress") + +add_python_tests(python_tests_stress + Python3::Interpreter -m pytest ${python_test_args} -m "stress") add_python_tests(python_tests_valgrind - Python3::Interpreter -m pytest ${python_test_args} + Python3::Interpreter -m pytest ${python_test_args} -m "not stress" --valgrind-binary "${CMAKE_CURRENT_SOURCE_DIR}/../src/valgrind.sh") diff --git a/test/py/test_repo.py b/test/py/test_repo.py index abc7f18..2c995e1 100644 --- a/test/py/test_repo.py +++ b/test/py/test_repo.py @@ -3,6 +3,8 @@ # For details, see https://github.com/egor-tensin/cimple. # Distributed under the MIT License. +import pytest + from lib.process import LoggingEvent @@ -45,3 +47,8 @@ def test_repo_2(server_and_workers, test_repo, client): def test_repo_10(server_and_workers, test_repo, client): _test_repo_internal(server_and_workers, test_repo, client, 10) + + +@pytest.mark.stress +def test_repo_2000(server_and_workers, test_repo, client): + _test_repo_internal(server_and_workers, test_repo, client, 2000) diff --git a/test/pytest.ini b/test/pytest.ini index cdc0831..766e409 100644 --- a/test/pytest.ini +++ b/test/pytest.ini @@ -3,3 +3,6 @@ log_format = %(asctime)s | %(levelname)s | %(message)s log_date_format = %Y-%m-%d %H:%M:%S log_cli_level = INFO #log_cli = 1 + +markers = + stress: Big tests; don't run them w/ Valgrind or in QEMU -- cgit v1.2.3