#!/bin/bash

# exit on error
set -e
# turn on command echoing
set -v
# make the output directory if it doesn't exist
mkdir -p out
# run from NAMELIST folder, like in MONARCH
cd ..

if [[ $1 == "MPI" ]]; then
  exec_str="mpirun -v -np 2 ../SRC_LIBS/partmc/build/mock_monarch camp/current_config.json camp/current_interface.json camp/out/current"
else
  exec_str="../SRC_LIBS/partmc/build/mock_monarch camp/current_config.json camp/current_interface.json camp/out/current"
fi

if ! $exec_str; then
  echo FAIL
  exit 1
else
  echo PASS
  exit 1
fi
