Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into nonBous_OBCs
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallward authored Oct 6, 2023
2 parents b6319f8 + a41d0a0 commit 477e511
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 57 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ jobs:
- name: Report coverage to CI (PR)
if: github.event_name == 'pull_request'
run: make report.cov REQUIRE_COVERAGE_UPLOAD=true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Report coverage to CI (Push)
if: github.event_name != 'pull_request'
run: make report.cov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10 changes: 9 additions & 1 deletion .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,21 @@ endef

# Upload coverage reports
CODECOV_UPLOADER_URL ?= https://uploader.codecov.io/latest/linux/codecov
CODECOV_TOKEN ?=

ifdef CODECOV_TOKEN
CODECOV_TOKEN_ARG = -t $(CODECOV_TOKEN)
else
CODECOV_TOKEN_ARG =
endif

codecov:
curl -s $(CODECOV_UPLOADER_URL) -o $@
chmod +x codecov

.PHONY: report.cov
report.cov: run.cov codecov
./codecov -R build/cov -Z -f "*.gcov" \
./codecov $(CODECOV_TOKEN_ARG) -R build/cov -Z -f "*.gcov" \
> build/cov/codecov.out \
2> build/cov/codecov.err \
&& echo -e "${MAGENTA}Report uploaded to codecov.${RESET}" \
Expand Down
35 changes: 25 additions & 10 deletions ac/makedep
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ def create_deps(src_dirs, makefile, debug, exec_target, fc_rule,
dep for pair in zip(found_mods, found_objs) for dep in pair
]
missing_mods = [m for m in o2uses[o] if m not in all_modules]
incs = nested_inc(o2h[o] + o2inc[o], f2F)

incs, inc_used = nested_inc(o2h[o] + o2inc[o], f2F)
inc_mods = [u for u in inc_used if u not in found_mods and u in all_modules]

incdeps = sorted(set([f2F[f] for f in incs if f in f2F]))
incargs = sorted(set(['-I'+os.path.dirname(f) for f in incdeps]))
if debug:
Expand All @@ -167,7 +170,7 @@ def create_deps(src_dirs, makefile, debug, exec_target, fc_rule,
print("# program:", ' '.join(o2prg[o]), file=file)
if o2mods[o]:
print(' '.join(o2mods[o])+':', o, file=file)
print(o + ':', o2F90[o], ' '.join(incdeps+found_deps), file=file)
print(o + ':', o2F90[o], ' '.join(inc_mods + incdeps + found_deps), file=file)
print('\t'+fc_rule, ' '.join(incargs), file=file)

# Write rule for each object from C
Expand Down Expand Up @@ -243,21 +246,30 @@ def link_obj(obj, o2uses, mod2o, all_modules):
def nested_inc(inc_files, f2F):
"""List of all files included by "inc_files", either by #include or F90
include."""
hlst = []
used_mods = set()

def recur(hfile):
if hfile not in f2F.keys():
return
_, _, cpp, inc, _, _ = scan_fortran_file(f2F[hfile])

_, used, cpp, inc, _, _ = scan_fortran_file(f2F[hfile])

# Record any module updates inside of include files
used_mods.update(used)

if len(cpp) + len(inc) > 0:
for h in cpp+inc:
if h not in hlst and h in f2F.keys():
recur(h)
hlst.append(h)
return
return
hlst = []

for h in inc_files:
recur(h)
return inc_files + sorted(set(hlst))

return inc_files + sorted(set(hlst)), used_mods


def scan_fortran_file(src_file):
Expand All @@ -268,8 +280,10 @@ def scan_fortran_file(src_file):
lines = file.readlines()

external_namespace = True
# True if we are in the external (i.e. global) namespace

file_has_externals = False
# True if the file contains any external objects

for line in lines:
match = re_module.match(line.lower())
Expand Down Expand Up @@ -321,17 +335,18 @@ def object_file(src_file):
def find_files(src_dirs):
"""Return sorted list of all source files starting from each directory in
the list "src_dirs"."""

# TODO: Make this a user-defined argument
extensions = ('.f90', '.f', '.c', '.inc', '.h', '.fh')

files = []

for path in src_dirs:
if not os.path.isdir(path):
raise ValueError("Directory '{}' was not found".format(path))
for p, d, f in os.walk(os.path.normpath(path), followlinks=True):
for file in f:
# TODO: use any()
if (file.endswith('.F90') or file.endswith('.f90')
or file.endswith('.f') or file.endswith('.F')
or file.endswith('.h') or file.endswith('.inc')
or file.endswith('.c') or file.endswith('.H')):
if any(file.lower().endswith(ext) for ext in extensions):
files.append(p+'/'+file)
return sorted(set(files))

Expand Down
2 changes: 1 addition & 1 deletion src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,7 @@ subroutine MOM_temp_salt_initialize_from_Z(h, tv, depth_tot, G, GV, US, PF, just
call get_param(PF, mdl, "Z_INIT_REMAP_GENERAL", remap_general, &
"If false, only initializes to z* coordinates. "//&
"If true, allows initialization directly to general coordinates.", &
default=.false., do_not_log=just_read)
default=.not.(GV%Boussinesq.or.GV%semi_Boussinesq) , do_not_log=just_read)
call get_param(PF, mdl, "Z_INIT_REMAP_FULL_COLUMN", remap_full_column, &
"If false, only reconstructs profiles for valid data points. "//&
"If true, inserts vanished layers below the valid data.", &
Expand Down
Loading

0 comments on commit 477e511

Please sign in to comment.