Skip to content

Commit bc335d2

Browse files
authored
Add PPC_IGNORE_TEST_TIME_LIMIT environment variable to disable test time limits (#429)
1 parent 519da40 commit bc335d2

File tree

4 files changed

+54
-21
lines changed

4 files changed

+54
-21
lines changed

docs/locale/en/LC_MESSAGES/user_guide/environment_variables.po

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ msgid ""
99
msgstr ""
1010
"Project-Id-Version: Parallel Programming Course \n"
1111
"Report-Msgid-Bugs-To: \n"
12-
"POT-Creation-Date: 2025-05-26 10:22+0200\n"
12+
"POT-Creation-Date: 2025-05-29 19:31+0200\n"
1313
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1414
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1515
"Language: en\n"
@@ -32,20 +32,27 @@ msgstr ""
3232

3333
#: ../../../../docs/user_guide/environment_variables.rst:6
3434
msgid ""
35-
"``PPC_NUM_PROC``: Specifies the number of processes to launch. "
36-
"Default: ``1``"
35+
"``PPC_NUM_PROC``: Specifies the number of processes to launch. Default: "
36+
"``1``"
3737
msgstr ""
3838

3939
#: ../../../../docs/user_guide/environment_variables.rst:9
4040
msgid ""
41-
"``PPC_NUM_THREADS``: Specifies the number of threads to use. Default:"
42-
" ``1``"
41+
"``PPC_NUM_THREADS``: Specifies the number of threads to use. Default: "
42+
"``1``"
4343
msgstr ""
4444

4545
#: ../../../../docs/user_guide/environment_variables.rst:12
4646
msgid ""
47-
"``PPC_ASAN_RUN``: Specifies that application is compiler with "
48-
"sanitizers. Used by ``scripts/run_tests.py`` to skip ``valgrind`` runs. "
49-
"Default: ``0``"
47+
"``PPC_ASAN_RUN``: Specifies that application is compiler with sanitizers."
48+
" Used by ``scripts/run_tests.py`` to skip ``valgrind`` runs. Default: "
49+
"``0``"
50+
msgstr ""
51+
52+
#: ../../../../docs/user_guide/environment_variables.rst:15
53+
msgid ""
54+
"``PPC_IGNORE_TEST_TIME_LIMIT``: Specifies that test time limits are "
55+
"ignored. Used by ``scripts/run_tests.py`` to disable time limit "
56+
"enforcement. Default: ``0``"
5057
msgstr ""
5158

docs/locale/ru/LC_MESSAGES/user_guide/environment_variables.po

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ msgid ""
99
msgstr ""
1010
"Project-Id-Version: Parallel Programming Course \n"
1111
"Report-Msgid-Bugs-To: \n"
12-
"POT-Creation-Date: 2025-05-26 10:22+0200\n"
12+
"POT-Creation-Date: 2025-05-29 19:31+0200\n"
1313
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1414
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1515
"Language: ru\n"
@@ -29,24 +29,44 @@ msgstr "Переменные окружения"
2929
msgid ""
3030
"The following environment variables can be used to configure the "
3131
"project's runtime behavior:"
32-
msgstr "Следующие переменные окружения могут использоваться для настройки поведения программы во время выполнения:"
32+
msgstr ""
33+
"Следующие переменные окружения могут использоваться для настройки "
34+
"поведения программы во время выполнения:"
3335

3436
#: ../../../../docs/user_guide/environment_variables.rst:6
3537
msgid ""
36-
"``PPC_NUM_PROC``: Specifies the number of processes to launch. "
37-
"Default: ``1``"
38-
msgstr "``PPC_NUM_PROC``: задаёт количество запускаемых процессов. По умолчанию: ``1``"
38+
"``PPC_NUM_PROC``: Specifies the number of processes to launch. Default: "
39+
"``1``"
40+
msgstr ""
41+
"``PPC_NUM_PROC``: задаёт количество запускаемых процессов. По умолчанию: "
42+
"``1``"
3943

4044
#: ../../../../docs/user_guide/environment_variables.rst:9
4145
msgid ""
42-
"``PPC_NUM_THREADS``: Specifies the number of threads to use. Default:"
43-
" ``1``"
44-
msgstr "``PPC_NUM_THREADS``: задаёт количество используемых потоков. По умолчанию: ``1``"
46+
"``PPC_NUM_THREADS``: Specifies the number of threads to use. Default: "
47+
"``1``"
48+
msgstr ""
49+
"``PPC_NUM_THREADS``: задаёт количество используемых потоков. По "
50+
"умолчанию: ``1``"
4551

4652
#: ../../../../docs/user_guide/environment_variables.rst:12
4753
msgid ""
48-
"``PPC_ASAN_RUN``: Specifies that application is compiler with "
49-
"sanitizers. Used by ``scripts/run_tests.py`` to skip ``valgrind`` runs. "
50-
"Default: ``0``"
51-
msgstr "``PPC_ASAN_RUN``: указывает, что приложение собрано с санитайзерами. Используется в ``scripts/run_tests.py`` для пропуска запусков под ``valgrind``. По умолчанию: ``0``"
54+
"``PPC_ASAN_RUN``: Specifies that application is compiler with sanitizers."
55+
" Used by ``scripts/run_tests.py`` to skip ``valgrind`` runs. Default: "
56+
"``0``"
57+
msgstr ""
58+
"``PPC_ASAN_RUN``: указывает, что приложение собрано с санитайзерами. "
59+
"Используется в ``scripts/run_tests.py`` для пропуска запусков под "
60+
"``valgrind``. По умолчанию: ``0``"
61+
62+
#: ../../../../docs/user_guide/environment_variables.rst:15
63+
#, fuzzy
64+
msgid ""
65+
"``PPC_IGNORE_TEST_TIME_LIMIT``: Specifies that test time limits are "
66+
"ignored. Used by ``scripts/run_tests.py`` to disable time limit "
67+
"enforcement. Default: ``0``"
68+
msgstr ""
69+
"``PPC_IGNORE_TEST_TIME_LIMIT``: указывает, что ограничения по времени выполнения тестов игнорируются. "
70+
"Используется в ``scripts/run_tests.py`` для отключения контроля ограничений по времени. "
71+
"По умолчанию: ``0``"
5272

docs/user_guide/environment_variables.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ The following environment variables can be used to configure the project's runti
1111

1212
- ``PPC_ASAN_RUN``: Specifies that application is compiler with sanitizers. Used by ``scripts/run_tests.py`` to skip ``valgrind`` runs.
1313
Default: ``0``
14+
15+
- ``PPC_IGNORE_TEST_TIME_LIMIT``: Specifies that test time limits are ignored. Used by ``scripts/run_tests.py`` to disable time limit enforcement.
16+
Default: ``0``

modules/core/task/src/task.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define _CRT_SECURE_NO_WARNINGS
12
#include "core/task/include/task.hpp"
23

34
#include <algorithm>
@@ -69,7 +70,9 @@ void ppc::core::Task::InternalTimeTest(const std::string &str) {
6970
auto diff = static_cast<double>(duration) * 1e-9;
7071

7172
std::stringstream err_msg;
72-
if (diff < kMaxTestTime) {
73+
if (auto env = std::getenv("PPC_IGNORE_TEST_TIME_LIMIT"); env != nullptr && std::string(env) == "1") {
74+
err_msg << "Test time:" << std::fixed << std::setprecision(10) << diff << " (no time limit)" << '\n';
75+
} else if (diff < kMaxTestTime) {
7376
err_msg << "Test time:" << std::fixed << std::setprecision(10) << diff << '\n';
7477
} else {
7578
err_msg << "\nTask execute time need to be: ";

0 commit comments

Comments
 (0)