Skip to content

Commit de47b0d

Browse files
committed
Merge remote-tracking branch 'origin' into vehre/issue-260-async-alloc-and-is-present
2 parents 308985c + 3424feb commit de47b0d

File tree

7 files changed

+84
-25
lines changed

7 files changed

+84
-25
lines changed

.VERSION

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# OpenCoarrays version file. Odd patch levels indicate inter-release
2-
# version, i.e., code is from SCM/git. This project uses semantic
3-
# versioning. For details see http://semver.org
1+
$Format:%d%n%n$
2+
# Fall back version, probably last release:
3+
1.8.12
44

5-
1.8.11
5+
# OpenCoarrays version file. This project uses semantic
6+
# versioning. For details see http://semver.org
7+
#
8+
# Release archive created from commit:
9+
# $Format:%H %d$
10+
# $Format:Created on %ci by %cN, and$
11+
# $Format:signed by %GS using %GK.$
12+
# $Format:Signature status: %G?$
13+
$Format:%GG$

.gitattributes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ prerequisites/build text
3131
developer-scripts export-ignore
3232
codecov.yml export-ignore
3333
*.enc export-ignore
34-
.github
34+
.github export-ignore
35+
36+
# Perform substitutions when `git export`ing these files
37+
.VERSION export-subst

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ after_script:
204204
- |
205205
set -o errexit
206206
if [[ "${TRAVIS_TAG}" ]]; then
207-
if [[ "v${TRAVIS_TAG}" != "v$(sed -n 's/\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)/\1/p' .VERSION)" ]]; then
207+
if [[ "v${TRAVIS_TAG}" != "v$(sed -n '/[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}/{s/^\([^.]*\)\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)\(.*\)/\2/p;q;}' .VERSION)" ]]; then
208208
echo "ERROR: You are trying to tag a new release but have a version missmatch in \`.VERSION\`"
209209
false # throw an error
210210
fi

CMakeLists.txt

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYP
99
# Add option and check environment to determine if developer tests should be run
1010
if($ENV{OPENCOARRAYS_DEVELOPER})
1111
option(CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" ON)
12+
message( STATUS "OpenCoarrays developer tests turned on")
1213
else()
1314
option(CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" OFF)
1415
endif()
@@ -20,11 +21,51 @@ endif()
2021

2122
# Name project and specify source languages
2223
# Parse version from .VERSION file so that more info can be added and easier to get from scripts
23-
file( STRINGS ".VERSION" OpenCoarraysVersion
24+
file(STRINGS ".VERSION" first_line
25+
LIMIT_COUNT 1
26+
)
27+
28+
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
29+
OpenCoarraysVersion "${first_line}")
30+
31+
if((NOT (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) AND (EXISTS "${CMAKE_SOURCE_DIR}/.git"))
32+
message( STATUS "Build from git repository detected")
33+
find_package(Git)
34+
if(GIT_FOUND)
35+
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --abbrev=0
36+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
37+
RESULT_VARIABLE git_status
38+
OUTPUT_VARIABLE git_output
39+
OUTPUT_STRIP_TRAILING_WHITESPACE)
40+
if((git_status STREQUAL "0") AND (git_output MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+"))
41+
set(OpenCoarraysVersion "${git_output}")
42+
endif()
43+
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always --dirty
44+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
45+
RESULT_VARIABLE git_status
46+
OUTPUT_VARIABLE full_git_describe
47+
OUTPUT_STRIP_TRAILING_WHITESPACE)
48+
if(NOT (git_status STREQUAL "0"))
49+
set(full_git_describe NOTFOUND)
50+
endif()
51+
else()
52+
message( WARNING "Could not find git executable!")
53+
endif()
54+
endif()
55+
56+
if(NOT (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+"))
57+
message( WARNING "Could not extract version from git, falling back on .VERSION, line 3.")
58+
file(STRINGS ".VERSION" OpenCoarraysVersion
2459
REGEX "[0-9]+\\.[0-9]+\\.[0-9]+"
25-
)
60+
)
61+
endif()
62+
63+
if(NOT full_git_describe)
64+
set(full_git_describe ${OpenCoarraysVersion})
65+
endif()
66+
2667
project(opencoarrays VERSION "${OpenCoarraysVersion}" LANGUAGES C Fortran)
27-
message( STATUS "Building OpenCoarrays version: ${OpenCoarraysVersion}" )
68+
message( STATUS "Building OpenCoarrays version: ${full_git_describe}" )
2869

2970
#Print an error message on an attempt to build inside the source directory tree:
3071
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
@@ -552,18 +593,19 @@ if(opencoarrays_aware_compiler)
552593
add_mpi_test(image_status_test_1 4 ${tests_root}/unit/fail_images/image_status_test_1)
553594
if(CAF_ENABLE_FAILED_IMAGES)
554595
# No other way to check that image_fail_test_1 passes.
555-
add_fault_tolerant_mpi_test(image_fail_test_1 4 ${tests_root}/unit/fail_images/image_fail_test_1)
556-
set_property(TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed")
557-
set_property(TEST image_fail_test_1 PROPERTY PASS_REGULAR_EXPRESSION "Test passed")
558-
add_fault_tolerant_mpi_test(image_fail_and_sync_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_1)
559-
if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})
596+
if ((NOT $ENV{TRAVIS}) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}))
597+
add_fault_tolerant_mpi_test(image_fail_test_1 4 ${tests_root}/unit/fail_images/image_fail_test_1)
598+
set_property(TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed")
599+
set_property(TEST image_fail_test_1 PROPERTY PASS_REGULAR_EXPRESSION "Test passed")
600+
add_fault_tolerant_mpi_test(image_fail_and_sync_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_1)
560601
add_fault_tolerant_mpi_test(image_fail_and_sync_test_2 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_2)
602+
603+
add_fault_tolerant_mpi_test(image_fail_and_sync_test_3 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_3)
604+
add_fault_tolerant_mpi_test(image_fail_and_status_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_status_test_1)
605+
add_fault_tolerant_mpi_test(image_fail_and_failed_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_failed_images_test_1)
606+
add_fault_tolerant_mpi_test(image_fail_and_stopped_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_stopped_images_test_1)
607+
add_fault_tolerant_mpi_test(image_fail_and_get_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_get_test_1)
561608
endif()
562-
add_fault_tolerant_mpi_test(image_fail_and_sync_test_3 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_3)
563-
add_fault_tolerant_mpi_test(image_fail_and_status_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_status_test_1)
564-
add_fault_tolerant_mpi_test(image_fail_and_failed_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_failed_images_test_1)
565-
add_fault_tolerant_mpi_test(image_fail_and_stopped_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_stopped_images_test_1)
566-
add_fault_tolerant_mpi_test(image_fail_and_get_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_get_test_1)
567609
endif()
568610
endif()
569611
else()

install.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,11 @@ source $opencoarrays_src_dir/prerequisites/install-functions/report_results.sh
240240

241241
if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
242242

243-
# Print script copyright if invoked with -v, -V, or --version argument
244-
opencoarrays_version=$(sed -n 's/\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)/\1/p' "${opencoarrays_src_dir%/}/.VERSION")
243+
# Print script copyright & version if invoked with -v, -V, or
244+
# --version argument git attributes handle .VERSION, making it more
245+
# robust, but fallback version is still manually included. Search
246+
# for the first version string we encounter and extract it using sed:
247+
opencoarrays_version=$(sed -n '/[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}/{s/^\([^.]*\)\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)\(.*\)/\2/p;q;}' "${opencoarrays_src_dir%/}/.VERSION")
245248
if [[ "${arg_v}" == "${__flag_present}" ]]; then
246249
echo "OpenCoarrays ${opencoarrays_version}"
247250
echo ""

prerequisites/check_version.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ elif [[ $1 == '--list' || $1 == '-l' ]]; then
8181
exit 40
8282

8383
elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
84-
# Print script copyright if invoked with -v, -V, or --version argument
85-
opencoarrays_version=$(sed -n 's/\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)/\1/p' ../.VERSION)
84+
# Print script copyright if invoked with -v, -V, or --version
85+
# argument Extract version from .VERSION file. Git automatically
86+
# inserts various things when performing git archive, so ensure we
87+
# extract just the first version string
88+
opencoarrays_version=$(sed -n '/[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}/{s/^\([^.]*\)\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)\(.*\)/\2/p;q;}' ../.VERSION)
8689
echo "opencoarrays $opencoarrays_version"
8790
echo ""
8891
echo "OpenCoarrays prerequisite version verifier"

src/mpi/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/caf-head CAF_HEADER)
144144
file(WRITE "${compiler_wrapper}" "${CAF_HEADER}\n")
145145
file(APPEND "${compiler_wrapper}" "caf_mod_dir=\"${CMAKE_INSTALL_FULL_INCLUDEDIR}/mod\"\n")
146146
file(APPEND "${compiler_wrapper}" "caf_lib_dir=\"${CMAKE_INSTALL_FULL_LIBDIR}\"\n")
147-
file(APPEND "${compiler_wrapper}" "caf_version=${PROJECT_VERSION}\n")
147+
file(APPEND "${compiler_wrapper}" "caf_version=${full_git_describe}\n")
148148
if(gfortran_compiler)
149149
file(APPEND "${compiler_wrapper}" "link_args='-fcoarray=lib -lcaf_mpi'\n")
150150
elseif(portland_group_compiler)
@@ -175,7 +175,7 @@ install(
175175
)
176176
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/cafrun-head CAFRUN_HEADER)
177177
file(WRITE "${caf_launcher}" "${CAFRUN_HEADER}\n")
178-
file(APPEND "${caf_launcher}" "caf_version=${PROJECT_VERSION}\n")
178+
file(APPEND "${caf_launcher}" "caf_version=${full_git_describe}\n")
179179
file(APPEND "${caf_launcher}" "CAFRUN=${MPIEXEC}\n")
180180

181181
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/cafrun-foot FOOTER)

0 commit comments

Comments
 (0)