Description: Added a basic sanity check to the scons file.
Author: Joel Fenwick <joelfenwick@uq.edu.au>
Forwarded: yes
Applied-Upstream: yes
--- a/SConstruct
+++ b/SConstruct
@@ -683,10 +683,30 @@ install_all_list += ['install_modellib_p
 install_all_list += ['install_pycad_py']
 if env['usempi']:
     install_all_list += ['install_pythonMPI', 'install_overlord']
-env.Alias('install_all', install_all_list)
+install_all_list += ['install_weipa_py']    
+install_all_list += [env.Install(os.path.join(env['build_dir'],'scripts'), os.path.join('scripts', 'release_sanity.py'))]
+install_all=env.Alias('install_all', install_all_list)
 
 # Default target is install
-env.Default('install_all')
+#env.Default('install_all')
+
+
+sanity=env.Alias('sanity', env.Command('dummy','',os.path.join(env['prefix'], 'bin', 'run-escript')+' '+os.path.join(env['build_dir'],'scripts', 'release_sanity.py')))
+env.Depends('dummy', install_all)
+if env['usempi']:
+   #env.Requires('dummy', ['build_pythonMPI', 'install_pythonMPI'])
+   #env.Requires('dummy', env['prefix']+"/lib/pythonMPI")
+   env.Depends('dummy', ['build_pythonMPI', 'install_pythonMPI'])
+   env.Depends('dummy', env['prefix']+"/lib/pythonMPI")   
+
+if 'install_dudley' in install_all_list and \
+   'install_finley' in install_all_list and \
+   'install_ripley' in install_all_list and \
+   'install_speckley' in install_all_list:
+       env.AlwaysBuild('sanity')
+       env.Default('sanity')
+else:
+    env.Default('install_all')
 
 ################## Targets to build and run the test suite ###################
 
--- /dev/null
+++ b/scripts/release_sanity.py
@@ -0,0 +1,27 @@
+
+# Very basic sanity checks following a build
+# It is important that this script does not create any files unless
+# it is _certain_ they are removed when finished or failed.
+# We do not want the source directory polluted by actions here
+
+
+from esys.escript import *
+from esys.escript.linearPDEs import Poisson
+import esys.ripley as ripley
+import esys.finley as finley
+import esys.speckley as speckley
+from esys.weipa import saveVTK
+
+mydomain = finley.Rectangle(l0=1.,l1=1.,n0=40, n1=20)
+# define characteristic function of Gamma^D
+x = mydomain.getX()
+gammaD = whereZero(x[0])+whereZero(x[1])
+# define PDE and get its solution u
+mypde = Poisson(domain=mydomain)
+mypde.setValue(f=1,q=gammaD)
+u = mypde.getSolution()
+# write u to an external file  
+#saveVTK("u.vtu",sol=u)
+
+
+
