1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3 4# Copyright (c) 2021-2025 Huawei Device Co., Ltd. 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17 18from functools import cached_property 19from pathlib import Path 20from typing import Optional 21 22 23class EtsTestDir: 24 def __init__(self, static_core_root: str, root: Optional[str] = None) -> None: 25 self.__static_core_root = Path(static_core_root) 26 self.__root = root 27 28 @property 29 def tests(self) -> Path: 30 return self.root / "tests" 31 32 @property 33 def ets_templates(self) -> Path: 34 return self.tests / "ets-templates" 35 36 @property 37 def ets_func_tests(self) -> Path: 38 return self.tests / "ets_func_tests" 39 40 @property 41 def stdlib_templates(self) -> Path: 42 return self.tests / "stdlib-templates" 43 44 @property 45 def ets_func_tests_templates(self) -> Path: 46 return self.tests / "ets-func-tests-templates" 47 48 @property 49 def gc_stress(self) -> Path: 50 return self.tests / "ets_test_suite" / "gc" / "stress" 51 52 @property 53 def ets_es_checked(self) -> Path: 54 return self.tests / "ets_es_checked" 55 56 @property 57 def ets_ts_subset(self) -> Path: 58 return self.tests / "ets_ts_subset" 59 60 @property 61 def ets_sdk(self) -> Path: 62 return self.tests / "ets_sdk" 63 64 @cached_property 65 def root(self) -> Path: 66 return Path(self.__root) if self.__root else self.__static_core_root / "plugins" / "ets" 67