diff --git a/utbot-python/samples/run_tests.py b/utbot-python/samples/run_tests.py new file mode 100644 index 0000000000..3357b914e5 --- /dev/null +++ b/utbot-python/samples/run_tests.py @@ -0,0 +1,13 @@ +import json +import os + + +def parse_config(config_path: str): + with open(config_path, "r") as fin: + return json.loads(fin.read()) + + +def run_tests(jar_path: str, sys_paths: [str], python_path: str, files: list[str], timeout: int = 20, output: str): + command = f"java -jar {jar_path} generate_python {' '.join(files)} -p {python_path} -o {output} -s {' '.join(sys_path)} --timeout {timeout * 1000}" + try: + os.system(command) diff --git a/utbot-python/samples/samples.md b/utbot-python/samples/samples.md deleted file mode 100644 index b3cf2794e8..0000000000 --- a/utbot-python/samples/samples.md +++ /dev/null @@ -1,27 +0,0 @@ -## Соответствие файлов и сгенерированных тестов - -Примеры в `/samples`, сгенерированный код в `/cli_utbot_tests`. - -Команда по умолчанию -```bash -java -jar utbot-cli.jar generate_python samples/.py -p -o cli_utbot_tests/.py -s samples/ ----timeout-for-run 500 --timeout 10000 --visit-only-specified-source -``` - -| Пример | Тесты | Дополнительные аргументы | -|--------------------------|-------------------------------------------|-------------------------------------------| -| `arithmetic.py` | `generated_tests__arithmetic.py` | | -| `deep_equals.py` | `generated_tests__deep_equals.py` | | -| `dicts.py` | `generated_tests__dicts.py` | `-c Dictionary -m translate` | -| `deque.py` | `generated_tests__deque.py` | | -| `dummy_with_eq.py` | `generated_tests__dummy_with_eq.py` | `-c Dummy -m propogate` | -| `dummy_without_eq.py` | `generated_tests__dummy_without_eq.py` | `-c Dummy -m propogate` | -| `graph.py` | `generated_tests__graph.py` | | -| `lists.py` | `generated_tests__lists.py` | | -| `list_of_datetime.py` | `generated_tests__list_of_datetime.py` | | -| `longest_subsequence.py` | `generated_tests__longest_subsequence.py` | | -| `matrix.py` | `generated_tests__matrix.py` | `-c Matrix -m __add__,__mul__,__matmul__` | -| `primitive_types.py` | `generated_tests__primitive_types.py` | | -| `quick_sort.py` | `generated_tests__quick_sort.py` | | -| `test_coverage.py` | `generated_tests__test_coverage.py` | | -| `type_inhibition.py` | `generated_tests__type_inhibition.py` | | -| `using_collections.py` | `generated_tests__using_collections.py` | | diff --git a/utbot-python/samples/test_configuration.json b/utbot-python/samples/test_configuration.json new file mode 100644 index 0000000000..b260697f1d --- /dev/null +++ b/utbot-python/samples/test_configuration.json @@ -0,0 +1,42 @@ +{ + "parts": [ + { + "path": "samples.algorithms", + "files": [ + { + "name": "bfs", + "groups": [ + { + "function_names": [ + "bfs" + ], + "timeout": 10 + } + ] + }, + { + "name": "longest_subsequence", + "groups": [ + { + "function_names": [ + "longest_subsequence" + ], + "timeout": 10 + } + ] + }, + { + "name": "quick_sort", + "groups": [ + { + "function_names": [ + "quick_sort" + ], + "timeout": 10 + } + ] + } + ] + } + ] +} \ No newline at end of file