You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2022/11/08 20:00:39 UTC
[tvm] branch main updated: [OpenCL][unit tests] Fix opencl cpp unit tests (#13254)
This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 750ba9f742 [OpenCL][unit tests] Fix opencl cpp unit tests (#13254)
750ba9f742 is described below
commit 750ba9f742da772e730b9d77075834dd53e37682
Author: Egor Churaev <eg...@gmail.com>
AuthorDate: Tue Nov 8 23:00:32 2022 +0300
[OpenCL][unit tests] Fix opencl cpp unit tests (#13254)
* [OpenCL][unit tests] Fix opencl cpp unit tests
After some changes in Hexagon, the run of cpp opencl tests leads to the
following error:
```
pluggy.manager.PluginValidationError: unknown hook 'pytest_configure_node' in plugin <module 'tvm.contrib.hexagon.pytest_plugin'
```
Added `pytest_plugin` for OpenCL CPP tests for avoiding this error and
processing gtest arguments.
* Fix fail than gtest_args option was already added
* Move `gtest_args` deginition to the main testing plugin
---
python/tvm/contrib/hexagon/pytest_plugin.py | 8 --------
python/tvm/testing/plugin.py | 10 ++++++++++
tests/python/contrib/test_opencl/conftest.py | 29 ----------------------------
3 files changed, 10 insertions(+), 37 deletions(-)
diff --git a/python/tvm/contrib/hexagon/pytest_plugin.py b/python/tvm/contrib/hexagon/pytest_plugin.py
index bc167f2504..585a6cc3c5 100644
--- a/python/tvm/contrib/hexagon/pytest_plugin.py
+++ b/python/tvm/contrib/hexagon/pytest_plugin.py
@@ -345,8 +345,6 @@ def clear_logcat(request) -> bool:
def pytest_addoption(parser):
"""Add pytest options."""
- parser.addoption("--gtest_args", action="store", default="")
-
parser.addoption(
"--skip-rpc",
action="store_true",
@@ -372,9 +370,3 @@ def pytest_addoption(parser):
default=False,
help="If set true, it will clear logcat before execution.",
)
-
-
-def pytest_generate_tests(metafunc):
- option_value = metafunc.config.option.gtest_args
- if "gtest_args" in metafunc.fixturenames and option_value is not None:
- metafunc.parametrize("gtest_args", [option_value])
diff --git a/python/tvm/testing/plugin.py b/python/tvm/testing/plugin.py
index 2d845b70ff..c72bf0426e 100644
--- a/python/tvm/testing/plugin.py
+++ b/python/tvm/testing/plugin.py
@@ -70,12 +70,22 @@ def pytest_configure(config):
print("pytest marker:", config.option.markexpr)
+def pytest_addoption(parser):
+ """Add pytest options."""
+ parser.addoption("--gtest_args", action="store", default="")
+
+
def pytest_generate_tests(metafunc):
"""Called once per unit test, modifies/parametrizes it as needed."""
_parametrize_correlated_parameters(metafunc)
_auto_parametrize_target(metafunc)
_add_target_specific_marks(metafunc)
+ # Process gtest arguments
+ option_value = metafunc.config.option.gtest_args
+ if "gtest_args" in metafunc.fixturenames and option_value is not None:
+ metafunc.parametrize("gtest_args", [option_value])
+
def pytest_collection_modifyitems(config, items):
"""Called after all tests are chosen, currently used for bookkeeping."""
diff --git a/tests/python/contrib/test_opencl/conftest.py b/tests/python/contrib/test_opencl/conftest.py
deleted file mode 100644
index 0a8b9e1c63..0000000000
--- a/tests/python/contrib/test_opencl/conftest.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-""" OpenCL testing fixtures used to deduce testing argument
- values from testing parameters """
-
-
-import pytest
-
-import tvm
-import tvm.testing
-
-pytest_plugins = [
- "tvm.contrib.hexagon.pytest_plugin",
-]