From 4dd4bb44845989ca81ea89047b97d48e0a3a591d Mon Sep 17 00:00:00 2001 From: elser Date: Wed, 6 Sep 2023 15:42:47 -0400 Subject: [PATCH 01/13] set up basic tests extension to test c++ code --- .gitignore | 3 + .vscode/launch.linux.json | 28 +++ CMakeLists.txt | 55 +++++ apps/cesium.omniverse.tests.kit | 19 ++ cesiumTestsExtension/CMakeLists.txt | 2 + cesiumTestsExtension/bindings/CMakeLists.txt | 25 ++ .../bindings/PythonBindings.cpp | 20 ++ cesiumTestsExtension/bindings/pyboost11.h | 214 ++++++++++++++++++ cesiumTestsExtension/include/CesiumTests.h | 25 ++ cesiumTestsExtension/public/CMakeLists.txt | 33 +++ cesiumTestsExtension/public/CesiumTests.cpp | 43 ++++ exts/cesium.tests/cesium/tests/__init__.py | 1 + .../cesium/tests/bindings/__init__.py | 1 + exts/cesium.tests/cesium/tests/extension.py | 23 ++ exts/cesium.tests/cesium/tests/test_window.py | 59 +++++ .../cesium/tests/utils/__init__.py | 1 + exts/cesium.tests/cesium/tests/utils/utils.py | 58 +++++ exts/cesium.tests/config/extension.toml | 33 +++ exts/cesium.tests/doc/README.md | 13 ++ exts/cesium.tests/doc/resources/icon.png | Bin 0 -> 15262 bytes genStubs.bat | 4 + genStubs.sh | 4 + 22 files changed, 664 insertions(+) create mode 100644 apps/cesium.omniverse.tests.kit create mode 100644 cesiumTestsExtension/CMakeLists.txt create mode 100644 cesiumTestsExtension/bindings/CMakeLists.txt create mode 100644 cesiumTestsExtension/bindings/PythonBindings.cpp create mode 100644 cesiumTestsExtension/bindings/pyboost11.h create mode 100644 cesiumTestsExtension/include/CesiumTests.h create mode 100644 cesiumTestsExtension/public/CMakeLists.txt create mode 100644 cesiumTestsExtension/public/CesiumTests.cpp create mode 100644 exts/cesium.tests/cesium/tests/__init__.py create mode 100644 exts/cesium.tests/cesium/tests/bindings/__init__.py create mode 100644 exts/cesium.tests/cesium/tests/extension.py create mode 100644 exts/cesium.tests/cesium/tests/test_window.py create mode 100644 exts/cesium.tests/cesium/tests/utils/__init__.py create mode 100644 exts/cesium.tests/cesium/tests/utils/utils.py create mode 100644 exts/cesium.tests/config/extension.toml create mode 100644 exts/cesium.tests/doc/README.md create mode 100644 exts/cesium.tests/doc/resources/icon.png diff --git a/.gitignore b/.gitignore index 2b8eba52a..ec41d9f9f 100644 --- a/.gitignore +++ b/.gitignore @@ -46,10 +46,13 @@ exts/cesium.omniverse/cesium/omniverse/bindings/CesiumOmniversePythonBindings.cp exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.so exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.pyd exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.lib +exts/cesium.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.cpython-310-x86_64-linux-gnu.so +exts/cesium.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.cp310-win_amd64.pyd # Installed libraries exts/cesium.omniverse/bin/ exts/cesium.usd.plugins/bin/ +exts/cesium.tests/bin/ # Installed plugins exts/cesium.usd.plugins/plugins/ diff --git a/.vscode/launch.linux.json b/.vscode/launch.linux.json index effffde50..62c54e5e5 100644 --- a/.vscode/launch.linux.json +++ b/.vscode/launch.linux.json @@ -29,6 +29,34 @@ } ] }, + { + "name": "Tests", + "preLaunchTask": "Build Only (debug)", + "program": "${workspaceFolder}/extern/nvidia/_build/target-deps/kit-sdk/kit", + "args": [ + "${workspaceFolder}/apps/cesium.omniverse.tests.kit" + ], + "env": { + // Disable LSAN when debugging since it doesn't work with GDB and prints harmless but annoying warning messages + "ASAN_OPTIONS": "detect_leaks=0", + "UBSAN_OPTIONS": "print_stacktrace=1" + }, + "cwd": "${workspaceFolder}", + "type": "lldb", + "request": "launch", + "console": "externalTerminal", + "internalConsoleOptions": "openOnSessionStart", + "MIMode": "gdb", + "setupCommands": [ + { + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "text": "set print elements 0" + } + ] + }, { "name": "Development App (Kit Debug)", "preLaunchTask": "Build Only (debug)", diff --git a/CMakeLists.txt b/CMakeLists.txt index b2a4ae368..a9cf5df66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -437,6 +437,7 @@ add_subdirectory(src) if(CESIUM_OMNI_ENABLE_TESTS) enable_testing() add_subdirectory(tests) + add_subdirectory(cesiumTestsExtension) endif() # Ninja and various Makefiles generators support generating compile_commands.json @@ -511,6 +512,9 @@ set(KIT_EXTENSION_BINDINGS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse/ces set(KIT_PLUGIN_EXTENSION_BINDINGS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.usd.plugins/cesium/usd/plugins") set(KIT_EXTENSION_PLUGINS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.usd.plugins/plugins") +set(KIT_EXTENSION_TESTS_BIN_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.tests/bin") +set(KIT_EXTENSION_TESTS_BINDINGS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.tests/cesium/tests/bindings") + # You may see warnings like: # # CMake Warning at build/src/cmake_install.cmake:115 (file): @@ -663,6 +667,57 @@ install( COMPONENT library EXCLUDE_FROM_ALL) +install( + TARGETS cesium.omniverse.tests.plugin + ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install + LIBRARY DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install + RUNTIME DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install) +install( + TARGETS cesium.omniverse.tests.plugin + RUNTIME_DEPENDENCIES + DIRECTORIES + ${INSTALL_SEARCH_PATHS} + PRE_EXCLUDE_REGEXES + ${INSTALL_PRE_EXCLUDE_REGEXES} + POST_EXCLUDE_REGEXES + ${INSTALL_POST_EXCLUDE_REGEXES} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL) + + +install( + TARGETS CesiumOmniverseTestsPythonBindings + ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install + LIBRARY DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install + RUNTIME DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install) + +install( + TARGETS CesiumOmniverseTestsPythonBindings + RUNTIME_DEPENDENCIES + DIRECTORIES + ${INSTALL_SEARCH_PATHS} + PRE_EXCLUDE_REGEXES + ${INSTALL_PRE_EXCLUDE_REGEXES} + POST_EXCLUDE_REGEXES + ${INSTALL_POST_EXCLUDE_REGEXES} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL) + + install( DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/apps/cesium.omniverse.tests.kit b/apps/cesium.omniverse.tests.kit new file mode 100644 index 000000000..2834f40fd --- /dev/null +++ b/apps/cesium.omniverse.tests.kit @@ -0,0 +1,19 @@ +[package] +title = "Cesium For Omniverse Tests App" +version = "0.0.0" +app = true + +[dependencies] +"cesium.omniverse.dev" = {} +"cesium.tests" = {} + +[settings] +app.window.title = "Cesium for Omniverse Tests App" + +[settings.app.exts] +folders.'++' = [ + "${app}", # Find other applications in this folder + "${app}/exts", # Find extensions in this folder + "${app}/../exts", # Find cesium.omniverse and cesium.usd.schemas + "${app}/../extern/nvidia/app/extscache" # Find omni.kit.window.material_graph +] diff --git a/cesiumTestsExtension/CMakeLists.txt b/cesiumTestsExtension/CMakeLists.txt new file mode 100644 index 000000000..c54b82a96 --- /dev/null +++ b/cesiumTestsExtension/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(bindings) +add_subdirectory(public) diff --git a/cesiumTestsExtension/bindings/CMakeLists.txt b/cesiumTestsExtension/bindings/CMakeLists.txt new file mode 100644 index 000000000..ae0f64ed4 --- /dev/null +++ b/cesiumTestsExtension/bindings/CMakeLists.txt @@ -0,0 +1,25 @@ +include(Macros) + +glob_files(SOURCES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") + +# cmake-format: off +setup_python_module( + PYTHON_DIR + # Use the same Python version as Omniverse (Python 3.10) + "${PROJECT_SOURCE_DIR}/extern/nvidia/_build/target-deps/python" + TARGET_NAME + CesiumOmniverseTestsPythonBindings + SOURCES + ${SOURCES} + LIBRARIES + cesium.omniverse.tests.plugin + CXX_FLAGS + ${CESIUM_OMNI_CXX_FLAGS} + CXX_FLAGS_DEBUG + ${CESIUM_OMNI_CXX_FLAGS_DEBUG} + CXX_DEFINES + ${CESIUM_OMNI_CXX_DEFINES} + CXX_DEFINES_DEBUG + ${CESIUM_OMNI_CXX_DEFINES_DEBUG} +) +# cmake-format: on diff --git a/cesiumTestsExtension/bindings/PythonBindings.cpp b/cesiumTestsExtension/bindings/PythonBindings.cpp new file mode 100644 index 000000000..b4bed21c4 --- /dev/null +++ b/cesiumTestsExtension/bindings/PythonBindings.cpp @@ -0,0 +1,20 @@ +#include +#include "CesiumTests.h" + +// NOLINTNEXTLINE +CARB_BINDINGS("cesium.tests.python") +DISABLE_PYBIND11_DYNAMIC_CAST(cesium::omniverse::tests::ICesiumOmniverseTestsInterface) + +PYBIND11_MODULE(CesiumOmniverseTestsPythonBindings, m) { + + using namespace cesium::omniverse::tests; + + m.doc() = "pybind11 cesium.omniverse.tests bindings"; + + // clang-format off + carb::defineInterfaceClass( + m, "ICesiumOmniverseTestsInterface", "acquire_cesium_omniverse_tests_interface", "release_cesium_omniverse_tests_interface") + .def("run_all_tests", &ICesiumOmniverseTestsInterface::run_all_tests); + // clang-format on + +} diff --git a/cesiumTestsExtension/bindings/pyboost11.h b/cesiumTestsExtension/bindings/pyboost11.h new file mode 100644 index 000000000..9a3e8634b --- /dev/null +++ b/cesiumTestsExtension/bindings/pyboost11.h @@ -0,0 +1,214 @@ +// From https://yyc.solvcon.net/en/latest/writing/2021/pyboost11/code.html + +// clang-format off +/* + * Copyright (c) 2021, Yung-Yu Chen + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include + +#ifdef CESIUM_OMNI_GCC + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmissing-field-initializers" + #pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +#include + +#ifdef CESIUM_OMNI_GCC + #pragma GCC diagnostic pop +#endif + +namespace pyboost11 +{ + +// Pybind11 cast by using boost.python. +template struct caster +{ + + caster(pybind11::handle src) + : obj(boost::python::handle<>(boost::python::borrowed(src.ptr()))) + , ext(obj) + {} + + bool check() const { return ext.check(); } + + // From-Python conversion. + operator T() { return ext(); } + T operator()() { return ext(); } + + // To-Python conversion. + static pybind11::handle to_python(T & src) + { + namespace bpy = boost::python; + return bpy::incref(bpy::object(src).ptr()); + } + + boost::python::object obj; + boost::python::extract ext; + +}; + +} // end namespace pyboost11 + +namespace pybind11 +{ + +namespace detail +{ + +template struct pyboost11_type_caster +{ + +// Expanded from PYBIND11_TYPE_CASTER. +protected: + type value; +public: + template >::value, int> = 0> + static handle cast(T_ *src, return_value_policy policy, handle parent) { + if (!src) return none().release(); + if (policy == return_value_policy::take_ownership) { + auto h = cast(std::move(*src), policy, parent); delete src; return h; + } else { + return cast(*src, policy, parent); + } + } + operator type*() { return &value; } + operator type&() { return value; } + operator type&&() && { return std::move(value); } + template using cast_op_type = pybind11::detail::movable_cast_op_type; + + // Boilerplate. + bool load(handle src, bool) + { + if (!src) + { + return false; + } + pyboost11::caster ext(src); + if (!ext.check()) + { + return false; + } + value = ext(); + return true; + } + static handle cast(type * src, return_value_policy /* policy */, handle /* parent */) + { + return pyboost11::caster::to_python(src); + } + static handle cast(type src, return_value_policy /* policy */, handle /* parent */) + { + return pyboost11::caster::to_python(src); + } + +}; + +#define PYBOOST11_TYPE_CASTER(type, py_name) \ + template <> struct type_caster : public pyboost11_type_caster \ + { static constexpr auto name = py_name; } + +} // end namespace detail + +} // end namespace pybind11 + +namespace pyboost11 +{ + +// Boost.python convert by using pybind11. +template struct converter +{ + +public: + + converter() { init(); } + + void init() + { + static bool initialized = false; + if (!initialized) + { + namespace bpy = boost::python; + // From-Python conversion. + bpy::converter::registry::push_back + ( + &convertible + , &construct + , bpy::type_id() + ); + // To-Python conversion. + bpy::to_python_converter(); + + initialized = true; + } + } + + // From-Python convertibility. + static void * convertible(PyObject * objptr) + { + namespace pyb = pybind11; + try + { + pyb::handle(objptr).cast(); + return objptr; + } + catch (pyb::cast_error const &) + { + return nullptr; + } + } + + // From-Python conversion. + static void construct + ( + PyObject * objptr + , boost::python::converter::rvalue_from_python_stage1_data * data + ) + { + namespace pyb = pybind11; + void * storage = reinterpret_cast + < + boost::python::converter::rvalue_from_python_storage * + >(data)->storage.bytes; + new (storage) T(pyb::handle(objptr).cast()); + data->convertible = storage; + } + + // To-Python conversion. + static PyObject * convert(T const & t) + { + return pybind11::cast(t).inc_ref().ptr(); + } + +}; + +} // end namespace pyboost11 + +// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: +// clang-format on diff --git a/cesiumTestsExtension/include/CesiumTests.h b/cesiumTestsExtension/include/CesiumTests.h new file mode 100644 index 000000000..faf304d65 --- /dev/null +++ b/cesiumTestsExtension/include/CesiumTests.h @@ -0,0 +1,25 @@ +#pragma once +#include +// TODO put this in the right place and try removing test sub-namespace +namespace cesium::omniverse::tests +{ + +class ICesiumOmniverseTestsInterface{ + public: + CARB_PLUGIN_INTERFACE("cesium::omniverse::tests::ICesiumOmniverseTestsInterface", 0, 0); + /** + * @brief Call this on extension startup. + * + * @param cesiumExtensionLocation Path to the Cesium Omniverse extension location. + */ + virtual void onStartup(const char* cesiumExtensionLocation) noexcept = 0; + + /** + * @brief Call this on extension shutdown. + */ + virtual void onShutdown() noexcept = 0; + + virtual void run_all_tests(long int stage_id) noexcept = 0; +}; + +} diff --git a/cesiumTestsExtension/public/CMakeLists.txt b/cesiumTestsExtension/public/CMakeLists.txt new file mode 100644 index 000000000..309243d6e --- /dev/null +++ b/cesiumTestsExtension/public/CMakeLists.txt @@ -0,0 +1,33 @@ +include(Macros) + +glob_files(SOURCES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") + +get_property(ADDITIONAL_LIBRARIES GLOBAL PROPERTY NVIDIA_ADDITIONAL_LIBRARIES_PROPERTY) + +# cmake-format: off +setup_lib( + TARGET_NAME + cesium.omniverse.tests.plugin + TYPE + # Carbonite Plugins needs to be shared libraries + SHARED + SOURCES + ${SOURCES} + INCLUDE_DIRS + "${PROJECT_SOURCE_DIR}/cesiumTestsExtension/include" + LIBRARIES + CesiumOmniverseCore + ADDITIONAL_LIBRARIES + # Unfortunately we need this in both cesium.omniverse.plugin and CesiumOmniverseCore because we're bypassing + # CMake's built-in dependency system + "${ADDITIONAL_LIBRARIES}" + CXX_FLAGS + ${CESIUM_OMNI_CXX_FLAGS} + CXX_FLAGS_DEBUG + ${CESIUM_OMNI_CXX_FLAGS_DEBUG} + CXX_DEFINES + ${CESIUM_OMNI_CXX_DEFINES} + CXX_DEFINES_DEBUG + ${CESIUM_OMNI_CXX_DEFINES_DEBUG} +) +# cmake-format: on diff --git a/cesiumTestsExtension/public/CesiumTests.cpp b/cesiumTestsExtension/public/CesiumTests.cpp new file mode 100644 index 000000000..7de1cb871 --- /dev/null +++ b/cesiumTestsExtension/public/CesiumTests.cpp @@ -0,0 +1,43 @@ +#define CARB_EXPORTS + +#include "CesiumTests.h" + +#include "cesium/omniverse/Context.h" + +#include +#include + +#include + +namespace cesium::omniverse::tests { + +class CesiumOmniverseTestsPlugin final : public ICesiumOmniverseTestsInterface { + public: + void onStartup(const char* cesiumExtensionLocation) noexcept override { + Context::onStartup(cesiumExtensionLocation); + } + + void onShutdown() noexcept override { + Context::onShutdown(); + } + + void run_all_tests(long int stage_id) noexcept override { + + std::cout << "Running Cesium Omniverse Tests with stage id: " << stage_id << std::endl; + // TODO run tests + + std::cout << "Cesium Omniverse Tests complete" << std::endl; + } +}; + +} // namespace cesium::omniverse::tests + +const struct carb::PluginImplDesc pluginImplDesc = + {"cesium.tests.plugin", "Cesium Omniverse Tests Plugin.", "Cesium", carb::PluginHotReload::eDisabled, "dev"}; + +// NOLINTBEGIN +CARB_PLUGIN_IMPL(pluginImplDesc, cesium::omniverse::tests::CesiumOmniverseTestsPlugin) +CARB_PLUGIN_IMPL_DEPS(omni::fabric::IFabric, omni::fabric::IStageReaderWriter) +// NOLINTEND + +void fillInterface([[maybe_unused]] cesium::omniverse::tests::CesiumOmniverseTestsPlugin& iface) {} diff --git a/exts/cesium.tests/cesium/tests/__init__.py b/exts/cesium.tests/cesium/tests/__init__.py new file mode 100644 index 000000000..8a33ed75d --- /dev/null +++ b/exts/cesium.tests/cesium/tests/__init__.py @@ -0,0 +1 @@ +from .extension import * # noqa: F401 F403 diff --git a/exts/cesium.tests/cesium/tests/bindings/__init__.py b/exts/cesium.tests/cesium/tests/bindings/__init__.py new file mode 100644 index 000000000..002aae5f6 --- /dev/null +++ b/exts/cesium.tests/cesium/tests/bindings/__init__.py @@ -0,0 +1 @@ +from .CesiumOmniverseTestsPythonBindings import * # noqa: F401 F403 diff --git a/exts/cesium.tests/cesium/tests/extension.py b/exts/cesium.tests/cesium/tests/extension.py new file mode 100644 index 000000000..b4aa02033 --- /dev/null +++ b/exts/cesium.tests/cesium/tests/extension.py @@ -0,0 +1,23 @@ +import omni.ext +import omni.kit.ui +from .bindings import acquire_cesium_omniverse_tests_interface, release_cesium_omniverse_tests_interface + + +class CesiumTestsExtension(omni.ext.IExt): + def __init__(self): + super().__init__() + + def on_startup(self): + print("Starting Cesium Tests Extension...") + + global tests_interface + tests_interface = acquire_cesium_omniverse_tests_interface() + + tests_interface.run_all_tests(0) + + print("Started Cesium Tests Extension.") + + def on_shutdown(self): + print("Stopping Cesium Tests Extension...") + release_cesium_omniverse_tests_interface(tests_interface) + print("Stopped Cesium Tests Extension.") diff --git a/exts/cesium.tests/cesium/tests/test_window.py b/exts/cesium.tests/cesium/tests/test_window.py new file mode 100644 index 000000000..ab27c947c --- /dev/null +++ b/exts/cesium.tests/cesium/tests/test_window.py @@ -0,0 +1,59 @@ +import logging +import omni.ui as ui +from typing import Callable, Optional, List +from cesium.omniverse.ui import CesiumOmniverseDebugWindow +from .utils import extend_far_plane, save_carb_settings +import os +from functools import partial + +powertools_extension_location = os.path.join(os.path.dirname(__file__), "../../") + + +class PowertoolsAction: + def __init__(self, title: str, action: Callable): + self._title = title + self._action = action + self._button: Optional[ui.Button] = None + + def destroy(self): + if self._button is not None: + self._button.destroy() + self._button = None + + def button(self): + if self._button is None: + self._button = ui.Button(self._title, height=0, clicked_fn=self._action) + + return self._button + + +class CesiumPowertoolsWindow(ui.Window): + WINDOW_NAME = "Cesium Test" + MENU_PATH = f"Window/Cesium/{WINDOW_NAME}" + + def __init__(self, **kwargs): + super().__init__(CesiumPowertoolsWindow.WINDOW_NAME, **kwargs) + + self._logger = logging.getLogger(__name__) + + # You do not necessarily need to create an action function in this window class. If you have a function + # in another window or class, you can absolutely call that instead from here. + self._actions: List[PowertoolsAction] = [ + PowertoolsAction("Open Cesium Debugging Window", CesiumOmniverseDebugWindow.show_window), + PowertoolsAction("Extend Far Plane", extend_far_plane), + PowertoolsAction("Save Carb Settings", partial(save_carb_settings, powertools_extension_location)), + ] + + self.frame.set_build_fn(self._build_fn) + + def destroy(self) -> None: + for action in self._actions: + action.destroy() + self._actions.clear() + + super().destroy() + + def _build_fn(self): + with ui.VStack(spacing=4): + for action in self._actions: + action.button() diff --git a/exts/cesium.tests/cesium/tests/utils/__init__.py b/exts/cesium.tests/cesium/tests/utils/__init__.py new file mode 100644 index 000000000..91d2b0830 --- /dev/null +++ b/exts/cesium.tests/cesium/tests/utils/__init__.py @@ -0,0 +1 @@ +from .utils import * # noqa: F401 F403 diff --git a/exts/cesium.tests/cesium/tests/utils/utils.py b/exts/cesium.tests/cesium/tests/utils/utils.py new file mode 100644 index 000000000..c1b094a91 --- /dev/null +++ b/exts/cesium.tests/cesium/tests/utils/utils.py @@ -0,0 +1,58 @@ +import omni.usd +from omni.kit.viewport.utility import get_active_viewport +from pxr import Gf, UsdGeom, Sdf +import json +import carb.settings +import os + + +# Modified version of ScopedEdit in _build_viewport_cameras in omni.kit.widget.viewport +class ScopedEdit: + def __init__(self, stage): + self.__stage = stage + edit_target = stage.GetEditTarget() + edit_layer = edit_target.GetLayer() + self.__edit_layer = stage.GetSessionLayer() + self.__was_editable = self.__edit_layer.permissionToEdit + if not self.__was_editable: + self.__edit_layer.SetPermissionToEdit(True) + if self.__edit_layer != edit_layer: + stage.SetEditTarget(self.__edit_layer) + self.__edit_target = edit_target + else: + self.__edit_target = None + + def __del__(self): + if self.__edit_layer and not self.__was_editable: + self.__edit_layer.SetPermissionToEdit(False) + self.__edit_layer = None + + if self.__edit_target: + self.__stage.SetEditTarget(self.__edit_target) + self.__edit_target = None + + +def extend_far_plane(): + stage = omni.usd.get_context().get_stage() + viewport = get_active_viewport() + camera_path = viewport.get_active_camera() + camera = UsdGeom.Camera.Get(stage, camera_path) + assert camera.GetPrim().IsValid() + + scoped_edit = ScopedEdit(stage) # noqa: F841 + camera.GetClippingRangeAttr().Set(Gf.Vec2f(1.0, 10000000000.0)) + + +def save_carb_settings(powertools_extension_location: str): + carb_settings_path = os.path.join(powertools_extension_location, "carb_settings.txt") + with open(carb_settings_path, "w") as fh: + fh.write(json.dumps(carb.settings.get_settings().get("/"), indent=2)) + + +# Helper function to search for an attribute on a prim, or create it if not present +def get_or_create_attribute(prim, name, type): + attribute = prim.GetAttribute(name) + if not attribute: + attribute = prim.CreateAttribute(name, type) + return attribute + diff --git a/exts/cesium.tests/config/extension.toml b/exts/cesium.tests/config/extension.toml new file mode 100644 index 000000000..69618eec9 --- /dev/null +++ b/exts/cesium.tests/config/extension.toml @@ -0,0 +1,33 @@ +[package] +version = "0.1.0" +category = "simulation" +feature = false +app = false +title = "Cesium for Omniverse Test" +description = "An extention to run tests against Cesium for Omniverse." +authors = "Cesium GS Inc." +repository = "https://github.com/CesiumGS/cesium-omniverse" +keywords = [ + "cesium", + "omniverse", + "geospatial", + "3D Tiles", + "glTF", + "globe", + "earth", + "simulation", + "test" +] + +[[native.plugin]] +path = "bin/cesium.omniverse.tests.plugin" + +# Paths are relative to the extension folder +readme = "doc/README.md" +icon = "doc/resources/icon.png" + +[[python.module]] +name = "cesium.tests" + +[python.pipapi] +archiveDirs = ["vendor"] diff --git a/exts/cesium.tests/doc/README.md b/exts/cesium.tests/doc/README.md new file mode 100644 index 000000000..da33efff1 --- /dev/null +++ b/exts/cesium.tests/doc/README.md @@ -0,0 +1,13 @@ +# Cesium for Omniverse Test Extension + +This extension is designed to run tests against the Cesium for Omniverse Extension. + + +## Current Features + +### TODO list features + + +## License + +Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html). Cesium for Omniverse is free for both commercial and non-commercial use. diff --git a/exts/cesium.tests/doc/resources/icon.png b/exts/cesium.tests/doc/resources/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..42c816467fe1b69d558837ac715626becb1c4b33 GIT binary patch literal 15262 zcmcJ$1yoeg_dj}P7-5hG>24&4M!HK%X%uB>q`P705JW+w8E^=7SE_ug|qXV=+h-@VVdH%d!G3FjfjLjVA9RFvhP0{{qh3Id?$sKZN_ zLQB*E(@ELT6#%e^{{BHgYC0JJJUFt^F>o_bR}(dJwC9GKJDOT>d)Ygo&;TGV<>dr7 zv$b%eGqtd?agbm*Xl!MmvoV)o&=*vPsXNJ8SlcN3xL9cWXy};v*qS{tXONPl6ZaBD z5wN##gVTB0+c~(3dPy++gRUs*{BJW41KmF$ZnhE(GJhG;8K`T~$vL`M&GL%K(TW%w-kLYulO%!s4EEu zYd1G1Q63&oPfu=7er`t>D<0k_PoD6=_;~pExKIc#S8oS5xEGg$E91W@$XmFYx!5?l z**H4T{iO&ub#!-=U_gobPaW)?{zKNm^ES&YXE?!?2(4g0IpKY-?D|G_!AyV(7M zxw#pSg`I`Hg@c|5g@z`~R?TbyM&_ zsqrs^{I_UV9d9QKp63>>j_xjI7789HF&Y1A<0LBQVgYw^bkT8iwEOo+Y5iMdIzB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51T`S>V7HYETQ6 z;35co>JBz9JCgBNKEZAlR% zeXL%y7k0&fIE+@!s!;}7wYl_DWD-r!+@cKZ`8AqJijQWEb}?R`$;Uj~d!RKNndR%P z$BJY1^Xse7v-gTIVSEn$DKc~WdQaX+To@dtO$ji7YAf`S?#N9Gl390U)-4O9FkeS+*3-V3 z-h82J5m3x)Yp;F7B7gYXrF*lQd3H+mLiyw9?&qslm%ka~+1-N-h7WIi6XlHyDEcBu zOo>zVNV_+cnEa%afi&WCPA!5pYnhHJ_a~2Km+te8X1OaOmkTfvNA*O|SkiIK|35!B h`Y#_YEs5OGu2YPZl@=)n|NVkiML|QpOx7g${{jSqq Date: Thu, 14 Sep 2023 15:01:42 -0400 Subject: [PATCH 02/13] Integrated doctest with the test extension --- CMakeLists.txt | 2 - cesiumTestsExtension/bindings/CMakeLists.txt | 1 + cesiumTestsExtension/include/CesiumTests.h | 11 ++--- cesiumTestsExtension/public/CMakeLists.txt | 1 + cesiumTestsExtension/public/CesiumTests.cpp | 52 +++++++++++++++++++- 5 files changed, 58 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9cf5df66..120b86aa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -691,7 +691,6 @@ install( COMPONENT library EXCLUDE_FROM_ALL) - install( TARGETS CesiumOmniverseTestsPythonBindings ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install @@ -717,7 +716,6 @@ install( COMPONENT library EXCLUDE_FROM_ALL) - install( DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/cesiumTestsExtension/bindings/CMakeLists.txt b/cesiumTestsExtension/bindings/CMakeLists.txt index ae0f64ed4..09afc8da0 100644 --- a/cesiumTestsExtension/bindings/CMakeLists.txt +++ b/cesiumTestsExtension/bindings/CMakeLists.txt @@ -12,6 +12,7 @@ setup_python_module( SOURCES ${SOURCES} LIBRARIES + doctest::doctest cesium.omniverse.tests.plugin CXX_FLAGS ${CESIUM_OMNI_CXX_FLAGS} diff --git a/cesiumTestsExtension/include/CesiumTests.h b/cesiumTestsExtension/include/CesiumTests.h index faf304d65..e165b1175 100644 --- a/cesiumTestsExtension/include/CesiumTests.h +++ b/cesiumTestsExtension/include/CesiumTests.h @@ -1,11 +1,10 @@ #pragma once #include -// TODO put this in the right place and try removing test sub-namespace -namespace cesium::omniverse::tests -{ -class ICesiumOmniverseTestsInterface{ - public: +namespace cesium::omniverse::tests { + +class ICesiumOmniverseTestsInterface { + public: CARB_PLUGIN_INTERFACE("cesium::omniverse::tests::ICesiumOmniverseTestsInterface", 0, 0); /** * @brief Call this on extension startup. @@ -22,4 +21,4 @@ class ICesiumOmniverseTestsInterface{ virtual void run_all_tests(long int stage_id) noexcept = 0; }; -} +} // namespace cesium::omniverse::tests diff --git a/cesiumTestsExtension/public/CMakeLists.txt b/cesiumTestsExtension/public/CMakeLists.txt index 309243d6e..3e2fbe818 100644 --- a/cesiumTestsExtension/public/CMakeLists.txt +++ b/cesiumTestsExtension/public/CMakeLists.txt @@ -17,6 +17,7 @@ setup_lib( "${PROJECT_SOURCE_DIR}/cesiumTestsExtension/include" LIBRARIES CesiumOmniverseCore + doctest::doctest ADDITIONAL_LIBRARIES # Unfortunately we need this in both cesium.omniverse.plugin and CesiumOmniverseCore because we're bypassing # CMake's built-in dependency system diff --git a/cesiumTestsExtension/public/CesiumTests.cpp b/cesiumTestsExtension/public/CesiumTests.cpp index 7de1cb871..942cf3308 100644 --- a/cesiumTestsExtension/public/CesiumTests.cpp +++ b/cesiumTestsExtension/public/CesiumTests.cpp @@ -1,14 +1,53 @@ #define CARB_EXPORTS +#define DOCTEST_CONFIG_IMPLEMENT +#define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL +#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS #include "CesiumTests.h" #include "cesium/omniverse/Context.h" #include +#include #include #include +static void exampleTest() { + // This file is set up such that we can use doctest assertions (e.x. CHECK) + // outside of a test suite. + + // NOTE: failed tests will throw a SIGTRAP in order to call the handler + // defined below, which will trigger a pause in any running debugger. + // Execution can continue normally from there. To see this in action, + // modify the CHECK below to fail then run the extension in a debugger + + CHECK(1 + 1 == 2); +} + +static void handler(const doctest::AssertData& ad) { + // Handles failed doctest assertions + + using namespace doctest; + + std::cout << Color::LightGrey << skipPathFromFilename(ad.m_file) << "(" << ad.m_line << "): "; + std::cout << Color::Red << failureString(ad.m_at) << ": "; + + // handling only normal (comparison and unary) asserts - exceptions-related asserts have been skipped + if (ad.m_at & assertType::is_normal) { + std::cout << Color::Cyan << assertString(ad.m_at) << "( " << ad.m_expr << " ) "; + std::cout << Color::None << (ad.m_threw ? "THREW exception: " : "is NOT correct!\n"); + if (ad.m_threw) + std::cout << ad.m_exception; + else + std::cout << " values: " << assertString(ad.m_at) << "( " << ad.m_decomp << " )"; + } else { + std::cout << Color::None << "an assert dealing with exceptions has failed!"; + } + + std::cout << std::endl; +} + namespace cesium::omniverse::tests { class CesiumOmniverseTestsPlugin final : public ICesiumOmniverseTestsInterface { @@ -24,7 +63,18 @@ class CesiumOmniverseTestsPlugin final : public ICesiumOmniverseTestsInterface { void run_all_tests(long int stage_id) noexcept override { std::cout << "Running Cesium Omniverse Tests with stage id: " << stage_id << std::endl; - // TODO run tests + + // construct a context + doctest::Context context; + + // sets the context as the default one - so asserts used outside of a testing context do not crash + context.setAsDefaultForAssertsOutOfTestCases(); + + // set a handler with a signature: void(const doctest::AssertData&) + // without setting a handler we would get std::abort() called when an assert fails + context.setAssertHandler(handler); + + exampleTest(); std::cout << "Cesium Omniverse Tests complete" << std::endl; } From b43bb971cc95771454e3568903f41d9e411e3d0b Mon Sep 17 00:00:00 2001 From: brianwthomas Date: Fri, 15 Sep 2023 08:32:10 -0700 Subject: [PATCH 03/13] migration of build artifacts to internal services account --- .github/workflows/main.yml | 50 ++++++++++++++++++------------------ docs/release-guide/README.md | 4 +-- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c54a21de0..d40a0cfbd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,37 +15,37 @@ jobs: matrix: config: - { - name: 'Windows - MSVC', - artifact: 'windows-msvc.tar.xz', + name: "Windows - MSVC", + artifact: "windows-msvc.tar.xz", os: windows-latest-l, - cc: 'cl', - cxx: 'cl', - build-type: 'Release', - build-code: 'Windows', - generator: 'Ninja Multi-Config', - coverage: 'false', + cc: "cl", + cxx: "cl", + build-type: "Release", + build-code: "Windows", + generator: "Ninja Multi-Config", + coverage: "false", } - { - name: 'Ubuntu - GCC', - artifact: 'linux-gcc.tar.xz', + name: "Ubuntu - GCC", + artifact: "linux-gcc.tar.xz", os: ubuntu-latest-m, - cc: 'gcc-11', - cxx: 'g++-11', - build-type: 'Release', - build-code: 'Ubuntu', - generator: 'Unix Makefiles', - coverage: 'false', + cc: "gcc-11", + cxx: "g++-11", + build-type: "Release", + build-code: "Ubuntu", + generator: "Unix Makefiles", + coverage: "false", } - { - name: 'CentOS 7 - GCC', - artifact: 'linux-gcc.tar.xz', + name: "CentOS 7 - GCC", + artifact: "linux-gcc.tar.xz", os: ubuntu-latest-m, - cc: 'gcc-11', - cxx: 'g++-11', - build-type: 'Release', - build-code: 'CentOS7', - generator: 'Unix Makefiles', - coverage: 'false', + cc: "gcc-11", + cxx: "g++-11", + build-type: "Release", + build-code: "CentOS7", + generator: "Unix Makefiles", + coverage: "false", } steps: @@ -204,4 +204,4 @@ jobs: - name: Upload to S3 if: ${{ matrix.config.name == 'CentOS 7 - GCC' || runner.os == 'Windows' }} run: | - aws s3 cp build/${{ env.zip_name }} s3://cesium-travis-builds/cesium-omniverse/${{ env.branch }}/${{ env.us_date }}/${{ env.sha_short }}/${{ matrix.config.build-code }}/ + aws s3 cp build/${{ env.zip_name }} s3://cesium-builds/cesium-omniverse/${{ env.branch }}/${{ env.us_date }}/${{ env.sha_short }}/${{ matrix.config.build-code }}/ diff --git a/docs/release-guide/README.md b/docs/release-guide/README.md index ba28e06fc..3502d4dfe 100644 --- a/docs/release-guide/README.md +++ b/docs/release-guide/README.md @@ -4,7 +4,7 @@ This is the process we follow when releasing a new version of Cesium for Omniver 1. [Release a new version of Cesium for Omniverse Samples](#releasing-a-new-version-of-cesium-for-omniverse-samples). 3. Make sure the latest commit in `main` is passing CI. -4. Download the latest build from S3. In the AWS management console (old AWS account), go to the bucket [`cesium-travis-builds/cesium-omniverse/main`](https://s3.console.aws.amazon.com/s3/buckets/cesium-travis-builds?region=us-east-1&prefix=cesium-omniverse/main/&showversions=false), find the appropriate date and commit hash to download the CentOS and Windows zip files (e.g. `CesiumForOmniverse-Linux-xxxxxxx.zip` and `CesiumForOmniverse-Windows-xxxxxxx.zip`) +4. Download the latest build from S3. In the AWS management console (InternalServices AWS account), go to the bucket [`cesium-builds/cesium-omniverse/main`](https://s3.console.aws.amazon.com/s3/buckets/cesium-builds?region=us-east-1&prefix=cesium-omniverse/main/&showversions=false), find the appropriate date and commit hash to download the CentOS and Windows zip files (e.g. `CesiumForOmniverse-Linux-xxxxxxx.zip` and `CesiumForOmniverse-Windows-xxxxxxx.zip`) 5. Verify that the Linux package loads in USD Composer (see instructions below). 6. Verify that the Windows package loads in USD Composer (see instructions below). 7. Update the project `VERSION` in [CMakeLists.txt](../../CMakeLists.txt). @@ -18,7 +18,7 @@ This is the process we follow when releasing a new version of Cesium for Omniver 15. Tag the release, e.g. `git tag -a v0.0.0 -m "0.0.0 release"`. 16. Push the tag, e.g. `git push origin v0.0.0`. 17. Wait for CI to pass. -18. Download the latest build from S3. In the AWS management console (old AWS account), go to the bucket [`cesium-travis-builds/cesium-omniverse`](https://s3.console.aws.amazon.com/s3/buckets/cesium-travis-builds?prefix=cesium-omniverse/®ion=us-east-1), find the folder with the new tag and download the CentOS and Windows zip files (e.g. `CesiumForOmniverse-Linux-v0.0.0.zip` and `CesiumForOmniverse-Windows-v0.0.0.zip` ) +18. Download the latest build from S3. In the AWS management console (InternalServices AWS account), go to the bucket [`cesium-builds/cesium-omniverse`](https://s3.console.aws.amazon.com/s3/buckets/cesium-builds?prefix=cesium-omniverse/®ion=us-east-1), find the folder with the new tag and download the CentOS and Windows zip files (e.g. `CesiumForOmniverse-Linux-v0.0.0.zip` and `CesiumForOmniverse-Windows-v0.0.0.zip` ) 19. Create a new release on GitHub: https://github.com/CesiumGS/cesium-omniverse/releases/new. * Chose the new tag. * Copy the changelog into the description. Follow the format used in previous releases. From c5f94bc80e99194f731144ba83636a0c157341fc Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Fri, 15 Sep 2023 13:23:41 -0400 Subject: [PATCH 04/13] Update yaml formatting --- .github/actions/action.yml | 16 ++++++++-------- .vscode/cesium-omniverse-linux.code-workspace | 2 +- .vscode/cesium-omniverse-windows.code-workspace | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/actions/action.yml b/.github/actions/action.yml index 1261ecd44..a65e9e695 100644 --- a/.github/actions/action.yml +++ b/.github/actions/action.yml @@ -1,23 +1,23 @@ -name: 'CentOS 7 Build' -description: 'Build Cesium for Omniverse in Docker container running a CentOS 7 image' +name: "CentOS 7 Build" +description: "Build Cesium for Omniverse in Docker container running a CentOS 7 image" inputs: build-type: - description: 'Release or debug build' + description: "Release or debug build" required: true runs: - using: 'docker' - image: '../../docker/CI.Dockerfile' + using: "docker" + image: "../../docker/CI.Dockerfile" # Tell Conan to look for or create its build folder (.conan) in the repository's root directory env: CONAN_USER_HOME: $GITHUB_WORKSPACE args: # Tell bash to run a command - - '-c' + - "-c" # Parallel 2 because github action limited to two cores # Linters are turned off because there is no pre-compiled C++20-capable LLVM toolset for CentOS 7. It won't affect the build, it just means there won't be code formatting or linting. It will build fine with GCC. # Make sure to configure without sanitizers and any other development options - - 'cmake -B build -D CMAKE_BUILD_TYPE=${{ inputs.build-type }} -D CESIUM_OMNI_ENABLE_LINTERS=OFF -D CESIUM_OMNI_ENABLE_SANITIZERS=OFF && + - "cmake -B build -D CMAKE_BUILD_TYPE=${{ inputs.build-type }} -D CESIUM_OMNI_ENABLE_LINTERS=OFF -D CESIUM_OMNI_ENABLE_SANITIZERS=OFF && cmake --build build --parallel 2 && ctest --test-dir build --output-on-failure && cmake --build build --target install && - cmake --build build --target package' + cmake --build build --target package" diff --git a/.vscode/cesium-omniverse-linux.code-workspace b/.vscode/cesium-omniverse-linux.code-workspace index 9ae42a549..d339f3041 100644 --- a/.vscode/cesium-omniverse-linux.code-workspace +++ b/.vscode/cesium-omniverse-linux.code-workspace @@ -19,7 +19,7 @@ "editor.tabSize": 2, "editor.insertSpaces": true }, - "yaml.format.singleQuote": true, + "yaml.format.singleQuote": false, "files.associations": { "*.kit": "toml" }, diff --git a/.vscode/cesium-omniverse-windows.code-workspace b/.vscode/cesium-omniverse-windows.code-workspace index 30ecb548c..7f5c5de8d 100644 --- a/.vscode/cesium-omniverse-windows.code-workspace +++ b/.vscode/cesium-omniverse-windows.code-workspace @@ -19,7 +19,7 @@ "editor.tabSize": 2, "editor.insertSpaces": true }, - "yaml.format.singleQuote": true, + "yaml.format.singleQuote": false, "files.associations": { "*.kit": "toml" }, From a029d836d8ebd31fdef3da6238c7e9a32b1a60fa Mon Sep 17 00:00:00 2001 From: elser Date: Fri, 15 Sep 2023 17:34:21 -0400 Subject: [PATCH 05/13] address reviewer comments --- CMakeLists.txt | 3 +- cesiumTestsExtension/bindings/CMakeLists.txt | 1 - .../bindings/PythonBindings.cpp | 4 +- cesiumTestsExtension/bindings/pyboost11.h | 214 ------------------ cesiumTestsExtension/public/CesiumTests.cpp | 2 + exts/cesium.tests/cesium/tests/extension.py | 6 +- exts/cesium.tests/cesium/tests/test_window.py | 59 ----- .../cesium/tests/utils/__init__.py | 1 - exts/cesium.tests/cesium/tests/utils/utils.py | 58 ----- exts/cesium.tests/config/extension.toml | 12 +- exts/cesium.tests/doc/README.md | 8 +- 11 files changed, 19 insertions(+), 349 deletions(-) delete mode 100644 cesiumTestsExtension/bindings/pyboost11.h delete mode 100644 exts/cesium.tests/cesium/tests/test_window.py delete mode 100644 exts/cesium.tests/cesium/tests/utils/__init__.py delete mode 100644 exts/cesium.tests/cesium/tests/utils/utils.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 120b86aa5..33bf34127 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,8 @@ set(LINT_SOURCE_DIRECTORIES "${PROJECT_SOURCE_DIR}/src/bindings" "${PROJECT_SOURCE_DIR}/src/core" "${PROJECT_SOURCE_DIR}/src/public" - "${PROJECT_SOURCE_DIR}/tests") + "${PROJECT_SOURCE_DIR}/tests" + "${PROJECT_SOURCE_DIR}/cesiumTestsExtension") # Source directories for coverage set(COVERAGE_SOURCE_DIRECTORIES "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src") diff --git a/cesiumTestsExtension/bindings/CMakeLists.txt b/cesiumTestsExtension/bindings/CMakeLists.txt index 09afc8da0..ae0f64ed4 100644 --- a/cesiumTestsExtension/bindings/CMakeLists.txt +++ b/cesiumTestsExtension/bindings/CMakeLists.txt @@ -12,7 +12,6 @@ setup_python_module( SOURCES ${SOURCES} LIBRARIES - doctest::doctest cesium.omniverse.tests.plugin CXX_FLAGS ${CESIUM_OMNI_CXX_FLAGS} diff --git a/cesiumTestsExtension/bindings/PythonBindings.cpp b/cesiumTestsExtension/bindings/PythonBindings.cpp index b4bed21c4..c52d03cc2 100644 --- a/cesiumTestsExtension/bindings/PythonBindings.cpp +++ b/cesiumTestsExtension/bindings/PythonBindings.cpp @@ -1,6 +1,7 @@ -#include #include "CesiumTests.h" +#include + // NOLINTNEXTLINE CARB_BINDINGS("cesium.tests.python") DISABLE_PYBIND11_DYNAMIC_CAST(cesium::omniverse::tests::ICesiumOmniverseTestsInterface) @@ -16,5 +17,4 @@ PYBIND11_MODULE(CesiumOmniverseTestsPythonBindings, m) { m, "ICesiumOmniverseTestsInterface", "acquire_cesium_omniverse_tests_interface", "release_cesium_omniverse_tests_interface") .def("run_all_tests", &ICesiumOmniverseTestsInterface::run_all_tests); // clang-format on - } diff --git a/cesiumTestsExtension/bindings/pyboost11.h b/cesiumTestsExtension/bindings/pyboost11.h deleted file mode 100644 index 9a3e8634b..000000000 --- a/cesiumTestsExtension/bindings/pyboost11.h +++ /dev/null @@ -1,214 +0,0 @@ -// From https://yyc.solvcon.net/en/latest/writing/2021/pyboost11/code.html - -// clang-format off -/* - * Copyright (c) 2021, Yung-Yu Chen - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#pragma once - -#include - -#ifdef CESIUM_OMNI_GCC - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wmissing-field-initializers" - #pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -#include - -#ifdef CESIUM_OMNI_GCC - #pragma GCC diagnostic pop -#endif - -namespace pyboost11 -{ - -// Pybind11 cast by using boost.python. -template struct caster -{ - - caster(pybind11::handle src) - : obj(boost::python::handle<>(boost::python::borrowed(src.ptr()))) - , ext(obj) - {} - - bool check() const { return ext.check(); } - - // From-Python conversion. - operator T() { return ext(); } - T operator()() { return ext(); } - - // To-Python conversion. - static pybind11::handle to_python(T & src) - { - namespace bpy = boost::python; - return bpy::incref(bpy::object(src).ptr()); - } - - boost::python::object obj; - boost::python::extract ext; - -}; - -} // end namespace pyboost11 - -namespace pybind11 -{ - -namespace detail -{ - -template struct pyboost11_type_caster -{ - -// Expanded from PYBIND11_TYPE_CASTER. -protected: - type value; -public: - template >::value, int> = 0> - static handle cast(T_ *src, return_value_policy policy, handle parent) { - if (!src) return none().release(); - if (policy == return_value_policy::take_ownership) { - auto h = cast(std::move(*src), policy, parent); delete src; return h; - } else { - return cast(*src, policy, parent); - } - } - operator type*() { return &value; } - operator type&() { return value; } - operator type&&() && { return std::move(value); } - template using cast_op_type = pybind11::detail::movable_cast_op_type; - - // Boilerplate. - bool load(handle src, bool) - { - if (!src) - { - return false; - } - pyboost11::caster ext(src); - if (!ext.check()) - { - return false; - } - value = ext(); - return true; - } - static handle cast(type * src, return_value_policy /* policy */, handle /* parent */) - { - return pyboost11::caster::to_python(src); - } - static handle cast(type src, return_value_policy /* policy */, handle /* parent */) - { - return pyboost11::caster::to_python(src); - } - -}; - -#define PYBOOST11_TYPE_CASTER(type, py_name) \ - template <> struct type_caster : public pyboost11_type_caster \ - { static constexpr auto name = py_name; } - -} // end namespace detail - -} // end namespace pybind11 - -namespace pyboost11 -{ - -// Boost.python convert by using pybind11. -template struct converter -{ - -public: - - converter() { init(); } - - void init() - { - static bool initialized = false; - if (!initialized) - { - namespace bpy = boost::python; - // From-Python conversion. - bpy::converter::registry::push_back - ( - &convertible - , &construct - , bpy::type_id() - ); - // To-Python conversion. - bpy::to_python_converter(); - - initialized = true; - } - } - - // From-Python convertibility. - static void * convertible(PyObject * objptr) - { - namespace pyb = pybind11; - try - { - pyb::handle(objptr).cast(); - return objptr; - } - catch (pyb::cast_error const &) - { - return nullptr; - } - } - - // From-Python conversion. - static void construct - ( - PyObject * objptr - , boost::python::converter::rvalue_from_python_stage1_data * data - ) - { - namespace pyb = pybind11; - void * storage = reinterpret_cast - < - boost::python::converter::rvalue_from_python_storage * - >(data)->storage.bytes; - new (storage) T(pyb::handle(objptr).cast()); - data->convertible = storage; - } - - // To-Python conversion. - static PyObject * convert(T const & t) - { - return pybind11::cast(t).inc_ref().ptr(); - } - -}; - -} // end namespace pyboost11 - -// vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: -// clang-format on diff --git a/cesiumTestsExtension/public/CesiumTests.cpp b/cesiumTestsExtension/public/CesiumTests.cpp index 942cf3308..dd78c4311 100644 --- a/cesiumTestsExtension/public/CesiumTests.cpp +++ b/cesiumTestsExtension/public/CesiumTests.cpp @@ -6,6 +6,8 @@ #include "CesiumTests.h" #include "cesium/omniverse/Context.h" +#include "cesium/omniverse/LoggerSink.h" +#include "cesium/omniverse/UsdUtil.h" #include #include diff --git a/exts/cesium.tests/cesium/tests/extension.py b/exts/cesium.tests/cesium/tests/extension.py index b4aa02033..c5b5362a2 100644 --- a/exts/cesium.tests/cesium/tests/extension.py +++ b/exts/cesium.tests/cesium/tests/extension.py @@ -1,4 +1,5 @@ import omni.ext +import omni.usd import omni.kit.ui from .bindings import acquire_cesium_omniverse_tests_interface, release_cesium_omniverse_tests_interface @@ -13,7 +14,10 @@ def on_startup(self): global tests_interface tests_interface = acquire_cesium_omniverse_tests_interface() - tests_interface.run_all_tests(0) + # TODO ensure the stage has been set up before getting stage id + stageId = omni.usd.get_context().get_stage_id() + + tests_interface.run_all_tests(stageId) print("Started Cesium Tests Extension.") diff --git a/exts/cesium.tests/cesium/tests/test_window.py b/exts/cesium.tests/cesium/tests/test_window.py deleted file mode 100644 index ab27c947c..000000000 --- a/exts/cesium.tests/cesium/tests/test_window.py +++ /dev/null @@ -1,59 +0,0 @@ -import logging -import omni.ui as ui -from typing import Callable, Optional, List -from cesium.omniverse.ui import CesiumOmniverseDebugWindow -from .utils import extend_far_plane, save_carb_settings -import os -from functools import partial - -powertools_extension_location = os.path.join(os.path.dirname(__file__), "../../") - - -class PowertoolsAction: - def __init__(self, title: str, action: Callable): - self._title = title - self._action = action - self._button: Optional[ui.Button] = None - - def destroy(self): - if self._button is not None: - self._button.destroy() - self._button = None - - def button(self): - if self._button is None: - self._button = ui.Button(self._title, height=0, clicked_fn=self._action) - - return self._button - - -class CesiumPowertoolsWindow(ui.Window): - WINDOW_NAME = "Cesium Test" - MENU_PATH = f"Window/Cesium/{WINDOW_NAME}" - - def __init__(self, **kwargs): - super().__init__(CesiumPowertoolsWindow.WINDOW_NAME, **kwargs) - - self._logger = logging.getLogger(__name__) - - # You do not necessarily need to create an action function in this window class. If you have a function - # in another window or class, you can absolutely call that instead from here. - self._actions: List[PowertoolsAction] = [ - PowertoolsAction("Open Cesium Debugging Window", CesiumOmniverseDebugWindow.show_window), - PowertoolsAction("Extend Far Plane", extend_far_plane), - PowertoolsAction("Save Carb Settings", partial(save_carb_settings, powertools_extension_location)), - ] - - self.frame.set_build_fn(self._build_fn) - - def destroy(self) -> None: - for action in self._actions: - action.destroy() - self._actions.clear() - - super().destroy() - - def _build_fn(self): - with ui.VStack(spacing=4): - for action in self._actions: - action.button() diff --git a/exts/cesium.tests/cesium/tests/utils/__init__.py b/exts/cesium.tests/cesium/tests/utils/__init__.py deleted file mode 100644 index 91d2b0830..000000000 --- a/exts/cesium.tests/cesium/tests/utils/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .utils import * # noqa: F401 F403 diff --git a/exts/cesium.tests/cesium/tests/utils/utils.py b/exts/cesium.tests/cesium/tests/utils/utils.py deleted file mode 100644 index c1b094a91..000000000 --- a/exts/cesium.tests/cesium/tests/utils/utils.py +++ /dev/null @@ -1,58 +0,0 @@ -import omni.usd -from omni.kit.viewport.utility import get_active_viewport -from pxr import Gf, UsdGeom, Sdf -import json -import carb.settings -import os - - -# Modified version of ScopedEdit in _build_viewport_cameras in omni.kit.widget.viewport -class ScopedEdit: - def __init__(self, stage): - self.__stage = stage - edit_target = stage.GetEditTarget() - edit_layer = edit_target.GetLayer() - self.__edit_layer = stage.GetSessionLayer() - self.__was_editable = self.__edit_layer.permissionToEdit - if not self.__was_editable: - self.__edit_layer.SetPermissionToEdit(True) - if self.__edit_layer != edit_layer: - stage.SetEditTarget(self.__edit_layer) - self.__edit_target = edit_target - else: - self.__edit_target = None - - def __del__(self): - if self.__edit_layer and not self.__was_editable: - self.__edit_layer.SetPermissionToEdit(False) - self.__edit_layer = None - - if self.__edit_target: - self.__stage.SetEditTarget(self.__edit_target) - self.__edit_target = None - - -def extend_far_plane(): - stage = omni.usd.get_context().get_stage() - viewport = get_active_viewport() - camera_path = viewport.get_active_camera() - camera = UsdGeom.Camera.Get(stage, camera_path) - assert camera.GetPrim().IsValid() - - scoped_edit = ScopedEdit(stage) # noqa: F841 - camera.GetClippingRangeAttr().Set(Gf.Vec2f(1.0, 10000000000.0)) - - -def save_carb_settings(powertools_extension_location: str): - carb_settings_path = os.path.join(powertools_extension_location, "carb_settings.txt") - with open(carb_settings_path, "w") as fh: - fh.write(json.dumps(carb.settings.get_settings().get("/"), indent=2)) - - -# Helper function to search for an attribute on a prim, or create it if not present -def get_or_create_attribute(prim, name, type): - attribute = prim.GetAttribute(name) - if not attribute: - attribute = prim.CreateAttribute(name, type) - return attribute - diff --git a/exts/cesium.tests/config/extension.toml b/exts/cesium.tests/config/extension.toml index 69618eec9..a3a1ab030 100644 --- a/exts/cesium.tests/config/extension.toml +++ b/exts/cesium.tests/config/extension.toml @@ -3,7 +3,7 @@ version = "0.1.0" category = "simulation" feature = false app = false -title = "Cesium for Omniverse Test" +title = "Cesium for Omniverse Tests" description = "An extention to run tests against Cesium for Omniverse." authors = "Cesium GS Inc." repository = "https://github.com/CesiumGS/cesium-omniverse" @@ -16,9 +16,14 @@ keywords = [ "globe", "earth", "simulation", - "test" + "test", ] +# Paths are relative to the extension folder +readme = "doc/README.md" +icon = "doc/resources/icon.png" +preview_image = "doc/resources/icon.png" + [[native.plugin]] path = "bin/cesium.omniverse.tests.plugin" @@ -28,6 +33,3 @@ icon = "doc/resources/icon.png" [[python.module]] name = "cesium.tests" - -[python.pipapi] -archiveDirs = ["vendor"] diff --git a/exts/cesium.tests/doc/README.md b/exts/cesium.tests/doc/README.md index da33efff1..05aa5aa8f 100644 --- a/exts/cesium.tests/doc/README.md +++ b/exts/cesium.tests/doc/README.md @@ -1,13 +1,7 @@ -# Cesium for Omniverse Test Extension +# Cesium for Omniverse Tests Extension This extension is designed to run tests against the Cesium for Omniverse Extension. - -## Current Features - -### TODO list features - - ## License Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html). Cesium for Omniverse is free for both commercial and non-commercial use. From b037e73b16e233004239c69807772a3a106a7447 Mon Sep 17 00:00:00 2001 From: brianwthomas Date: Wed, 20 Sep 2023 09:20:09 -0700 Subject: [PATCH 06/13] updateing the workspace back to original looks like vscode auto updated --- .vscode/cesium-omniverse-linux.code-workspace | 2 +- .vscode/cesium-omniverse-windows.code-workspace | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/cesium-omniverse-linux.code-workspace b/.vscode/cesium-omniverse-linux.code-workspace index d339f3041..9ae42a549 100644 --- a/.vscode/cesium-omniverse-linux.code-workspace +++ b/.vscode/cesium-omniverse-linux.code-workspace @@ -19,7 +19,7 @@ "editor.tabSize": 2, "editor.insertSpaces": true }, - "yaml.format.singleQuote": false, + "yaml.format.singleQuote": true, "files.associations": { "*.kit": "toml" }, diff --git a/.vscode/cesium-omniverse-windows.code-workspace b/.vscode/cesium-omniverse-windows.code-workspace index 7f5c5de8d..30ecb548c 100644 --- a/.vscode/cesium-omniverse-windows.code-workspace +++ b/.vscode/cesium-omniverse-windows.code-workspace @@ -19,7 +19,7 @@ "editor.tabSize": 2, "editor.insertSpaces": true }, - "yaml.format.singleQuote": false, + "yaml.format.singleQuote": true, "files.associations": { "*.kit": "toml" }, From 01efc41a70ec1dff5decfc82c76e99b1d3c56da2 Mon Sep 17 00:00:00 2001 From: brianwthomas Date: Wed, 20 Sep 2023 09:29:58 -0700 Subject: [PATCH 07/13] Readding the double quote change back --- .vscode/cesium-omniverse-linux.code-workspace | 2 +- .vscode/cesium-omniverse-windows.code-workspace | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/cesium-omniverse-linux.code-workspace b/.vscode/cesium-omniverse-linux.code-workspace index 9ae42a549..d339f3041 100644 --- a/.vscode/cesium-omniverse-linux.code-workspace +++ b/.vscode/cesium-omniverse-linux.code-workspace @@ -19,7 +19,7 @@ "editor.tabSize": 2, "editor.insertSpaces": true }, - "yaml.format.singleQuote": true, + "yaml.format.singleQuote": false, "files.associations": { "*.kit": "toml" }, diff --git a/.vscode/cesium-omniverse-windows.code-workspace b/.vscode/cesium-omniverse-windows.code-workspace index 30ecb548c..7f5c5de8d 100644 --- a/.vscode/cesium-omniverse-windows.code-workspace +++ b/.vscode/cesium-omniverse-windows.code-workspace @@ -19,7 +19,7 @@ "editor.tabSize": 2, "editor.insertSpaces": true }, - "yaml.format.singleQuote": true, + "yaml.format.singleQuote": false, "files.associations": { "*.kit": "toml" }, From 06387cc57475e39f0b7592e4eadb92dd25d3c553 Mon Sep 17 00:00:00 2001 From: elser Date: Tue, 26 Sep 2023 11:12:41 -0400 Subject: [PATCH 08/13] WIP renaming, currently works --- .gitignore | 6 +++--- .vscode/launch.linux.json | 4 ++-- CMakeLists.txt | 5 +++-- ....tests.kit => cesium.omniverse.tests.runner.kit} | 0 cesiumTestsExtension/bindings/PythonBindings.cpp | 6 ++++-- cesiumTestsExtension/public/CesiumTests.cpp | 8 ++++++-- .../cesium/omniverse}/tests/__init__.py | 0 .../bindings/CesiumOmniverseTestsPythonBindings.pyi | 10 ++++++++++ .../cesium/omniverse}/tests/bindings/__init__.py | 0 .../cesium/omniverse}/tests/extension.py | 0 .../bindings/CesiumOmniverseTestsPythonBindings.pyi | 10 ++++++++++ .../config/extension.toml | 2 +- .../doc/README.md | 0 .../doc/resources/icon.png | Bin .../bindings/CesiumOmniverseTestsPythonBindings.pyi | 10 ++++++++++ genStubs.bat | 2 +- genStubs.sh | 2 +- 17 files changed, 51 insertions(+), 14 deletions(-) rename apps/{cesium.omniverse.tests.kit => cesium.omniverse.tests.runner.kit} (100%) rename exts/{cesium.tests/cesium => cesium.omniverse.tests/cesium/omniverse}/tests/__init__.py (100%) create mode 100644 exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi rename exts/{cesium.tests/cesium => cesium.omniverse.tests/cesium/omniverse}/tests/bindings/__init__.py (100%) rename exts/{cesium.tests/cesium => cesium.omniverse.tests/cesium/omniverse}/tests/extension.py (100%) create mode 100644 exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi rename exts/{cesium.tests => cesium.omniverse.tests}/config/extension.toml (95%) rename exts/{cesium.tests => cesium.omniverse.tests}/doc/README.md (100%) rename exts/{cesium.tests => cesium.omniverse.tests}/doc/resources/icon.png (100%) create mode 100644 exts/cesium.omniverse.unittests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi diff --git a/.gitignore b/.gitignore index ec41d9f9f..00f4bbde6 100644 --- a/.gitignore +++ b/.gitignore @@ -46,13 +46,13 @@ exts/cesium.omniverse/cesium/omniverse/bindings/CesiumOmniversePythonBindings.cp exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.so exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.pyd exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.lib -exts/cesium.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.cpython-310-x86_64-linux-gnu.so -exts/cesium.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.cp310-win_amd64.pyd +exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.cpython-310-x86_64-linux-gnu.so +exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.cp310-win_amd64.pyd # Installed libraries exts/cesium.omniverse/bin/ exts/cesium.usd.plugins/bin/ -exts/cesium.tests/bin/ +exts/cesium.omniverse.tests/bin/ # Installed plugins exts/cesium.usd.plugins/plugins/ diff --git a/.vscode/launch.linux.json b/.vscode/launch.linux.json index 62c54e5e5..ef5c61aea 100644 --- a/.vscode/launch.linux.json +++ b/.vscode/launch.linux.json @@ -34,7 +34,7 @@ "preLaunchTask": "Build Only (debug)", "program": "${workspaceFolder}/extern/nvidia/_build/target-deps/kit-sdk/kit", "args": [ - "${workspaceFolder}/apps/cesium.omniverse.tests.kit" + "${workspaceFolder}/apps/cesium.omniverse.tests.runner.kit" ], "env": { // Disable LSAN when debugging since it doesn't work with GDB and prints harmless but annoying warning messages @@ -202,4 +202,4 @@ "host": "localhost" } ] -} +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 33bf34127..7b5e81d43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -513,8 +513,9 @@ set(KIT_EXTENSION_BINDINGS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse/ces set(KIT_PLUGIN_EXTENSION_BINDINGS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.usd.plugins/cesium/usd/plugins") set(KIT_EXTENSION_PLUGINS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.usd.plugins/plugins") -set(KIT_EXTENSION_TESTS_BIN_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.tests/bin") -set(KIT_EXTENSION_TESTS_BINDINGS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.tests/cesium/tests/bindings") +set(KIT_EXTENSION_TESTS_BIN_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse.tests/bin") +set(KIT_EXTENSION_TESTS_BINDINGS_PATH + "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings") # You may see warnings like: # diff --git a/apps/cesium.omniverse.tests.kit b/apps/cesium.omniverse.tests.runner.kit similarity index 100% rename from apps/cesium.omniverse.tests.kit rename to apps/cesium.omniverse.tests.runner.kit diff --git a/cesiumTestsExtension/bindings/PythonBindings.cpp b/cesiumTestsExtension/bindings/PythonBindings.cpp index c52d03cc2..9a5fb83de 100644 --- a/cesiumTestsExtension/bindings/PythonBindings.cpp +++ b/cesiumTestsExtension/bindings/PythonBindings.cpp @@ -3,7 +3,7 @@ #include // NOLINTNEXTLINE -CARB_BINDINGS("cesium.tests.python") +CARB_BINDINGS("cesium.omniverse.tests.python") DISABLE_PYBIND11_DYNAMIC_CAST(cesium::omniverse::tests::ICesiumOmniverseTestsInterface) PYBIND11_MODULE(CesiumOmniverseTestsPythonBindings, m) { @@ -15,6 +15,8 @@ PYBIND11_MODULE(CesiumOmniverseTestsPythonBindings, m) { // clang-format off carb::defineInterfaceClass( m, "ICesiumOmniverseTestsInterface", "acquire_cesium_omniverse_tests_interface", "release_cesium_omniverse_tests_interface") - .def("run_all_tests", &ICesiumOmniverseTestsInterface::run_all_tests); + .def("run_all_tests", &ICesiumOmniverseTestsInterface::run_all_tests) + .def("on_startup", &ICesiumOmniverseTestsInterface::onStartup) + .def("on_shutdown", &ICesiumOmniverseTestsInterface::onShutdown); // clang-format on } diff --git a/cesiumTestsExtension/public/CesiumTests.cpp b/cesiumTestsExtension/public/CesiumTests.cpp index dd78c4311..e2116c65b 100644 --- a/cesiumTestsExtension/public/CesiumTests.cpp +++ b/cesiumTestsExtension/public/CesiumTests.cpp @@ -84,8 +84,12 @@ class CesiumOmniverseTestsPlugin final : public ICesiumOmniverseTestsInterface { } // namespace cesium::omniverse::tests -const struct carb::PluginImplDesc pluginImplDesc = - {"cesium.tests.plugin", "Cesium Omniverse Tests Plugin.", "Cesium", carb::PluginHotReload::eDisabled, "dev"}; +const struct carb::PluginImplDesc pluginImplDesc = { + "cesium.omniverse.tests.plugin", + "Cesium Omniverse Tests Plugin.", + "Cesium", + carb::PluginHotReload::eDisabled, + "dev"}; // NOLINTBEGIN CARB_PLUGIN_IMPL(pluginImplDesc, cesium::omniverse::tests::CesiumOmniverseTestsPlugin) diff --git a/exts/cesium.tests/cesium/tests/__init__.py b/exts/cesium.omniverse.tests/cesium/omniverse/tests/__init__.py similarity index 100% rename from exts/cesium.tests/cesium/tests/__init__.py rename to exts/cesium.omniverse.tests/cesium/omniverse/tests/__init__.py diff --git a/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi b/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi new file mode 100644 index 000000000..345d0d9f9 --- /dev/null +++ b/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi @@ -0,0 +1,10 @@ +class ICesiumOmniverseTestsInterface: + def __init__(self, *args, **kwargs) -> None: ... + def on_shutdown(self) -> None: ... + def on_startup(self, arg0: str) -> None: ... + def run_all_tests(self, arg0: int) -> None: ... + +def acquire_cesium_omniverse_tests_interface( + plugin_name: str = ..., library_path: str = ... +) -> ICesiumOmniverseTestsInterface: ... +def release_cesium_omniverse_tests_interface(arg0: ICesiumOmniverseTestsInterface) -> None: ... diff --git a/exts/cesium.tests/cesium/tests/bindings/__init__.py b/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/__init__.py similarity index 100% rename from exts/cesium.tests/cesium/tests/bindings/__init__.py rename to exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/__init__.py diff --git a/exts/cesium.tests/cesium/tests/extension.py b/exts/cesium.omniverse.tests/cesium/omniverse/tests/extension.py similarity index 100% rename from exts/cesium.tests/cesium/tests/extension.py rename to exts/cesium.omniverse.tests/cesium/omniverse/tests/extension.py diff --git a/exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi b/exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi new file mode 100644 index 000000000..345d0d9f9 --- /dev/null +++ b/exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi @@ -0,0 +1,10 @@ +class ICesiumOmniverseTestsInterface: + def __init__(self, *args, **kwargs) -> None: ... + def on_shutdown(self) -> None: ... + def on_startup(self, arg0: str) -> None: ... + def run_all_tests(self, arg0: int) -> None: ... + +def acquire_cesium_omniverse_tests_interface( + plugin_name: str = ..., library_path: str = ... +) -> ICesiumOmniverseTestsInterface: ... +def release_cesium_omniverse_tests_interface(arg0: ICesiumOmniverseTestsInterface) -> None: ... diff --git a/exts/cesium.tests/config/extension.toml b/exts/cesium.omniverse.tests/config/extension.toml similarity index 95% rename from exts/cesium.tests/config/extension.toml rename to exts/cesium.omniverse.tests/config/extension.toml index a3a1ab030..354585caf 100644 --- a/exts/cesium.tests/config/extension.toml +++ b/exts/cesium.omniverse.tests/config/extension.toml @@ -32,4 +32,4 @@ readme = "doc/README.md" icon = "doc/resources/icon.png" [[python.module]] -name = "cesium.tests" +name = "cesium.omniverse.tests" diff --git a/exts/cesium.tests/doc/README.md b/exts/cesium.omniverse.tests/doc/README.md similarity index 100% rename from exts/cesium.tests/doc/README.md rename to exts/cesium.omniverse.tests/doc/README.md diff --git a/exts/cesium.tests/doc/resources/icon.png b/exts/cesium.omniverse.tests/doc/resources/icon.png similarity index 100% rename from exts/cesium.tests/doc/resources/icon.png rename to exts/cesium.omniverse.tests/doc/resources/icon.png diff --git a/exts/cesium.omniverse.unittests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi b/exts/cesium.omniverse.unittests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi new file mode 100644 index 000000000..345d0d9f9 --- /dev/null +++ b/exts/cesium.omniverse.unittests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi @@ -0,0 +1,10 @@ +class ICesiumOmniverseTestsInterface: + def __init__(self, *args, **kwargs) -> None: ... + def on_shutdown(self) -> None: ... + def on_startup(self, arg0: str) -> None: ... + def run_all_tests(self, arg0: int) -> None: ... + +def acquire_cesium_omniverse_tests_interface( + plugin_name: str = ..., library_path: str = ... +) -> ICesiumOmniverseTestsInterface: ... +def release_cesium_omniverse_tests_interface(arg0: ICesiumOmniverseTestsInterface) -> None: ... diff --git a/genStubs.bat b/genStubs.bat index 8767cc482..3eac5e05e 100644 --- a/genStubs.bat +++ b/genStubs.bat @@ -18,7 +18,7 @@ set NVIDIA_PYTHON_EXECUTABLE=%NVIDIA_PYTHON_ROOT%\python.exe set FLAT_LIBRARIES_DIR=%TEMP%\CesiumOmniverseFlatLibs set CESIUM_OMNI_STUB_PATH=%PROJECT_ROOT%\exts\cesium.omniverse\cesium\omniverse\bindings\CesiumOmniversePythonBindings.pyi set CESIUM_USD_STUB_PATH=%PROJECT_ROOT%\exts\cesium.usd.plugins\cesium\usd\plugins\CesiumUsdSchemas\__init__.pyi -set CESIUM_TESTS_STUB_PATH=%PROJECT_ROOT%\exts\cesium.tests\cesium\tests\bindings\CesiumOmniverseTestsPythonBindings.pyi +set CESIUM_TESTS_STUB_PATH=%PROJECT_ROOT%\exts\cesium.omniverse.tests\cesium\tests\bindings\CesiumOmniverseTestsPythonBindings.pyi set PYTHONPATH=%NVIDIA_USD_PYTHON_LIBS%;%PYTHONPATH% diff --git a/genStubs.sh b/genStubs.sh index 5b228637b..cfc2ff664 100755 --- a/genStubs.sh +++ b/genStubs.sh @@ -18,7 +18,7 @@ NVIDIA_PYTHON_EXECUTABLE=$NVIDIA_PYTHON_ROOT/python FLAT_LIBRARIES_DIR="/tmp/CesiumOmniverseFlatLibs" CESIUM_OMNI_STUB_PATH="$PROJECT_ROOT/exts/cesium.omniverse/cesium/omniverse/bindings/CesiumOmniversePythonBindings.pyi" CESIUM_USD_STUB_PATH="$PROJECT_ROOT/exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/__init__.pyi" -CESIUM_TESTS_STUB_PATH="$PROJECT_ROOT/exts/cesium.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi" +CESIUM_TESTS_STUB_PATH="$PROJECT_ROOT/exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi" export PYTHONPATH="$NVIDIA_USD_PYTHON_LIBS:$PYTHONPATH" From 779644223a08c7529d745ec9d97ff64882b96d8d Mon Sep 17 00:00:00 2001 From: elser Date: Tue, 26 Sep 2023 15:54:37 -0400 Subject: [PATCH 09/13] re-renaming to include cpp specifier --- .gitignore | 6 +++--- .vscode/launch.linux.json | 2 +- CMakeLists.txt | 8 ++++---- ...er.kit => cesium.omniverse.cpp.tests.runner.kit} | 2 +- .../CMakeLists.txt | 0 .../bindings/CMakeLists.txt | 0 .../bindings/PythonBindings.cpp | 2 +- .../include/CesiumOmniverseCppTests.h | 0 .../public/CMakeLists.txt | 2 +- .../public/CesiumOmniverseCppTests.cpp | 2 +- .../cesium/omniverse/cpp}/tests/__init__.py | 0 .../omniverse/cpp}/tests/bindings/__init__.py | 0 .../cesium/omniverse/cpp}/tests/extension.py | 2 +- .../config/extension.toml | 4 ++-- .../doc/README.md | 0 .../doc/resources/icon.png | Bin .../bindings/CesiumOmniverseTestsPythonBindings.pyi | 10 ---------- .../bindings/CesiumOmniverseTestsPythonBindings.pyi | 10 ---------- .../bindings/CesiumOmniverseTestsPythonBindings.pyi | 10 ---------- genStubs.bat | 6 +++--- genStubs.sh | 6 +++--- 21 files changed, 21 insertions(+), 51 deletions(-) rename apps/{cesium.omniverse.tests.runner.kit => cesium.omniverse.cpp.tests.runner.kit} (94%) rename {cesiumTestsExtension => cesiumOmniverseCppTestsExtension}/CMakeLists.txt (100%) rename {cesiumTestsExtension => cesiumOmniverseCppTestsExtension}/bindings/CMakeLists.txt (100%) rename {cesiumTestsExtension => cesiumOmniverseCppTestsExtension}/bindings/PythonBindings.cpp (96%) rename cesiumTestsExtension/include/CesiumTests.h => cesiumOmniverseCppTestsExtension/include/CesiumOmniverseCppTests.h (100%) rename {cesiumTestsExtension => cesiumOmniverseCppTestsExtension}/public/CMakeLists.txt (92%) rename cesiumTestsExtension/public/CesiumTests.cpp => cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp (98%) rename exts/{cesium.omniverse.tests/cesium/omniverse => cesium.omniverse.cpp.tests/cesium/omniverse/cpp}/tests/__init__.py (100%) rename exts/{cesium.omniverse.tests/cesium/omniverse => cesium.omniverse.cpp.tests/cesium/omniverse/cpp}/tests/bindings/__init__.py (100%) rename exts/{cesium.omniverse.tests/cesium/omniverse => cesium.omniverse.cpp.tests/cesium/omniverse/cpp}/tests/extension.py (93%) rename exts/{cesium.omniverse.tests => cesium.omniverse.cpp.tests}/config/extension.toml (89%) rename exts/{cesium.omniverse.tests => cesium.omniverse.cpp.tests}/doc/README.md (100%) rename exts/{cesium.omniverse.tests => cesium.omniverse.cpp.tests}/doc/resources/icon.png (100%) delete mode 100644 exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi delete mode 100644 exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi delete mode 100644 exts/cesium.omniverse.unittests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi diff --git a/.gitignore b/.gitignore index 00f4bbde6..fb6d34ef0 100644 --- a/.gitignore +++ b/.gitignore @@ -46,13 +46,13 @@ exts/cesium.omniverse/cesium/omniverse/bindings/CesiumOmniversePythonBindings.cp exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.so exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.pyd exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/_CesiumUsdSchemas.lib -exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.cpython-310-x86_64-linux-gnu.so -exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.cp310-win_amd64.pyd +exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/CesiumOmniverseCppTestsPythonBindings.cpython-310-x86_64-linux-gnu.so +exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/CesiumOmniverseCppTestsPythonBindings.cp310-win_amd64.pyd # Installed libraries exts/cesium.omniverse/bin/ exts/cesium.usd.plugins/bin/ -exts/cesium.omniverse.tests/bin/ +exts/cesium.omniverse.cpp.tests/bin/ # Installed plugins exts/cesium.usd.plugins/plugins/ diff --git a/.vscode/launch.linux.json b/.vscode/launch.linux.json index ef5c61aea..ef30718b5 100644 --- a/.vscode/launch.linux.json +++ b/.vscode/launch.linux.json @@ -34,7 +34,7 @@ "preLaunchTask": "Build Only (debug)", "program": "${workspaceFolder}/extern/nvidia/_build/target-deps/kit-sdk/kit", "args": [ - "${workspaceFolder}/apps/cesium.omniverse.tests.runner.kit" + "${workspaceFolder}/apps/cesium.omniverse.cpp.tests.runner.kit" ], "env": { // Disable LSAN when debugging since it doesn't work with GDB and prints harmless but annoying warning messages diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b5e81d43..ce5558da7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,7 +122,7 @@ set(LINT_SOURCE_DIRECTORIES "${PROJECT_SOURCE_DIR}/src/core" "${PROJECT_SOURCE_DIR}/src/public" "${PROJECT_SOURCE_DIR}/tests" - "${PROJECT_SOURCE_DIR}/cesiumTestsExtension") + "${PROJECT_SOURCE_DIR}/cesiumOmniverseCppTestsExtension") # Source directories for coverage set(COVERAGE_SOURCE_DIRECTORIES "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src") @@ -438,7 +438,7 @@ add_subdirectory(src) if(CESIUM_OMNI_ENABLE_TESTS) enable_testing() add_subdirectory(tests) - add_subdirectory(cesiumTestsExtension) + add_subdirectory(cesiumOmniverseCppTestsExtension) endif() # Ninja and various Makefiles generators support generating compile_commands.json @@ -513,9 +513,9 @@ set(KIT_EXTENSION_BINDINGS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse/ces set(KIT_PLUGIN_EXTENSION_BINDINGS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.usd.plugins/cesium/usd/plugins") set(KIT_EXTENSION_PLUGINS_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.usd.plugins/plugins") -set(KIT_EXTENSION_TESTS_BIN_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse.tests/bin") +set(KIT_EXTENSION_TESTS_BIN_PATH "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse.cpp.tests/bin") set(KIT_EXTENSION_TESTS_BINDINGS_PATH - "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings") + "${PROJECT_SOURCE_DIR}/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings") # You may see warnings like: # diff --git a/apps/cesium.omniverse.tests.runner.kit b/apps/cesium.omniverse.cpp.tests.runner.kit similarity index 94% rename from apps/cesium.omniverse.tests.runner.kit rename to apps/cesium.omniverse.cpp.tests.runner.kit index 2834f40fd..c643511ca 100644 --- a/apps/cesium.omniverse.tests.runner.kit +++ b/apps/cesium.omniverse.cpp.tests.runner.kit @@ -5,7 +5,7 @@ app = true [dependencies] "cesium.omniverse.dev" = {} -"cesium.tests" = {} +"cesium.omniverse.tests" = {} [settings] app.window.title = "Cesium for Omniverse Tests App" diff --git a/cesiumTestsExtension/CMakeLists.txt b/cesiumOmniverseCppTestsExtension/CMakeLists.txt similarity index 100% rename from cesiumTestsExtension/CMakeLists.txt rename to cesiumOmniverseCppTestsExtension/CMakeLists.txt diff --git a/cesiumTestsExtension/bindings/CMakeLists.txt b/cesiumOmniverseCppTestsExtension/bindings/CMakeLists.txt similarity index 100% rename from cesiumTestsExtension/bindings/CMakeLists.txt rename to cesiumOmniverseCppTestsExtension/bindings/CMakeLists.txt diff --git a/cesiumTestsExtension/bindings/PythonBindings.cpp b/cesiumOmniverseCppTestsExtension/bindings/PythonBindings.cpp similarity index 96% rename from cesiumTestsExtension/bindings/PythonBindings.cpp rename to cesiumOmniverseCppTestsExtension/bindings/PythonBindings.cpp index 9a5fb83de..6e9aa3bf8 100644 --- a/cesiumTestsExtension/bindings/PythonBindings.cpp +++ b/cesiumOmniverseCppTestsExtension/bindings/PythonBindings.cpp @@ -1,4 +1,4 @@ -#include "CesiumTests.h" +#include "CesiumOmniverseTests.h" #include diff --git a/cesiumTestsExtension/include/CesiumTests.h b/cesiumOmniverseCppTestsExtension/include/CesiumOmniverseCppTests.h similarity index 100% rename from cesiumTestsExtension/include/CesiumTests.h rename to cesiumOmniverseCppTestsExtension/include/CesiumOmniverseCppTests.h diff --git a/cesiumTestsExtension/public/CMakeLists.txt b/cesiumOmniverseCppTestsExtension/public/CMakeLists.txt similarity index 92% rename from cesiumTestsExtension/public/CMakeLists.txt rename to cesiumOmniverseCppTestsExtension/public/CMakeLists.txt index 3e2fbe818..d694ea1bf 100644 --- a/cesiumTestsExtension/public/CMakeLists.txt +++ b/cesiumOmniverseCppTestsExtension/public/CMakeLists.txt @@ -14,7 +14,7 @@ setup_lib( SOURCES ${SOURCES} INCLUDE_DIRS - "${PROJECT_SOURCE_DIR}/cesiumTestsExtension/include" + "${PROJECT_SOURCE_DIR}/cesiumOmniverseTestsExtension/include" LIBRARIES CesiumOmniverseCore doctest::doctest diff --git a/cesiumTestsExtension/public/CesiumTests.cpp b/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp similarity index 98% rename from cesiumTestsExtension/public/CesiumTests.cpp rename to cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp index e2116c65b..f55988d27 100644 --- a/cesiumTestsExtension/public/CesiumTests.cpp +++ b/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp @@ -3,7 +3,7 @@ #define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL #define DOCTEST_CONFIG_SUPER_FAST_ASSERTS -#include "CesiumTests.h" +#include "CesiumOmniverseTests.h" #include "cesium/omniverse/Context.h" #include "cesium/omniverse/LoggerSink.h" diff --git a/exts/cesium.omniverse.tests/cesium/omniverse/tests/__init__.py b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/__init__.py similarity index 100% rename from exts/cesium.omniverse.tests/cesium/omniverse/tests/__init__.py rename to exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/__init__.py diff --git a/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/__init__.py b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/__init__.py similarity index 100% rename from exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/__init__.py rename to exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/__init__.py diff --git a/exts/cesium.omniverse.tests/cesium/omniverse/tests/extension.py b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py similarity index 93% rename from exts/cesium.omniverse.tests/cesium/omniverse/tests/extension.py rename to exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py index c5b5362a2..ecb126814 100644 --- a/exts/cesium.omniverse.tests/cesium/omniverse/tests/extension.py +++ b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py @@ -4,7 +4,7 @@ from .bindings import acquire_cesium_omniverse_tests_interface, release_cesium_omniverse_tests_interface -class CesiumTestsExtension(omni.ext.IExt): +class CesiumOmniverseTestsExtension(omni.ext.IExt): def __init__(self): super().__init__() diff --git a/exts/cesium.omniverse.tests/config/extension.toml b/exts/cesium.omniverse.cpp.tests/config/extension.toml similarity index 89% rename from exts/cesium.omniverse.tests/config/extension.toml rename to exts/cesium.omniverse.cpp.tests/config/extension.toml index 354585caf..3ebb08485 100644 --- a/exts/cesium.omniverse.tests/config/extension.toml +++ b/exts/cesium.omniverse.cpp.tests/config/extension.toml @@ -25,11 +25,11 @@ icon = "doc/resources/icon.png" preview_image = "doc/resources/icon.png" [[native.plugin]] -path = "bin/cesium.omniverse.tests.plugin" +path = "bin/cesium.omniverse.cpp.tests.plugin" # Paths are relative to the extension folder readme = "doc/README.md" icon = "doc/resources/icon.png" [[python.module]] -name = "cesium.omniverse.tests" +name = "cesium.omniverse.cpp.tests" diff --git a/exts/cesium.omniverse.tests/doc/README.md b/exts/cesium.omniverse.cpp.tests/doc/README.md similarity index 100% rename from exts/cesium.omniverse.tests/doc/README.md rename to exts/cesium.omniverse.cpp.tests/doc/README.md diff --git a/exts/cesium.omniverse.tests/doc/resources/icon.png b/exts/cesium.omniverse.cpp.tests/doc/resources/icon.png similarity index 100% rename from exts/cesium.omniverse.tests/doc/resources/icon.png rename to exts/cesium.omniverse.cpp.tests/doc/resources/icon.png diff --git a/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi b/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi deleted file mode 100644 index 345d0d9f9..000000000 --- a/exts/cesium.omniverse.tests/cesium/omniverse/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi +++ /dev/null @@ -1,10 +0,0 @@ -class ICesiumOmniverseTestsInterface: - def __init__(self, *args, **kwargs) -> None: ... - def on_shutdown(self) -> None: ... - def on_startup(self, arg0: str) -> None: ... - def run_all_tests(self, arg0: int) -> None: ... - -def acquire_cesium_omniverse_tests_interface( - plugin_name: str = ..., library_path: str = ... -) -> ICesiumOmniverseTestsInterface: ... -def release_cesium_omniverse_tests_interface(arg0: ICesiumOmniverseTestsInterface) -> None: ... diff --git a/exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi b/exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi deleted file mode 100644 index 345d0d9f9..000000000 --- a/exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi +++ /dev/null @@ -1,10 +0,0 @@ -class ICesiumOmniverseTestsInterface: - def __init__(self, *args, **kwargs) -> None: ... - def on_shutdown(self) -> None: ... - def on_startup(self, arg0: str) -> None: ... - def run_all_tests(self, arg0: int) -> None: ... - -def acquire_cesium_omniverse_tests_interface( - plugin_name: str = ..., library_path: str = ... -) -> ICesiumOmniverseTestsInterface: ... -def release_cesium_omniverse_tests_interface(arg0: ICesiumOmniverseTestsInterface) -> None: ... diff --git a/exts/cesium.omniverse.unittests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi b/exts/cesium.omniverse.unittests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi deleted file mode 100644 index 345d0d9f9..000000000 --- a/exts/cesium.omniverse.unittests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi +++ /dev/null @@ -1,10 +0,0 @@ -class ICesiumOmniverseTestsInterface: - def __init__(self, *args, **kwargs) -> None: ... - def on_shutdown(self) -> None: ... - def on_startup(self, arg0: str) -> None: ... - def run_all_tests(self, arg0: int) -> None: ... - -def acquire_cesium_omniverse_tests_interface( - plugin_name: str = ..., library_path: str = ... -) -> ICesiumOmniverseTestsInterface: ... -def release_cesium_omniverse_tests_interface(arg0: ICesiumOmniverseTestsInterface) -> None: ... diff --git a/genStubs.bat b/genStubs.bat index 3eac5e05e..9042792a2 100644 --- a/genStubs.bat +++ b/genStubs.bat @@ -18,7 +18,7 @@ set NVIDIA_PYTHON_EXECUTABLE=%NVIDIA_PYTHON_ROOT%\python.exe set FLAT_LIBRARIES_DIR=%TEMP%\CesiumOmniverseFlatLibs set CESIUM_OMNI_STUB_PATH=%PROJECT_ROOT%\exts\cesium.omniverse\cesium\omniverse\bindings\CesiumOmniversePythonBindings.pyi set CESIUM_USD_STUB_PATH=%PROJECT_ROOT%\exts\cesium.usd.plugins\cesium\usd\plugins\CesiumUsdSchemas\__init__.pyi -set CESIUM_TESTS_STUB_PATH=%PROJECT_ROOT%\exts\cesium.omniverse.tests\cesium\tests\bindings\CesiumOmniverseTestsPythonBindings.pyi +set CESIUM_TESTS_STUB_PATH=%PROJECT_ROOT%\exts\cesium.omniverse.cpp.tests\cesium\omniverse\cpp\tests\bindings\CesiumOmniverseCppTestsPythonBindings.pyi set PYTHONPATH=%NVIDIA_USD_PYTHON_LIBS%;%PYTHONPATH% @@ -37,12 +37,12 @@ cd %FLAT_LIBRARIES_DIR%\lib echo "Generating stubs" %NVIDIA_PYTHON_EXECUTABLE% -c "from mypy import stubgen; stubgen.main()" -m CesiumOmniversePythonBindings -v %NVIDIA_PYTHON_EXECUTABLE% -c "from mypy import stubgen; stubgen.main()" -m _CesiumUsdSchemas -v -%NVIDIA_PYTHON_EXECUTABLE% -c "from mypy import stubgen; stubgen.main()" -m CesiumOmniverseTestsPythonBindings -v +%NVIDIA_PYTHON_EXECUTABLE% -c "from mypy import stubgen; stubgen.main()" -m CesiumOmniverseCppTestsPythonBindings -v echo "Copying stubs" copy out\CesiumOmniversePythonBindings.pyi %CESIUM_OMNI_STUB_PATH% copy out\_CesiumUsdSchemas.pyi %CESIUM_USD_STUB_PATH% -copy out\CesiumOmniverseTestsPythonBindings.pyi %CESIUM_TESTS_STUB_PATH% +copy out\CesiumOmniverseCppTestsPythonBindings.pyi %CESIUM_TESTS_STUB_PATH% echo "Formatting stubs" black %CESIUM_OMNI_STUB_PATH% diff --git a/genStubs.sh b/genStubs.sh index cfc2ff664..5861d428d 100755 --- a/genStubs.sh +++ b/genStubs.sh @@ -18,7 +18,7 @@ NVIDIA_PYTHON_EXECUTABLE=$NVIDIA_PYTHON_ROOT/python FLAT_LIBRARIES_DIR="/tmp/CesiumOmniverseFlatLibs" CESIUM_OMNI_STUB_PATH="$PROJECT_ROOT/exts/cesium.omniverse/cesium/omniverse/bindings/CesiumOmniversePythonBindings.pyi" CESIUM_USD_STUB_PATH="$PROJECT_ROOT/exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/__init__.pyi" -CESIUM_TESTS_STUB_PATH="$PROJECT_ROOT/exts/cesium.omniverse.tests/cesium/tests/bindings/CesiumOmniverseTestsPythonBindings.pyi" +CESIUM_TESTS_STUB_PATH="$PROJECT_ROOT/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/CesiumOmniverseCppTestsPythonBindings.pyi" export PYTHONPATH="$NVIDIA_USD_PYTHON_LIBS:$PYTHONPATH" @@ -37,12 +37,12 @@ cd "$FLAT_LIBRARIES_DIR/lib" echo "Generating stubs" $NVIDIA_PYTHON_EXECUTABLE -c 'from mypy import stubgen; stubgen.main()' -m CesiumOmniversePythonBindings -v $NVIDIA_PYTHON_EXECUTABLE -c 'from mypy import stubgen; stubgen.main()' -m _CesiumUsdSchemas -v -$NVIDIA_PYTHON_EXECUTABLE -c 'from mypy import stubgen; stubgen.main()' -m CesiumOmniverseTestsPythonBindings -v +$NVIDIA_PYTHON_EXECUTABLE -c 'from mypy import stubgen; stubgen.main()' -m CesiumOmniverseCppTestsPythonBindings -v echo "Copying stubs" cp "out/CesiumOmniversePythonBindings.pyi" $CESIUM_OMNI_STUB_PATH cp "out/_CesiumUsdSchemas.pyi" $CESIUM_USD_STUB_PATH -cp "out/CesiumOmniverseTestsPythonBindings.pyi" $CESIUM_TESTS_STUB_PATH +cp "out/CesiumOmniverseCppTestsPythonBindings.pyi" $CESIUM_TESTS_STUB_PATH echo "Formatting stubs" black $CESIUM_OMNI_STUB_PATH From ec0012409d28bec349ba5853fad09936f3943338 Mon Sep 17 00:00:00 2001 From: elser Date: Tue, 26 Sep 2023 16:47:56 -0400 Subject: [PATCH 10/13] finished renames --- CMakeLists.txt | 8 ++++---- apps/cesium.omniverse.cpp.tests.runner.kit | 2 +- .../bindings/CMakeLists.txt | 4 ++-- .../bindings/PythonBindings.cpp | 20 +++++++++---------- .../include/CesiumOmniverseCppTests.h | 4 ++-- .../public/CMakeLists.txt | 4 ++-- .../public/CesiumOmniverseCppTests.cpp | 10 +++++----- .../CesiumOmniverseCppTestsPythonBindings.pyi | 10 ++++++++++ .../omniverse/cpp/tests/bindings/__init__.py | 2 +- .../cesium/omniverse/cpp/tests/extension.py | 2 +- 10 files changed, 38 insertions(+), 28 deletions(-) create mode 100644 exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/CesiumOmniverseCppTestsPythonBindings.pyi diff --git a/CMakeLists.txt b/CMakeLists.txt index ce5558da7..cfa281e40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -670,12 +670,12 @@ install( EXCLUDE_FROM_ALL) install( - TARGETS cesium.omniverse.tests.plugin + TARGETS cesium.omniverse.cpp.tests.plugin ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install LIBRARY DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install RUNTIME DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install) install( - TARGETS cesium.omniverse.tests.plugin + TARGETS cesium.omniverse.cpp.tests.plugin RUNTIME_DEPENDENCIES DIRECTORIES ${INSTALL_SEARCH_PATHS} @@ -694,13 +694,13 @@ install( EXCLUDE_FROM_ALL) install( - TARGETS CesiumOmniverseTestsPythonBindings + TARGETS CesiumOmniverseCppTestsPythonBindings ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install LIBRARY DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install RUNTIME DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install) install( - TARGETS CesiumOmniverseTestsPythonBindings + TARGETS CesiumOmniverseCppTestsPythonBindings RUNTIME_DEPENDENCIES DIRECTORIES ${INSTALL_SEARCH_PATHS} diff --git a/apps/cesium.omniverse.cpp.tests.runner.kit b/apps/cesium.omniverse.cpp.tests.runner.kit index c643511ca..bf3ca3580 100644 --- a/apps/cesium.omniverse.cpp.tests.runner.kit +++ b/apps/cesium.omniverse.cpp.tests.runner.kit @@ -5,7 +5,7 @@ app = true [dependencies] "cesium.omniverse.dev" = {} -"cesium.omniverse.tests" = {} +"cesium.omniverse.cpp.tests" = {} [settings] app.window.title = "Cesium for Omniverse Tests App" diff --git a/cesiumOmniverseCppTestsExtension/bindings/CMakeLists.txt b/cesiumOmniverseCppTestsExtension/bindings/CMakeLists.txt index ae0f64ed4..7e51a1b9a 100644 --- a/cesiumOmniverseCppTestsExtension/bindings/CMakeLists.txt +++ b/cesiumOmniverseCppTestsExtension/bindings/CMakeLists.txt @@ -8,11 +8,11 @@ setup_python_module( # Use the same Python version as Omniverse (Python 3.10) "${PROJECT_SOURCE_DIR}/extern/nvidia/_build/target-deps/python" TARGET_NAME - CesiumOmniverseTestsPythonBindings + CesiumOmniverseCppTestsPythonBindings SOURCES ${SOURCES} LIBRARIES - cesium.omniverse.tests.plugin + cesium.omniverse.cpp.tests.plugin CXX_FLAGS ${CESIUM_OMNI_CXX_FLAGS} CXX_FLAGS_DEBUG diff --git a/cesiumOmniverseCppTestsExtension/bindings/PythonBindings.cpp b/cesiumOmniverseCppTestsExtension/bindings/PythonBindings.cpp index 6e9aa3bf8..c44da9544 100644 --- a/cesiumOmniverseCppTestsExtension/bindings/PythonBindings.cpp +++ b/cesiumOmniverseCppTestsExtension/bindings/PythonBindings.cpp @@ -1,22 +1,22 @@ -#include "CesiumOmniverseTests.h" +#include "CesiumOmniverseCppTests.h" #include // NOLINTNEXTLINE -CARB_BINDINGS("cesium.omniverse.tests.python") -DISABLE_PYBIND11_DYNAMIC_CAST(cesium::omniverse::tests::ICesiumOmniverseTestsInterface) +CARB_BINDINGS("cesium.omniverse.cpp.tests.python") +DISABLE_PYBIND11_DYNAMIC_CAST(cesium::omniverse::tests::ICesiumOmniverseCppTestsInterface) -PYBIND11_MODULE(CesiumOmniverseTestsPythonBindings, m) { +PYBIND11_MODULE(CesiumOmniverseCppTestsPythonBindings, m) { using namespace cesium::omniverse::tests; - m.doc() = "pybind11 cesium.omniverse.tests bindings"; + m.doc() = "pybind11 cesium.omniverse.cpp.tests bindings"; // clang-format off - carb::defineInterfaceClass( - m, "ICesiumOmniverseTestsInterface", "acquire_cesium_omniverse_tests_interface", "release_cesium_omniverse_tests_interface") - .def("run_all_tests", &ICesiumOmniverseTestsInterface::run_all_tests) - .def("on_startup", &ICesiumOmniverseTestsInterface::onStartup) - .def("on_shutdown", &ICesiumOmniverseTestsInterface::onShutdown); + carb::defineInterfaceClass( + m, "ICesiumOmniverseCppTestsInterface", "acquire_cesium_omniverse_tests_interface", "release_cesium_omniverse_tests_interface") + .def("run_all_tests", &ICesiumOmniverseCppTestsInterface::run_all_tests) + .def("on_startup", &ICesiumOmniverseCppTestsInterface::onStartup) + .def("on_shutdown", &ICesiumOmniverseCppTestsInterface::onShutdown); // clang-format on } diff --git a/cesiumOmniverseCppTestsExtension/include/CesiumOmniverseCppTests.h b/cesiumOmniverseCppTestsExtension/include/CesiumOmniverseCppTests.h index e165b1175..6b0b0dac8 100644 --- a/cesiumOmniverseCppTestsExtension/include/CesiumOmniverseCppTests.h +++ b/cesiumOmniverseCppTestsExtension/include/CesiumOmniverseCppTests.h @@ -3,9 +3,9 @@ namespace cesium::omniverse::tests { -class ICesiumOmniverseTestsInterface { +class ICesiumOmniverseCppTestsInterface { public: - CARB_PLUGIN_INTERFACE("cesium::omniverse::tests::ICesiumOmniverseTestsInterface", 0, 0); + CARB_PLUGIN_INTERFACE("cesium::omniverse::tests::ICesiumOmniverseCppTestsInterface", 0, 0); /** * @brief Call this on extension startup. * diff --git a/cesiumOmniverseCppTestsExtension/public/CMakeLists.txt b/cesiumOmniverseCppTestsExtension/public/CMakeLists.txt index d694ea1bf..5090e78cb 100644 --- a/cesiumOmniverseCppTestsExtension/public/CMakeLists.txt +++ b/cesiumOmniverseCppTestsExtension/public/CMakeLists.txt @@ -7,14 +7,14 @@ get_property(ADDITIONAL_LIBRARIES GLOBAL PROPERTY NVIDIA_ADDITIONAL_LIBRARIES_PR # cmake-format: off setup_lib( TARGET_NAME - cesium.omniverse.tests.plugin + cesium.omniverse.cpp.tests.plugin TYPE # Carbonite Plugins needs to be shared libraries SHARED SOURCES ${SOURCES} INCLUDE_DIRS - "${PROJECT_SOURCE_DIR}/cesiumOmniverseTestsExtension/include" + "${PROJECT_SOURCE_DIR}/cesiumOmniverseCppTestsExtension/include" LIBRARIES CesiumOmniverseCore doctest::doctest diff --git a/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp b/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp index f55988d27..339f4cc5f 100644 --- a/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp +++ b/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp @@ -3,7 +3,7 @@ #define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL #define DOCTEST_CONFIG_SUPER_FAST_ASSERTS -#include "CesiumOmniverseTests.h" +#include "CesiumOmniverseCppTests.h" #include "cesium/omniverse/Context.h" #include "cesium/omniverse/LoggerSink.h" @@ -52,7 +52,7 @@ static void handler(const doctest::AssertData& ad) { namespace cesium::omniverse::tests { -class CesiumOmniverseTestsPlugin final : public ICesiumOmniverseTestsInterface { +class CesiumOmniverseCppTestsPlugin final : public ICesiumOmniverseCppTestsInterface { public: void onStartup(const char* cesiumExtensionLocation) noexcept override { Context::onStartup(cesiumExtensionLocation); @@ -85,15 +85,15 @@ class CesiumOmniverseTestsPlugin final : public ICesiumOmniverseTestsInterface { } // namespace cesium::omniverse::tests const struct carb::PluginImplDesc pluginImplDesc = { - "cesium.omniverse.tests.plugin", + "cesium.omniverse.cpp.tests.plugin", "Cesium Omniverse Tests Plugin.", "Cesium", carb::PluginHotReload::eDisabled, "dev"}; // NOLINTBEGIN -CARB_PLUGIN_IMPL(pluginImplDesc, cesium::omniverse::tests::CesiumOmniverseTestsPlugin) +CARB_PLUGIN_IMPL(pluginImplDesc, cesium::omniverse::tests::CesiumOmniverseCppTestsPlugin) CARB_PLUGIN_IMPL_DEPS(omni::fabric::IFabric, omni::fabric::IStageReaderWriter) // NOLINTEND -void fillInterface([[maybe_unused]] cesium::omniverse::tests::CesiumOmniverseTestsPlugin& iface) {} +void fillInterface([[maybe_unused]] cesium::omniverse::tests::CesiumOmniverseCppTestsPlugin& iface) {} diff --git a/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/CesiumOmniverseCppTestsPythonBindings.pyi b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/CesiumOmniverseCppTestsPythonBindings.pyi new file mode 100644 index 000000000..cead660bb --- /dev/null +++ b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/CesiumOmniverseCppTestsPythonBindings.pyi @@ -0,0 +1,10 @@ +class ICesiumOmniverseCppTestsInterface: + def __init__(self, *args, **kwargs) -> None: ... + def on_shutdown(self) -> None: ... + def on_startup(self, arg0: str) -> None: ... + def run_all_tests(self, arg0: int) -> None: ... + +def acquire_cesium_omniverse_tests_interface( + plugin_name: str = ..., library_path: str = ... +) -> ICesiumOmniverseCppTestsInterface: ... +def release_cesium_omniverse_tests_interface(arg0: ICesiumOmniverseCppTestsInterface) -> None: ... diff --git a/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/__init__.py b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/__init__.py index 002aae5f6..509ecc0e5 100644 --- a/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/__init__.py +++ b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/__init__.py @@ -1 +1 @@ -from .CesiumOmniverseTestsPythonBindings import * # noqa: F401 F403 +from .CesiumOmniverseCppTestsPythonBindings import * # noqa: F401 F403 diff --git a/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py index ecb126814..c864ab960 100644 --- a/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py +++ b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py @@ -4,7 +4,7 @@ from .bindings import acquire_cesium_omniverse_tests_interface, release_cesium_omniverse_tests_interface -class CesiumOmniverseTestsExtension(omni.ext.IExt): +class CesiumOmniverseCppTestsExtension(omni.ext.IExt): def __init__(self): super().__init__() From a205289fca7fe7230d3f172cc8664704f30f04ce Mon Sep 17 00:00:00 2001 From: elser Date: Tue, 26 Sep 2023 16:53:52 -0400 Subject: [PATCH 11/13] add launch configuration for windows --- .vscode/launch.linux.json | 2 +- .vscode/launch.windows.json | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.linux.json b/.vscode/launch.linux.json index ef30718b5..5160aa2aa 100644 --- a/.vscode/launch.linux.json +++ b/.vscode/launch.linux.json @@ -30,7 +30,7 @@ ] }, { - "name": "Tests", + "name": "Tests Extension", "preLaunchTask": "Build Only (debug)", "program": "${workspaceFolder}/extern/nvidia/_build/target-deps/kit-sdk/kit", "args": [ diff --git a/.vscode/launch.windows.json b/.vscode/launch.windows.json index 41aeeccba..e859d1b13 100644 --- a/.vscode/launch.windows.json +++ b/.vscode/launch.windows.json @@ -63,6 +63,28 @@ "console": "externalTerminal", "internalConsoleOptions": "openOnSessionStart" }, + { + "name": "Tests Extension", + "preLaunchTask": "Build Only (debug)", + "program": "${workspaceFolder}/extern/nvidia/_build/target-deps/kit-sdk/kit.exe", + "args": [ + "${workspaceFolder}/apps/cesium.omniverse.cpp.tests.runner.kit" + ], + "cwd": "${workspaceFolder}", + "type": "cppvsdbg", + "request": "launch", + "console": "externalTerminal", + "internalConsoleOptions": "openOnSessionStart", + "setupCommands": [ + { + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "text": "set print elements 0" + } + ] + }, { "name": "Python Debugging (start)", "preLaunchTask": "Build Only (debug)", @@ -84,4 +106,4 @@ "host": "localhost" } ] -} +} \ No newline at end of file From 7b3dfe3e299692cb6cbc8f76283e5ba2ea4093d3 Mon Sep 17 00:00:00 2001 From: elser Date: Wed, 27 Sep 2023 12:17:21 -0400 Subject: [PATCH 12/13] pass extension path down --- .../public/CesiumOmniverseCppTests.cpp | 4 ++-- .../cesium/omniverse/cpp/tests/extension.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp b/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp index 339f4cc5f..cee68259c 100644 --- a/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp +++ b/cesiumOmniverseCppTestsExtension/public/CesiumOmniverseCppTests.cpp @@ -64,7 +64,7 @@ class CesiumOmniverseCppTestsPlugin final : public ICesiumOmniverseCppTestsInter void run_all_tests(long int stage_id) noexcept override { - std::cout << "Running Cesium Omniverse Tests with stage id: " << stage_id << std::endl; + CESIUM_LOG_INFO("Running Cesium Omniverse Tests with stage id: {}", stage_id); // construct a context doctest::Context context; @@ -78,7 +78,7 @@ class CesiumOmniverseCppTestsPlugin final : public ICesiumOmniverseCppTestsInter exampleTest(); - std::cout << "Cesium Omniverse Tests complete" << std::endl; + CESIUM_LOG_INFO("Cesium Omniverse Tests complete"); } }; diff --git a/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py index c864ab960..4d1538311 100644 --- a/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py +++ b/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py @@ -14,6 +14,8 @@ def on_startup(self): global tests_interface tests_interface = acquire_cesium_omniverse_tests_interface() + tests_interface.on_startup("exts/cesium.omniverse") + # TODO ensure the stage has been set up before getting stage id stageId = omni.usd.get_context().get_stage_id() From faf9419af941e0c392376300280edd167025cd03 Mon Sep 17 00:00:00 2001 From: elser Date: Thu, 28 Sep 2023 12:16:44 -0400 Subject: [PATCH 13/13] fix build issue in release, tests were trying to install but not build --- CMakeLists.txt | 95 ++++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfa281e40..849c374f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -669,54 +669,57 @@ install( COMPONENT library EXCLUDE_FROM_ALL) -install( - TARGETS cesium.omniverse.cpp.tests.plugin - ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install - LIBRARY DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install - RUNTIME DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install) -install( - TARGETS cesium.omniverse.cpp.tests.plugin - RUNTIME_DEPENDENCIES - DIRECTORIES - ${INSTALL_SEARCH_PATHS} - PRE_EXCLUDE_REGEXES - ${INSTALL_PRE_EXCLUDE_REGEXES} - POST_EXCLUDE_REGEXES - ${INSTALL_POST_EXCLUDE_REGEXES} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT library - EXCLUDE_FROM_ALL - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT library - EXCLUDE_FROM_ALL - RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT library - EXCLUDE_FROM_ALL) -install( - TARGETS CesiumOmniverseCppTestsPythonBindings - ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install - LIBRARY DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install - RUNTIME DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install) +if(CESIUM_OMNI_ENABLE_TESTS) + install( + TARGETS cesium.omniverse.cpp.tests.plugin + ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install + LIBRARY DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install + RUNTIME DESTINATION ${KIT_EXTENSION_TESTS_BIN_PATH} COMPONENT install) + install( + TARGETS cesium.omniverse.cpp.tests.plugin + RUNTIME_DEPENDENCIES + DIRECTORIES + ${INSTALL_SEARCH_PATHS} + PRE_EXCLUDE_REGEXES + ${INSTALL_PRE_EXCLUDE_REGEXES} + POST_EXCLUDE_REGEXES + ${INSTALL_POST_EXCLUDE_REGEXES} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL) -install( - TARGETS CesiumOmniverseCppTestsPythonBindings - RUNTIME_DEPENDENCIES - DIRECTORIES - ${INSTALL_SEARCH_PATHS} - PRE_EXCLUDE_REGEXES - ${INSTALL_PRE_EXCLUDE_REGEXES} - POST_EXCLUDE_REGEXES - ${INSTALL_POST_EXCLUDE_REGEXES} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT library - EXCLUDE_FROM_ALL - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT library - EXCLUDE_FROM_ALL - RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT library - EXCLUDE_FROM_ALL) + install( + TARGETS CesiumOmniverseCppTestsPythonBindings + ARCHIVE DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install + LIBRARY DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install + RUNTIME DESTINATION ${KIT_EXTENSION_TESTS_BINDINGS_PATH} COMPONENT install) + + install( + TARGETS CesiumOmniverseCppTestsPythonBindings + RUNTIME_DEPENDENCIES + DIRECTORIES + ${INSTALL_SEARCH_PATHS} + PRE_EXCLUDE_REGEXES + ${INSTALL_PRE_EXCLUDE_REGEXES} + POST_EXCLUDE_REGEXES + ${INSTALL_POST_EXCLUDE_REGEXES} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT library + EXCLUDE_FROM_ALL) +endif() install( DIRECTORY "${PROJECT_SOURCE_DIR}/include/"