[cig-commits] [commit] master: Python script to start nightly tests (7c5362c)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Oct 17 03:03:50 PDT 2014


Repository : https://github.com/geodynamics/axisem

On branch  : master
Link       : https://github.com/geodynamics/axisem/compare/64d57f52a76068979585ad03c8331ae0752efab9...7c5362c8e832b62486b3f0b7d862134bedcd7133

>---------------------------------------------------------------

commit 7c5362c8e832b62486b3f0b7d862134bedcd7133
Author: Simon Stähler <staehler at geophysik.uni-muenchen.de>
Date:   Fri Oct 17 12:03:19 2014 +0200

    Python script to start nightly tests
    
     - These tests are stored in repository sstaehler/axisem_nightly_testing


>---------------------------------------------------------------

7c5362c8e832b62486b3f0b7d862134bedcd7133
 TESTING/test_nightly_axisem.py | 85 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/TESTING/test_nightly_axisem.py b/TESTING/test_nightly_axisem.py
new file mode 100644
index 0000000..8007b3c
--- /dev/null
+++ b/TESTING/test_nightly_axisem.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------
+#   Filename:  test_axisem.py
+#   Purpose:   run the AXISEM tests automatically
+#   Author:    Simon Stähler, adapted from Kasra Hosseini
+#   Email:     simon.staehler at geophysik.uni-muenchen.de
+#-------------------------------------------------------------------
+
+import subprocess
+import sys
+import os
+import argparse
+
+parser = argparse.ArgumentParser(description=
+    'Run nightly tests for the axisem solver.')
+
+parser.add_argument('-t', '--test', help='run only selected tests',
+                    choices=range(1,17), type=int)
+parser.add_argument('-a', '--all', help='run all tests', action='store_const',
+                    const=True, default=False)
+args = parser.parse_args()
+
+print args
+
+if (args.test>0): 
+  test_no = '%02d'%(args.test)
+
+else:
+  if not args.a:
+      print '=========================================='
+      test_no = \
+          raw_input('Please enter the test number(s): \n' + \
+              'Elastic tests (PREM)\n' + \
+              '1.  test01: explosion\n' + \
+              '2.  test02: dipole (mxz)\n' + \
+              '3.  test03: quadpole (mxy)\n' + \
+              '4.  test04: CMT (location: north pole)\n' + \
+              '5.  test05: CMT (location: 70N 50E)\n' + \
+              '6.  test06: like test05, but with NetCDF\n' + \
+              '7.  test07: like test05, but with 1 CPU\n' + \
+              '8.  test08: like test05, but with radial slicing\n' + \
+              '9.  test09: explosion, 4x4 mesh\n' + \
+              '10. test10: dipole, 4x4 mesh\n' + \
+              'Anelastic tests, coarse grained (PREM)\n' + \
+              '11. test11: explosion\n' + \
+              '12. test12: dipole (mxz)\n' + \
+              '13. test13: quadpole (mxy)\n' + \
+              'Anelastic tests, memory variables (PREM)\n' + \
+              '14. test14: explosion\n' + \
+              '15. test15: dipole (mxz)\n' + \
+              '16. test16: quadpole (mxy)\n' + \
+              '17. test17: external mesh (PREM)\n' + \
+              '\n(format = 01,02 OR 1,2,3)' + \
+              '\n')
+  else:
+      test_no = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17'
+
+print '=========================================='
+print 'Requested Test numbers:'
+
+for i in range(0, len(test_no.split(','))):
+    num = test_no.split(',')[i]
+    num = num.strip()
+    if len(num) == 1:
+        num = '0' + num
+    print 'test' + num
+print '=========================================='
+
+for i in range(0, len(test_no.split(','))):
+    num = test_no.split(',')[i]
+    num = num.strip()
+    if len(num) == 1:
+        num = '0' + num
+    
+    print '======================='
+    print 'test' + num + ' starts!'
+    print '======================='
+    
+    address = os.path.join('.', 'nightly', 'test_' + num, 'inpython.cfg')
+    address_stas = os.path.join('.', 'nightly', 'test_' + num, 'STATIONS')
+    output = subprocess.check_call(['python', 'PyAxi.py', address, address_stas])
+    if output != 0: print output_print
+    print '=========================================='



More information about the CIG-COMMITS mailing list