Skip to content

Fix tests and add runner script#65

Open
nvlukasz wants to merge 2 commits into
Autodesk:py-local-srcfrom
nvlukasz:lwawrzyniak/update3-fix-tests
Open

Fix tests and add runner script#65
nvlukasz wants to merge 2 commits into
Autodesk:py-local-srcfrom
nvlukasz:lwawrzyniak/update3-fix-tests

Conversation

@nvlukasz

Copy link
Copy Markdown

Summary

This PR gets the neon/py/tests suite green and runnable as a single suite. It ports the tests off the obsolete wpne module, fixes API drift against the current neon Python package, converts the standalone test scripts into discoverable unittest tests, and fixes the underlying Neon bugs the tests surfaced (in bGrid, DataView, and the bField/Container write path). All functional tests now pass (18/18).

Test suite changes

Removed the obsolete wpne dependency

wpne was the old standalone Warp↔Neon glue package; its functionality now lives in the neon package itself (neon.Container, neon.Loader, neon.init). Tests now import directly from neon and use init_warp_neon() instead of the wpne scaffolding (import wpne, @require_wpne, setup_wpne_build). The now-unused wpne helpers were dropped from neon_test_utils.py.

Fixed API drift against the current neon package

  • mGrid.new_field() now requires memory_type= → added neon.MemoryType.host_device()
  • mGrid.get_num_levels().num_levels (now a property)
  • @Container.factory@Container.factory() (now takes a name argument)
  • Renamed Warp builtins: NeonDenseIdx_createneon_idx_3d; NeonDenseSpan_print / neon_print(partition)neon_print / neon_print_dbg; neon_ngh_dataneon_read_ngh

Converted scripts to unittest and standardized the test_* prefix

block_grid.py and mres_grid.py were already unittest-based and were simply renamed. The remaining scripts (axpy, jacobi, mres_*) were wrapped in a @require_gpu-gated TestCase whose test_run calls the original entry point — axpy/jacobi keep their correctness assertions; the mres_* demos act as smoke tests. benchmark_axpy.py was intentionally left as a standalone perf script.

Added run_tests.sh

Each test file runs in its own process: a single-process python -m unittest discover segfaults because Warp + Neon re-initialize global GPU state (CUDA contexts, kernel cache) on every test. The runner sources env.sh and honors $PYTHON.

Neon fixes required to make the tests pass

  • bGrid containers (Container.cpp, block/bGrid.py): bGrid lacked a name property (which Container.__init__ reads) and was missing the warp_container_{delete,run,parse}_bGrid C exports (only dGrid/mGrid were exported). Added both.
  • DataView codegen (dataView.py): a captured DataView constant generated invalid C++ (wp::NeonDataView{{/* !!! */}}) because Warp's serializer didn't recognize its ctypes.c_char field. Changed the field to ctypes.c_int8 (same 1-byte layout) so it emits a valid wp::NeonDataView{N}.
  • bField write path (bField_imp.h, mGrid.cpp): writing to an inactive cell aborted the process with std::out_of_range. bField::getReference now guards setIdx == -1 (matching the read path) and throws a clear NeonException, and the mGrid_mField_write binding catches it and returns -1 instead of crossing the extern "C" boundary.

How to run

neon/py/tests/run_tests.sh   # 18 passed, 0 failed

Individual tests also run via

python test_<name>.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant