Skip to content

Commit a081953

Browse files
committed
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
1 parent b17c2c0 commit a081953

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/command_line_test.F90

+12
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ function check_flag_value() result(test_passes)
5656
character(len=132) command_message
5757

5858
call execute_command_line( &
59+
#ifdef USE_MPI
60+
command = "fpm run --example get-flag-value --compiler mpifort --runner 'mpiexec -n 1' -- --input-file some_file_name", &
61+
#else
5962
command = "fpm run --example get-flag-value -- --input-file some_file_name", &
63+
#endif
6064
wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &
6165
)
6266
test_passes = exit_status == 0
@@ -68,7 +72,11 @@ function handle_missing_flag_value() result(test_passes)
6872
character(len=132) command_message
6973

7074
call execute_command_line( &
75+
#ifdef USE_MPI
76+
command = "fpm run --example handle-missing-flag --compiler mpifort --runner 'mpiexec -n 1' -- --empty-flag", &
77+
#else
7178
command = "fpm run --example handle-missing-flag -- --empty-flag", &
79+
#endif
7280
wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &
7381
)
7482
test_passes = exit_status == 0
@@ -80,7 +88,11 @@ function check_command_line_argument() result(test_passes)
8088
character(len=132) command_message
8189

8290
call execute_command_line( &
91+
#ifdef USE_MPI
92+
command = "fpm run --example check-command-line-argument --compiler mpifort --runner 'mpiexec -n 1' -- --some-argument", &
93+
#else
8394
command = "fpm run --example check-command-line-argument -- --some-argument", &
95+
#endif
8496
wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &
8597
)
8698
test_passes = exit_status == 0

0 commit comments

Comments
 (0)