diff --git a/lapack-netlib/BLAS/TESTING/meson.build b/lapack-netlib/BLAS/TESTING/meson.build index aad9da379..7d42b16a9 100644 --- a/lapack-netlib/BLAS/TESTING/meson.build +++ b/lapack-netlib/BLAS/TESTING/meson.build @@ -1,5 +1,3 @@ -# TODO: Only Level 1 BLAS tests pass for now, the others need input files, see -# Makefile for more information _blas_noinput_test_array = [# # ['Pretty name', 'binary_name', 'BlahTest.cpp'] ] @@ -11,55 +9,65 @@ if prec == 's' or build_single or build_all_prec _blas_noinput_test_array += [ ['Test REAL Level 1 BLAS', 'xblat1s', 'sblat1.f'], ] - # _blas_noinput_test_array += [ - # ['Test REAL Level 2 BLAS', 'xblat2s', 'sblat2.f', 'sblat2.in'], - # ['Test REAL Level 3 BLAS', 'xblat3s', 'sblat3.f', 'sblat3.in'], - # ] + _blas_input_test_array += [ + ['Test REAL Level 2 BLAS', 'xblat2s', 'sblat2.f', 'sblat2.in'], + ['Test REAL Level 3 BLAS', 'xblat3s', 'sblat3.f', 'sblat3.in'], + ] endif if prec == 'd' or build_double or build_all_prec _blas_noinput_test_array += [ ['Test DOUBLE PRECISION Level 1 BLAS', 'xblat1d', 'dblat1.f'], ] - # _blas_noinput_test_array += [ - # ['Test DOUBLE PRECISION Level 2 BLAS', 'xblat2d', 'dblat2.f', 'dblat2.in'], - # ['Test DOUBLE PRECISION Level 3 BLAS', 'xblat3d', 'dblat3.f', 'dblat3.in'], - # ] + _blas_input_test_array += [ + ['Test DOUBLE PRECISION Level 2 BLAS', 'xblat2d', 'dblat2.f', 'dblat2.in'], + ['Test DOUBLE PRECISION Level 3 BLAS', 'xblat3d', 'dblat3.f', 'dblat3.in'], + ] endif if build_complex or build_all_prec _blas_noinput_test_array += [ ['Test COMPLEX Level 1 BLAS', 'xblat1c', 'cblat1.f'], - # ['Test COMPLEX Level 2 BLAS', 'xblat2c', 'cblat2.f'], - # ['Test COMPLEX Level 3 BLAS', 'xblat3c', 'cblat3.f'], + ] + _blas_input_test_array += [ + ['Test COMPLEX Level 2 BLAS', 'xblat2c', 'cblat2.f', 'cblat2.in'], + ['Test COMPLEX Level 3 BLAS', 'xblat3c', 'cblat3.f', 'cblat3.in'], ] endif if build_complex16 or build_all_prec _blas_noinput_test_array += [ ['Test COMPLEX*16 Level 1 BLAS', 'xblat1z', 'zblat1.f'], - # ['Test COMPLEX*16 Level 2 BLAS', 'xblat2z', 'zblat2.f'], - # ['Test COMPLEX*16 Level 3 BLAS', 'xblat3z', 'zblat3.f'], + ] + _blas_input_test_array += [ + ['Test COMPLEX*16 Level 2 BLAS', 'xblat2z', 'zblat2.f', 'zblat2.in'], + ['Test COMPLEX*16 Level 3 BLAS', 'xblat3z', 'zblat3.f', 'zblat3.in'], ] endif foreach _test : _blas_noinput_test_array test(_test.get(0), executable(_test.get(1), - sources : [_test.get(2)], + sources : _test.get(2), link_with : netlib_blas, ), ) endforeach -# foreach _test : _blas_input_test_array -# test(_test.get(0), -# executable(_test.get(1), -# sources : [_test.get(2)], -# link_with : netlib_blas, -# ), -# args: ['<', _test.get(3)], -# workdir : meson.source_root() + '/lapack-netlib/BLAS/TESTING/', -# ) -# endforeach +fortran_test_runner = executable('run_fortran_test', + sources: ['run_fortran.c'], + install: false) + +# NOTE: For the tests to pass the executables need to be compiled first +foreach _test : _blas_input_test_array + executable(_test.get(1), + sources : _test.get(2), + link_with : netlib_blas, + ) + test_exe = meson.current_build_dir() / _test.get(1) + input_file = meson.source_root() + '/lapack-netlib/BLAS/TESTING/' + _test.get(3) + test(_test.get(0), fortran_test_runner, + args: [test_exe, input_file], + workdir: meson.current_build_dir()) +endforeach diff --git a/lapack-netlib/BLAS/TESTING/run_fortran.c b/lapack-netlib/BLAS/TESTING/run_fortran.c new file mode 100644 index 000000000..28dbe64e4 --- /dev/null +++ b/lapack-netlib/BLAS/TESTING/run_fortran.c @@ -0,0 +1,21 @@ +#include +#include +#include + +int main(int argc, char *argv[]) { + if (argc != 3) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return EXIT_FAILURE; + } + + char command[1024]; + snprintf(command, sizeof(command), "%s < %s", argv[1], argv[2]); + + int result = system(command); + if (result != 0) { + fprintf(stderr, "Error: Command '%s' failed with return code %d.\n", command, result); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +}