Skip to content

Commit

Permalink
Fix test error (#291)
Browse files Browse the repository at this point in the history
jasonjunweilyu authored Mar 25, 2024
1 parent b86187e commit 728889d
Showing 5 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ contains
! Set the new field to a constant value and compute the divergence of it
divergence => get_div()
s = 2.0_r_def
call invoke( name = "Compute divergence", &
call invoke( name = "Compute_divergence", &
setval_c(field_2, s ), &
setval_c(field_1, 0.0_r_def), &
my_kernel_type(field_1, field_2, divergence) )
Original file line number Diff line number Diff line change
@@ -154,23 +154,29 @@ def test_run(self, config):
# if these files exist after the run then we know:
# a) the expected files were created
# b) the prebuilds were protected from automatic cleanup
expect_files = [
# there should be an f90 and a _psy.f90 built from the x90
config.build_output / 'algorithm/algorithm_mod.f90',
config.build_output / 'algorithm/algorithm_mod_psy.f90',

expect_prebuild_files = [
# Expect these prebuild files
# todo: the kernal hash differs between fpp and cpp, perhaps just use wildcards.
config.prebuild_folder / 'algorithm_mod.1602753696.an', # x90 analysis result
config.prebuild_folder / 'my_kernel_mod.4187107526.an', # kernel analysis results
config.prebuild_folder / 'algorithm_mod.5088673431.f90', # prebuild
config.prebuild_folder / 'algorithm_mod_psy.5088673431.f90', # prebuild
# The kernel hash differs between fpp and cpp, so just use wildcards.
'algorithm_mod.*.an', # x90 analysis result
'my_kernel_mod.*.an', # kernel analysis results
'algorithm_mod.*.f90', # prebuild
'algorithm_mod_psy.*.f90', # prebuild
]

expect_build_files = [
# there should be an f90 and a _psy.f90 built from the x90
'algorithm/algorithm_mod.f90',
'algorithm/algorithm_mod_psy.f90',
]

assert all(not f.exists() for f in expect_files)
# Glob returns a generator, which can't simply be tested if it's empty.
# So use a list instead:
assert all(list(config.prebuild_folder.glob(f)) == [] for f in expect_prebuild_files)
assert all(list(config.build_output.glob(f)) == [] for f in expect_build_files)
with config:
self.steps(config)
assert all(f.exists() for f in expect_files)
assert all(list(config.prebuild_folder.glob(f)) != [] for f in expect_prebuild_files)
assert all(list(config.build_output.glob(f)) != [] for f in expect_build_files)

def test_prebuild(self, tmp_path, config):
with config:
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 728889d

Please sign in to comment.