diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1faceb7f4..31c986a46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -270,12 +270,12 @@ jobs: run: | echo CAF_IMAGES=${CAF_IMAGES} set -x - ./build/run-fpm.sh run --verbose --example hello + ./run-fpm.sh run --verbose --example hello - name: Run native multi-image test if: ${{ matrix.native_multi_image }} run: | - set -x ; ./build/run-fpm.sh run --verbose 2>&1 | tee output ; \ + set -x ; ./run-fpm.sh run --verbose 2>&1 | tee output ; \ test ${PIPESTATUS[0]} = 0 && \ ! grep -q "IEEE arithmetic exceptions signaled" output @@ -284,7 +284,7 @@ jobs: echo SUBJOB_PREFIX=${SUBJOB_PREFIX} while (( CAF_IMAGES > 0 )); do \ echo CAF_IMAGES=${CAF_IMAGES} ; \ - ( set -x ; ./build/run-fpm.sh test --verbose -- -d ) ; \ + ( set -x ; ./run-fpm.sh test --verbose -- -d ) ; \ sleep 1 ; \ CAF_IMAGES=$(( CAF_IMAGES / 2 )) ; \ done @@ -293,13 +293,13 @@ jobs: run: | echo CAF_IMAGES=${CAF_IMAGES} set -x - ./build/run-fpm.sh run --verbose --example stop_with_no_code - ( set +e ; ./build/run-fpm.sh run --verbose --example stop_with_integer_code ; test $? = 99 ) - ( set +e ; ./build/run-fpm.sh run --verbose --example error_stop_with_integer_code ; test $? = 100 ) + ./run-fpm.sh run --verbose --example stop_with_no_code + ( set +e ; ./run-fpm.sh run --verbose --example stop_with_integer_code ; test $? = 99 ) + ( set +e ; ./run-fpm.sh run --verbose --example error_stop_with_integer_code ; test $? = 100 ) unset GASNET_SPAWN_VERBOSE for ((i=1; i<=4; i++)); do \ (set +e ; \ - ./build/run-fpm.sh run --verbose --example exit_case -- $i 2>&1 | tee output ; \ + ./run-fpm.sh run --verbose --example exit_case -- $i 2>&1 | tee output ; \ test ${PIPESTATUS[0]} = $((i + 100)) \ && grep -q "stdout from image $CAF_IMAGES" output \ && grep -q "stderr from image $CAF_IMAGES" output \ diff --git a/.gitignore b/.gitignore index 1c8cf2bf3..50de0eca9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ # fpm-generated build tree build -# install.sh-generated fpm manifest +# install.sh-generated fpm files fpm.toml +run-fpm.sh # ford-generated documentation doc/html diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6a9519b3..31b7a22d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ If you encounter problems or limitations when installing or using Caffeine, plea - [ ] Any conditions required to reproduce the problem such as - [ ] The output of `uname -a` showing the operating system (OS), OS version, and processor architecture, - [ ] The number of images executed (e.g., the output of `echo $CAF_IMAGES`), - - [ ] The command used to run your program (e.g., `./build/run-fpm.sh run`), and + - [ ] The command used to run your program (e.g., `./run-fpm.sh run`), and - [ ] A minimal reproducer: if possible, fewer than 50 lines demonstrating an issue. ## Contributing Code or Documentation @@ -31,7 +31,7 @@ To contribute, please follow these steps: - [ ] Follow the coding conventions in [docs/README-maintainers.md](./docs/README-maintainers.md). - [ ] Make your commits logically atomic, self-consistent, and cohesive. - [ ] Add one or more unit tests in the `test` subdirectory to verify your fix or feature. -- [ ] Ensure that your branch passes all tests (via `./build/run-fpm.sh test` with appropriate flags). +- [ ] Ensure that your branch passes all tests (via `./run-fpm.sh test` with appropriate flags). - [ ] Update the [README.md](./README.md) if your branch affects anything described there. - [ ] Push your branch to your fork. - [ ] Open a [Pull Request](https://github.com/berkeleylab/caffeine/pulls) (PR) against an existing branch of the Berkeley Lab [Caffeine repository](https://github.com/berkeleylab/caffeine). diff --git a/README.md b/README.md index 22c8e8380..eacdf91c9 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Here is an outline of the basic commands used to build Caffeine and run an examp git clone https://github.com/BerkeleyLab/caffeine.git cd caffeine env FC= CC= CXX= ./install.sh -env CAF_IMAGES=8 ./build/run-fpm.sh run --example hello +env CAF_IMAGES=8 ./run-fpm.sh run --example hello ``` The provided compilers MUST be "compatible": for the best experience you are @@ -125,7 +125,7 @@ using Fortran's multi-image features to print a message from each image. Run tests --------- ``` -./build/run-fpm.sh test +./run-fpm.sh test ``` Recognized Environment Variables diff --git a/install.sh b/install.sh index 22572c2d3..fde5ec8e0 100755 --- a/install.sh +++ b/install.sh @@ -413,16 +413,17 @@ if [ "$GASNET_CC_REAL" != "$FPM_CC" ]; then exit 1; fi -echo "# DO NOT EDIT OR COMMIT -- Created by caffeine/install.sh" > build/fpm.toml -cp manifest/fpm.toml.template build/fpm.toml +FPM_TOML="fpm.toml" +rm -f $FPM_TOML +echo "# DO NOT EDIT OR COMMIT -- Created by caffeine/install.sh" > $FPM_TOML +cat manifest/fpm.toml.template >> $FPM_TOML GASNET_LIB_LOCATIONS=`echo $GASNET_LIBS | awk '{locs=""; for(i = 1; i <= NF; i++) if ($i ~ /^-L/) {locs=(locs " " $i);}; print locs; }'` GASNET_LIB_NAMES=`echo $GASNET_LIBS | awk '{names=""; for(i = 1; i <= NF; i++) if ($i ~ /^-l/) {names=(names " " $i);}; print names; }' | sed 's/-l//g'` if [[ $GASNET_CONDUIT == "udp" ]] ; then GASNET_LIB_NAMES+=" stdc++" # udp-conduit requires C++ libraries fi FPM_TOML_LINK_ENTRY="link = [\"$(echo ${GASNET_LIB_NAMES} | sed 's/ /", "/g')\"]" -echo "${FPM_TOML_LINK_ENTRY}" >> build/fpm.toml -ln -f -s build/fpm.toml +echo "${FPM_TOML_LINK_ENTRY}" >> $FPM_TOML CAFFEINE_PC="$PREFIX/lib/pkgconfig/caffeine.pc" cat << EOF > $CAFFEINE_PC @@ -485,7 +486,7 @@ case $GASNET_CONDUIT in ;; esac -RUN_FPM_SH="build/run-fpm.sh" +RUN_FPM_SH="run-fpm.sh" cat << EOF > $RUN_FPM_SH #!/bin/sh #-- DO NOT EDIT -- created by caffeine/install.sh @@ -497,7 +498,7 @@ if echo "--help -help --version -version --list -list new update list clean publ set -x exec \$fpm "\$fpm_sub_cmd" "\$@" elif echo "build test run install" | grep -w -q -e "\$fpm_sub_cmd" ; then - sed -i.bak 's/^link = .*\$/$FPM_TOML_LINK_ENTRY/' build/fpm.toml + sed -i 's/^link = .*\$/$FPM_TOML_LINK_ENTRY/' $FPM_TOML if test -n "$GASNET_RUNNER_ARG" && echo "test run" | grep -w -q -e "\$fpm_sub_cmd" ; then set -- "--runner=$GASNET_RUNNER_ARG" "\$@" fi @@ -517,6 +518,8 @@ else fi EOF chmod u+x $RUN_FPM_SH +# for backwards-compatibility of instructions/scripting: +( cd build && ln -f -s ../$RUN_FPM_SH run-fpm.sh ) ./$RUN_FPM_SH build $VERBOSE @@ -540,7 +543,7 @@ Caffeine is now installed in $PREFIX To rebuild or to run tests or examples via the Fortran Package Manager (fpm) with the required compiler/linker flags, pass a -fpm command to the build/run-fpm.sh script. For example, run +fpm command to the run-fpm.sh script. For example, run the program example/hello.f90 as follows: ./$RUN_FPM_SH run --example hello diff --git a/src/caffeine/unit_test_parameters_m.F90 b/src/caffeine/unit_test_parameters_m.F90 index 3815a0ca8..8a391857d 100644 --- a/src/caffeine/unit_test_parameters_m.F90 +++ b/src/caffeine/unit_test_parameters_m.F90 @@ -57,7 +57,7 @@ function subjob_setup() result(result_) if (len(subjob_prefix) > 0) subjob_prefix = subjob_prefix//" " end if if (.not. allocated(fpm_driver)) then - call getenv_withdefault("FPM_DRIVER", "./build/run-fpm.sh", fpm_driver) + call getenv_withdefault("FPM_DRIVER", "./run-fpm.sh", fpm_driver) end if call prif_sync_all()