Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability for create_test to infer non-default machine from tests #1597

Merged
merged 1 commit into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/create_test
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ OR

logger.info("Testnames: %s" % test_names)
else:
if args.machine is None:
args.machine = update_acme_tests.infer_machine_name_from_tests(args.testargs)

mach_obj = Machines(machine=args.machine)
args.compiler = mach_obj.get_default_compiler() if args.compiler is None else args.compiler

Expand Down
32 changes: 31 additions & 1 deletion scripts/lib/update_acme_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CIME.utils
from CIME.utils import expect, convert_to_seconds
from CIME.utils import expect, convert_to_seconds, parse_test_name
from CIME.XML.machines import Machines

# Here are the tests belonging to acme suites. Format is
Expand Down Expand Up @@ -210,6 +210,36 @@ def get_test_suites():
###############################################################################
return _TEST_SUITES.keys()

###############################################################################
def infer_machine_name_from_tests(testargs):
###############################################################################
"""
>>> infer_machine_name_from_tests(["NCK.f19_g16_rx1.A.melvin_gnu"])
'melvin'
>>> infer_machine_name_from_tests(["NCK.f19_g16_rx1.A"])
>>> infer_machine_name_from_tests(["NCK.f19_g16_rx1.A", "NCK.f19_g16_rx1.A.melvin_gnu"])
'melvin'
>>> infer_machine_name_from_tests(["NCK.f19_g16_rx1.A.melvin_gnu", "NCK.f19_g16_rx1.A.melvin_gnu"])
'melvin'
"""
acme_test_suites = get_test_suites()

machine = None
for testarg in testargs:
testarg = testarg.strip()
if testarg.startswith("^"):
testarg = testarg[1:]

if testarg not in acme_test_suites:
machine_for_this_test = parse_test_name(testarg)[4]
if machine_for_this_test is not None:
if machine is None:
machine = machine_for_this_test
else:
expect(machine == machine_for_this_test, "Must have consistent machine '%s' != '%s'" % (machine, machine_for_this_test))

return machine

###############################################################################
def get_full_test_names(testargs, machine, compiler):
###############################################################################
Expand Down