Skip to content

Automatically rebuild unit testing build directory with each unit/functional testing run #1442

@glemieux

Description

@glemieux

Describe the changes

If possible, automatically rebuild the _build directory. This could be achieved simply by rm -rf the build directory with each call to the main script.

Is your request related to a problem?

I ran into #1441 due to an out-of-date env_mach_specific.xml in the _build directory of the fates base directory.

Alternative options

It might be possible that the machine config file is the only thing not being rebuilt. Looking at the CIME code it appears that this warning is found in the configure.py module: https://github.com/ESMCI/cime/blob/61a98165c0733ce8a7793c731bfee3def9c70d01/CIME/BuildTools/configure.py#L193-L199

Per conversations with @adrifoster about #1428, we currently use the configure (and other CIME functions) to get the cmake argument list values. If we could avoid using these CIME calls, this would also avoid the issue.

# create the environment, and the Macros.cmake file
configure(
machobj,
build_dir,
["CMake"],
compiler,
mpilib,
True,
"nuopc",
os_,
unit_testing=True,
)
machspecific = EnvMachSpecific(build_dir, unit_testing=True)
# make a fake case
fake_case = FakeCase(compiler, mpilib, True, "nuopc", threading=False)
machspecific.load_env(fake_case)
# create cmake argument list with information from the fake case and machine object
cmake_args_list = [
f"-DOS={os_}",
f"-DMACH={machobj.get_machine_name()}",
f"-DCOMPILER={compiler}",
f"-DDEBUG={stringify_bool(True)}",
f"-DMPILIB={mpilib}",
f"-Dcompile_threaded={stringify_bool(False)}",
f"-DCASEROOT={build_dir}"
]
cmake_args = " ".join(cmake_args_list)
return cmake_args

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: testingRelated to improvements in code testing (e.g. unit, regression, etc)

    Projects

    Status

    ✔ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions