Skip to content

Commit

Permalink
WIP: USE_MPI macro toggles MPI usage
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rouson committed May 24, 2024
1 parent b17c2c0 commit a081953
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/command_line_test.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a081953

Please sign in to comment.