From a0819538c3ff6af2da0dea407588f1c22d1a6db2 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Fri, 24 May 2024 16:05:02 -0700 Subject: [PATCH] WIP: USE_MPI macro toggles MPI usage This commit breaks non-MPI builds. To build and test with MPI, run fpm test \ --compiler mpifort \ --runner "mpiexec -n 1" \ --flag "-DUSE_MPI" \ --profile release --- test/command_line_test.F90 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/command_line_test.F90 b/test/command_line_test.F90 index 01b80c9e..805afba1 100644 --- a/test/command_line_test.F90 +++ b/test/command_line_test.F90 @@ -56,7 +56,11 @@ function check_flag_value() result(test_passes) character(len=132) command_message call execute_command_line( & +#ifdef USE_MPI + command = "fpm run --example get-flag-value --compiler mpifort --runner 'mpiexec -n 1' -- --input-file some_file_name", & +#else command = "fpm run --example get-flag-value -- --input-file some_file_name", & +#endif wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message & ) test_passes = exit_status == 0 @@ -68,7 +72,11 @@ function handle_missing_flag_value() result(test_passes) character(len=132) command_message call execute_command_line( & +#ifdef USE_MPI + command = "fpm run --example handle-missing-flag --compiler mpifort --runner 'mpiexec -n 1' -- --empty-flag", & +#else command = "fpm run --example handle-missing-flag -- --empty-flag", & +#endif wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message & ) test_passes = exit_status == 0 @@ -80,7 +88,11 @@ function check_command_line_argument() result(test_passes) character(len=132) command_message call execute_command_line( & +#ifdef USE_MPI + command = "fpm run --example check-command-line-argument --compiler mpifort --runner 'mpiexec -n 1' -- --some-argument", & +#else command = "fpm run --example check-command-line-argument -- --some-argument", & +#endif wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message & ) test_passes = exit_status == 0