Skip to content

Add CTest native unit tests

Cristian Le requested to merge LecrisUT/octopus:ctest into main

Description

This is a skeleton of how to add CMake native unit tests. Simply write a function of the form:

! Filename: my_test.F90
function my_test(argc, argv) bind(C) result(ret)
    use, intrinsic :: iso_c_binding
    integer(c_int), value, intent(in) :: argc
    type(c_ptr), intent(in) :: argv(argc)
    integer(c_int) :: ret

    ! Do something to test here

    ! Return 0 if test succeeds, otherwise return anything non-zero
    ! You should also print an error about it
    ret = 0

end function my_test

Regression testsuite are implemented as is running oct-run_regression_test.pl directly. You can run equivalent groups to the TestGroups, e.g.:

$ ctest -L short-run

Equivalently you can run multiple groups, exclude groups etc. and the tests that overlap will not be re-run.

Depends on !1827 (merged)

Edited by Cristian Le

Merge request reports