Skip to content

Commit

Permalink
Use a function to print submodule hashes in integration tests
Browse files Browse the repository at this point in the history
test/shared/commonFunctionsForTests.sh
- Add "print_submodule_head_commits" function to print the commit
  hash & description at the head of each submodule

test/integration/GCClassic/integrationTestCreate.sh
test/integration/GCClassic/integrationTestCompile.sh
test/integration/GCClassic/integrationTestExecute.sh
test/integration/GCHP/integrationTestCreate.sh
test/integration/GCHP/integrationTestCompile.sh
test/integration/GCHP/integrationTestExecute.sh
- Now call print_submodule_head_commits instead of using inlined code

Signed-off-by: Bob Yantosca <[email protected]>
  • Loading branch information
yantosca committed Jul 26, 2024
1 parent d67ff08 commit 866a7c0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 74 deletions.
12 changes: 1 addition & 11 deletions test/integration/GCClassic/integrationTestCompile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ site=$(get_site_name)
# All integration tests will use debugging features
baseOptions="-DCMAKE_BUILD_TYPE=Debug -DRUNDIR='' -DINSTALLCOPY=${binDir}"

# Get the Git commit of the superproject and submodules
head_gcc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}" log --oneline --no-decorate -1)
head_gc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}/src/GEOS-Chem" log --oneline --no-decorate -1)
head_hco=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}/src/HEMCO" log --oneline --no-decorate -1)

# Site-specific settings
if [[ "X${site}" == "XCANNON" && "X${SLURM_JOBID}" != "X" ]]; then

Expand Down Expand Up @@ -133,9 +125,7 @@ rm -f ${results}
print_to_log "${SEP_MAJOR}" "${results}"
print_to_log "GEOS-Chem Classic: Compilation Test Results" "${results}"
print_to_log "" "${results}"
print_to_log "GCClassic #${head_gcc}" "${results}"
print_to_log "GEOS-Chem #${head_gc}" "${results}"
print_to_log "HEMCO #${head_hco}" "${results}"
print_submodule_head_commits "10" "${codeDir}" "${results}"
print_to_log "" "${results}"
print_to_log "Using ${OMP_NUM_THREADS} OpenMP threads" "${results}"
print_to_log "Number of compilation tests: ${numTests}" "${results}"
Expand Down
21 changes: 8 additions & 13 deletions test/integration/GCClassic/integrationTestCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,11 @@ cd ${superProjectDir}

# GEOS-Chem and HEMCO submodule directories
geosChemDir="${superProjectDir}/src/GEOS-Chem"
hemcoDir="${superProjectDir}/src/HEMCO"

# Get the Git commit of the superproject and submodules
head_gcc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${superProjectDir}" log --oneline --no-decorate -1)
head_gc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${geosChemDir}" log --oneline --no-decorate -1)
head_hco=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${hemcoDir}" log --oneline --no-decorate -1)

# Echo header
printf "${SEP_MAJOR}\n"
printf "Creating GEOS-Chem Classic Integration Tests\n\n"
printf "GCClassic #${head_gcc}\n"
printf "GEOS-Chem #${head_gc}\n"
printf "HEMCO #${head_hco}\n"
print_submodule_head_commits "10" "${superProjectDir}" ""
printf "${SEP_MAJOR}\n"

#=============================================================================
Expand Down Expand Up @@ -299,9 +288,15 @@ if [[ "X${testsToRun}" == "XALL" ]]; then
# Simulation with all diagnostics on
#==========================================================================

# Copy the fullchem_benchmark rundir to fullchem_alldiags
cd ${rundirsDir}/
cp -r gc_4x5_merra2_fullchem_benchmark gc_4x5_merra2_fullchem_alldiags
sed_ie "s|#'|'|" gc_4x5_merra2_fullchem_alldiags/HISTORY.rc

# Turn on all collections except RRTMG and Tomas collections (which
# Make sure to activate these in the RRTMG and TOMAS integration tests.
sed_ie "s|#'|'|" gc_4x5_merra2_fullchem_alldiags/HISTORY.rc
sed_ie "s|'RRTMG'|#'RRTMG'|" gc_4x5_merra2_fullchem_alldiags/HISTORY.rc
sed_ie "s|'Tomas'|#'Tomas'|" gc_4x5_merra2_fullchem_alldiags/HISTORY.rc

# Switch back to the present directory
cd "${thisDir}"
Expand Down
12 changes: 1 addition & 11 deletions test/integration/GCClassic/integrationTestExecute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ site=$(get_site_name)
. ~/.bashrc > /dev/null 2>&1
[[ "X${site}" == "XCANNON" ]] && . ${envDir}/gcclassic.env > /dev/null 2>&1

# Get the Git commit of the superproject and submodules
head_gcc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}" log --oneline --no-decorate -1)
head_gc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}/src/GEOS-Chem" log --oneline --no-decorate -1)
head_hco=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}/src/HEMCO" log --oneline --no-decorate -1)

# Site-specific settings
if [[ "X${site}" == "XCANNON" && "X${SLURM_JOBID}" != "X" ]]; then

Expand Down Expand Up @@ -117,9 +109,7 @@ rm -f "${results}"
print_to_log "${SEP_MAJOR}" "${results}"
print_to_log "GEOS-Chem Classic: Execution Test Results" "${results}"
print_to_log "" "${results}"
print_to_log "GCClassic #${head_gcc}" "${results}"
print_to_log "GEOS-Chem #${head_gc}" "${results}"
print_to_log "HEMCO #${head_hco}" "${results}"
print_submodule_head_commits "10" "${codeDir}" "${results}"
print_to_log "" "${results}"
print_to_log "Using ${OMP_NUM_THREADS} OpenMP threads" "${results}"
print_to_log "Number of execution tests: ${numTests}" "${results}"
Expand Down
14 changes: 1 addition & 13 deletions test/integration/GCHP/integrationTestCompile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ site=$(get_site_name)
# All integration tests will use debugging features
baseOptions="-DCMAKE_BUILD_TYPE=Debug -DRUNDIR='' -DINSTALLCOPY=${binDir}"

# Get the Git commit of the superproject and submodules
head_gchp=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}" log --oneline --no-decorate -1)
head_gc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}/src/GCHP_GridComp/GEOSChem_GridComp/geos-chem" \
log --oneline --no-decorate -1)
head_hco=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}/src/GCHP_GridComp/HEMCO_GridComp/HEMCO" \
log --oneline --no-decorate -1)

# Site-specific settings
if [[ "X${site}" == "XCANNON" && "X${SLURM_JOBID}" != "X" ]]; then

Expand Down Expand Up @@ -135,9 +125,7 @@ rm -f "${results}"
print_to_log "${SEP_MAJOR}" "${results}"
print_to_log "GCHP: Compilation Test Results" "${results}"
print_to_log "" "${results}"
print_to_log "GCHP #${head_gchp}" "${results}"
print_to_log "GEOS-Chem #${head_gc}" "${results}"
print_to_log "HEMCO #${head_hco}" "${results}"
print_submodule_head_commits "15" "${codeDir}" "${results}"
print_to_log "" "${results}"
print_to_log "Number of compilation tests: ${numTests}" "${results}"
print_to_log "" "${results}"
Expand Down
13 changes: 1 addition & 12 deletions test/integration/GCHP/integrationTestCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,11 @@ cd "${superProjectDir}"

# GEOS-Chem and HEMCO submodule directories
geosChemDir="${superProjectDir}/src/GCHP_GridComp/GEOSChem_GridComp/geos-chem"
hemcoDir="${superProjectDir}/src/GCHP_GridComp/HEMCO_GridComp/HEMCO"

# Get the Git commit of the superproject and submodules
head_gchp=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${superProjectDir}" log --oneline --no-decorate -1)
head_gc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${geosChemDir}" log --oneline --no-decorate -1)
head_hco=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${hemcoDir}" log --oneline --no-decorate -1)

# Echo header
printf "${SEP_MAJOR}\n"
printf "Creating GCHP Integration Tests\n\n"
printf "GCHP #${head_gchp}\n"
printf "GEOS_Chem #${head_gc}\n"
printf "HEMCO #${head_hco}\n"
print_submodule_head_commits "10" "${superProjectDir}" ""
printf "${SEP_MAJOR}\n"

#=============================================================================
Expand Down
14 changes: 1 addition & 13 deletions test/integration/GCHP/integrationTestExecute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ site=$(get_site_name)
. ~/.bashrc > /dev/null 2>&1
[[ "X${site}" == "XCANNON" ]] && . ${envDir}/gchp.env > /dev/null 2>&1

# Get the Git commit of the superproject and submodules
head_gchp=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}" log --oneline --no-decorate -1)
head_gc=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}/src/GCHP_GridComp/GEOSChem_GridComp/geos-chem" \
log --oneline --no-decorate -1)
head_hco=$(export GIT_DISCOVERY_ACROSS_FILESYSTEM=1; \
git -C "${codeDir}/src/GCHP_GridComp/HEMCO_GridComp/HEMCO" \
log --oneline --no-decorate -1)

# Site-specific settings
if [[ "X${site}" == "XCANNON" && "X${SLURM_JOBID}" != "X" ]]; then

Expand Down Expand Up @@ -128,9 +118,7 @@ rm -f "${results}"
print_to_log "${SEP_MAJOR}" "${results}"
print_to_log "GCHP: Execution Test Results" "${results}"
print_to_log "" "${results}"
print_to_log "GCHP #${head_gchp}" "${results}"
print_to_log "GEOS-Chem #${head_gc}" "${results}"
print_to_log "HEMCO #${head_hco}" "${results}"
print_submodule_head_commits "10" "${codeDir}" "${results}"
print_to_log "" "${results}"
print_to_log "Number of execution tests: ${numTests}" "${results}"
print_to_log "" "${results}"
Expand Down
2 changes: 1 addition & 1 deletion test/shared/commonFunctionsForTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ function print_submodule_head_commits() {
else
echo "${y:0:n_pad}${pad:0:$((n_pad - ${#y}))}: $head" >> "${3}"
fi

fi
fi
fi
Expand Down

0 comments on commit 866a7c0

Please sign in to comment.