Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

61 lines
1.9 KiB
ReStructuredText

=============
Testing Guide
=============
We can never have enough testing. Any additional tests you can write are always
greatly appreciated.
----------
Unit Tests
----------
Testing new core features within GOTCHA should be implemented in the ``test/unit/gotcha_unit_tests.c`` using the check framework as defined in `<https://libcheck.github.io/check>`_.
Create a new test
^^^^^^^^^^^^^^^^^
We can create a new test using ``START_TEST`` and ``END_TEST`` macros.
.. code-block:: c
START_TEST(sample_test){
}
END_TEST
Create a new suite
^^^^^^^^^^^^^^^^^^
These new tests can be added to new suite with code similar to the following.
To add to existing suite, we need use ``tcase_add_test`` api to add the test function to the suite.
.. code-block:: c
Suite* gotcha_sample_suite(){
Suite* s = suite_create("Sample");
TCase* sample_case = configured_case_create("Basic tests");
tcase_add_test(sample_case, sample_test);
suite_add_tcase(s, sample_case);
return s;
}
Adding suite to runner
^^^^^^^^^^^^^^^^^^^^^^
Within the main function of the ``test/unit/gotcha_unit_tests.c``, the gotcha_sample_suite can be added as follows.
.. code-block:: c
Suite* sample_suite = gotcha_sample_suite();
SRunner* sample_runner = srunner_create(sample_suite);
srunner_run_all(sample_suite, CK_NORMAL);
num_fails += srunner_ntests_failed(sample_suite);
-------------------------------------
Testing tool specific usage of GOTCHA
-------------------------------------
We should use custom test cases where we are testing the API for GOTCHA for specific features such as filtering libraries, main function bindings, etc.
These test cases can be stored within the ``test`` folder. Look at existing examples such as ``test/stack`` and ``test/dlopen`` to understand how we can implement these tests.
Once you add a self containing test case within ``test``, we can add it to the ``test/CMakeLists.txt``.