From 08120038d98eaa3ace5ba1a66db9042b7793611b Mon Sep 17 00:00:00 2001 From: Nic Hannah Date: Sun, 3 Apr 2016 16:06:31 +1000 Subject: [PATCH] Add time/date to run script, improve test scripts. Closes #139. --- exp/MOM_run.csh | 4 ++-- test/model_test_setup.py | 10 ++++++++-- test/platform.py | 2 +- test/test_run.py | 2 +- test/test_run_outputs.py | 2 +- test/test_run_setup.py | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/exp/MOM_run.csh b/exp/MOM_run.csh index 84d562ed27..f0badc2e2d 100755 --- a/exp/MOM_run.csh +++ b/exp/MOM_run.csh @@ -212,7 +212,7 @@ if ( $debug ) then set runCommand = "$mpirunCommand --debug $npes $executable >fms.out" endif -echo "About to run experiment $name with model $type. The command is: $runCommand" +echo "About to run experiment $name with model $type at `date`. The command is: $runCommand" if ( $valid_npes ) then echo "ERROR: This experiment is designed to run on $valid_npes pes. Please specify --npes $valid_npes " @@ -324,7 +324,7 @@ end unset echo echo end_of_run -echo "NOTE: Natural end-of-script for experiment $name with model $type." +echo "NOTE: Natural end-of-script for experiment $name with model $type at `date`" exit 0 diff --git a/test/model_test_setup.py b/test/model_test_setup.py index f0f7ad80b5..17d7365f73 100644 --- a/test/model_test_setup.py +++ b/test/model_test_setup.py @@ -171,12 +171,18 @@ def run(self, model_type, exp, walltime='01:00:00', ncpus='32', return (ret, stdout, stderr) - def build(self, model_type): + def build(self, model_type, unit_testing=True): os.chdir(self.exp_dir) + if unit_testing: + unit_testing = '--unit_testing' + else: + unit_testing ='' + platform = self.get_platform() - build_cmd = plat.build_cmd.format(type=model_type, platform=platform) + build_cmd = plat.build_cmd.format(type=model_type, platform=platform, + unit_testing=unit_testing) # Build the model. ret = sp.call(shlex.split(build_cmd)) diff --git a/test/platform.py b/test/platform.py index 9265e69886..0b75131ce5 100644 --- a/test/platform.py +++ b/test/platform.py @@ -18,4 +18,4 @@ ./MOM_run.csh --platform nci --type {type} --experiment {exp} {npes} {valgrind} """ -build_cmd = " ./MOM_compile.csh --platform {platform} --type {type} --unit_testing" +build_cmd = " ./MOM_compile.csh --platform {platform} --type {type} {unit_testing}" diff --git a/test/test_run.py b/test/test_run.py index 2d8315ce3e..8ee0cd3d9f 100644 --- a/test/test_run.py +++ b/test/test_run.py @@ -50,7 +50,7 @@ def check_run(self, key, qsub=False): sys.stdout.flush() assert(r == 0) - assert('NOTE: Natural end-of-script for experiment {} with model {}.'.format(key, tests[key][0][0]) in so) + assert('NOTE: Natural end-of-script for experiment {} with model {}'.format(key, tests[key][0][0]) in so) def test_experiments(self): for k in tests.keys(): diff --git a/test/test_run_outputs.py b/test/test_run_outputs.py index 7edb2d6a71..9076d0a78d 100644 --- a/test/test_run_outputs.py +++ b/test/test_run_outputs.py @@ -29,7 +29,7 @@ def check_run_output(self, key): with open(output_filename) as f: s = f.read() - assert('NOTE: Natural end-of-script for experiment {} with model {}.'.format(key, experiments[key][0][0]) in s) + assert('NOTE: Natural end-of-script for experiment {} with model {}'.format(key, experiments[key][0][0]) in s) def test_experiments(self): for k in experiments.keys(): diff --git a/test/test_run_setup.py b/test/test_run_setup.py index be893c097a..0540b2f5ae 100644 --- a/test/test_run_setup.py +++ b/test/test_run_setup.py @@ -19,7 +19,7 @@ def __init__(self): super(TestRunSetup, self).__init__() def check_build(self, model): - ret = self.build(model) + ret = self.build(model, unit_testing=False) assert(ret == 0) def check_download_data(self, experiment):