ENH,TST: Add a driver for netlib blas tests
Also a note that the tests need executables to be compiled first.
This commit is contained in:
parent
58458a59d4
commit
1295eea4ac
|
@ -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
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "Usage: %s <fortran_executable> <input_file>\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;
|
||||
}
|
Loading…
Reference in New Issue